Home | History | Annotate | Download | only in android
      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 
     15 #include <stddef.h>
     16 
     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.
     24  * At the moment, this must be done before the VM starts. The onPost callback
     25  * may be NULL.
     26  */
     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);
     33 
     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 
     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 
     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 
     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);
     65 
     66 #endif /* ANDROID_OPENGLES_H */
     67