David 'Digit' Turner | cb88e79 | 2011-08-26 01:35:14 +0200 | [diff] [blame] | 1 | /* Copyright (C) 2011 The Android Open Source Project |
| 2 | ** |
| 3 | ** This software is licensed under the terms of the GNU General Public |
| 4 | ** License version 2, as published by the Free Software Foundation, and |
| 5 | ** may be copied, distributed, and modified under those terms. |
| 6 | ** |
| 7 | ** This program is distributed in the hope that it will be useful, |
| 8 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | ** GNU General Public License for more details. |
| 11 | */ |
| 12 | #ifndef ANDROID_OPENGLES_H |
| 13 | #define ANDROID_OPENGLES_H |
| 14 | |
David Turner | 7b56a4a | 2011-09-12 18:21:58 +0200 | [diff] [blame] | 15 | #include <stddef.h> |
| 16 | |
David 'Digit' Turner | cb88e79 | 2011-08-26 01:35:14 +0200 | [diff] [blame] | 17 | /* Call this function to initialize the hardware opengles emulation. |
| 18 | * This function will abort if we can't find the corresponding host |
| 19 | * libraries through dlopen() or equivalent. |
| 20 | */ |
| 21 | int android_initOpenglesEmulation(void); |
| 22 | |
| 23 | /* Tries to start the renderer process. Returns 0 on success, -1 on error. |
Jesse Hall | 7105d42 | 2012-03-21 11:49:42 -0700 | [diff] [blame] | 24 | * At the moment, this must be done before the VM starts. The onPost callback |
| 25 | * may be NULL. |
David 'Digit' Turner | cb88e79 | 2011-08-26 01:35:14 +0200 | [diff] [blame] | 26 | */ |
Jesse Hall | ba5c1f6 | 2012-05-08 15:44:35 -0700 | [diff] [blame] | 27 | int android_startOpenglesRenderer(int width, int height); |
| 28 | |
| 29 | /* See the description in render_api.h. */ |
| 30 | typedef void (*OnPostFunc)(void* context, int width, int height, int ydir, |
| 31 | int format, int type, unsigned char* pixels); |
| 32 | void android_setPostCallback(OnPostFunc onPost, void* onPostContext); |
David 'Digit' Turner | cb88e79 | 2011-08-26 01:35:14 +0200 | [diff] [blame] | 33 | |
Jesse Hall | 733fffa | 2012-04-26 11:07:32 -0700 | [diff] [blame] | 34 | /* Retrieve the Vendor/Renderer/Version strings describing the underlying GL |
| 35 | * implementation. The call only works while the renderer is started. |
| 36 | * |
| 37 | * Each string is copied into the corresponding buffer. If the original string |
| 38 | * (including NUL terminator) is more than xxBufSize bytes, it will be |
| 39 | * truncated. In all cases, including failure, the buffer will be NUL- |
| 40 | * terminated when this function returns. |
| 41 | */ |
| 42 | void android_getOpenglesHardwareStrings(char* vendor, size_t vendorBufSize, |
| 43 | char* renderer, size_t rendererBufSize, |
| 44 | char* version, size_t versionBufSize); |
| 45 | |
David 'Digit' Turner | cb88e79 | 2011-08-26 01:35:14 +0200 | [diff] [blame] | 46 | int android_showOpenglesWindow(void* window, int x, int y, int width, int height, float rotation); |
| 47 | |
| 48 | int android_hideOpenglesWindow(void); |
| 49 | |
| 50 | void android_redrawOpenglesWindow(void); |
| 51 | |
| 52 | /* Stop the renderer process */ |
| 53 | void android_stopOpenglesRenderer(void); |
| 54 | |
David Turner | 7b56a4a | 2011-09-12 18:21:58 +0200 | [diff] [blame] | 55 | /* set to TRUE if you want to use fast GLES pipes, 0 if you want to |
| 56 | * fallback to local TCP ones |
| 57 | */ |
| 58 | extern int android_gles_fast_pipes; |
| 59 | |
Jesse Hall | 055adab | 2012-07-11 16:48:28 -0700 | [diff] [blame] | 60 | /* Get the address of the socket that clients should connect to to access GLES. |
| 61 | * For TCP this is just the port number (as a string) on the loopback address. |
| 62 | * For UNIX and Win32 pipes it is the full pathname of the pipe. |
| 63 | */ |
| 64 | void android_gles_server_path(char* buff, size_t buffsize); |
David Turner | 7b56a4a | 2011-09-12 18:21:58 +0200 | [diff] [blame] | 65 | |
David 'Digit' Turner | cb88e79 | 2011-08-26 01:35:14 +0200 | [diff] [blame] | 66 | #endif /* ANDROID_OPENGLES_H */ |