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 | #define ANDROID_OPENGLES_BASE_PORT 22468 |
| 18 | |
| 19 | /* Call this function to initialize the hardware opengles emulation. |
| 20 | * This function will abort if we can't find the corresponding host |
| 21 | * libraries through dlopen() or equivalent. |
| 22 | */ |
| 23 | int android_initOpenglesEmulation(void); |
| 24 | |
| 25 | /* 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] | 26 | * At the moment, this must be done before the VM starts. The onPost callback |
| 27 | * may be NULL. |
David 'Digit' Turner | cb88e79 | 2011-08-26 01:35:14 +0200 | [diff] [blame] | 28 | */ |
Jesse Hall | ba5c1f6 | 2012-05-08 15:44:35 -0700 | [diff] [blame] | 29 | int android_startOpenglesRenderer(int width, int height); |
| 30 | |
| 31 | /* See the description in render_api.h. */ |
| 32 | typedef void (*OnPostFunc)(void* context, int width, int height, int ydir, |
| 33 | int format, int type, unsigned char* pixels); |
| 34 | void android_setPostCallback(OnPostFunc onPost, void* onPostContext); |
David 'Digit' Turner | cb88e79 | 2011-08-26 01:35:14 +0200 | [diff] [blame] | 35 | |
Jesse Hall | 733fffa | 2012-04-26 11:07:32 -0700 | [diff] [blame] | 36 | /* Retrieve the Vendor/Renderer/Version strings describing the underlying GL |
| 37 | * implementation. The call only works while the renderer is started. |
| 38 | * |
| 39 | * Each string is copied into the corresponding buffer. If the original string |
| 40 | * (including NUL terminator) is more than xxBufSize bytes, it will be |
| 41 | * truncated. In all cases, including failure, the buffer will be NUL- |
| 42 | * terminated when this function returns. |
| 43 | */ |
| 44 | void android_getOpenglesHardwareStrings(char* vendor, size_t vendorBufSize, |
| 45 | char* renderer, size_t rendererBufSize, |
| 46 | char* version, size_t versionBufSize); |
| 47 | |
David 'Digit' Turner | cb88e79 | 2011-08-26 01:35:14 +0200 | [diff] [blame] | 48 | int android_showOpenglesWindow(void* window, int x, int y, int width, int height, float rotation); |
| 49 | |
| 50 | int android_hideOpenglesWindow(void); |
| 51 | |
| 52 | void android_redrawOpenglesWindow(void); |
| 53 | |
| 54 | /* Stop the renderer process */ |
| 55 | void android_stopOpenglesRenderer(void); |
| 56 | |
David Turner | 7b56a4a | 2011-09-12 18:21:58 +0200 | [diff] [blame] | 57 | /* set to TRUE if you want to use fast GLES pipes, 0 if you want to |
| 58 | * fallback to local TCP ones |
| 59 | */ |
| 60 | extern int android_gles_fast_pipes; |
| 61 | |
| 62 | /* Write the path of the Unix socket we're going to use to access GLES on a given <port> */ |
| 63 | /* The result is only valid on Unix systems */ |
| 64 | void android_gles_unix_path(char* buff, size_t buffsize, int port); |
| 65 | |
David 'Digit' Turner | cb88e79 | 2011-08-26 01:35:14 +0200 | [diff] [blame] | 66 | #endif /* ANDROID_OPENGLES_H */ |