aboutsummaryrefslogtreecommitdiffstats
path: root/android/opengles.h
blob: 63302878c1ac3154bbb2c47c399aad61886e997d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* Copyright (C) 2011 The Android Open Source Project
**
** This software is licensed under the terms of the GNU General Public
** License version 2, as published by the Free Software Foundation, and
** may be copied, distributed, and modified under those terms.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
*/
#ifndef ANDROID_OPENGLES_H
#define ANDROID_OPENGLES_H

#include <stddef.h>

/* Call this function to initialize the hardware opengles emulation.
 * This function will abort if we can't find the corresponding host
 * libraries through dlopen() or equivalent.
 */
int android_initOpenglesEmulation(void);

/* Tries to start the renderer process. Returns 0 on success, -1 on error.
 * At the moment, this must be done before the VM starts. The onPost callback
 * may be NULL.
 */
int android_startOpenglesRenderer(int width, int height);

/* See the description in render_api.h. */
typedef void (*OnPostFunc)(void* context, int width, int height, int ydir,
                           int format, int type, unsigned char* pixels);
void android_setPostCallback(OnPostFunc onPost, void* onPostContext);

/* Retrieve the Vendor/Renderer/Version strings describing the underlying GL
 * implementation. The call only works while the renderer is started.
 *
 * Each string is copied into the corresponding buffer. If the original string
 * (including NUL terminator) is more than xxBufSize bytes, it will be
 * truncated. In all cases, including failure, the buffer will be NUL-
 * terminated when this function returns.
 */
void android_getOpenglesHardwareStrings(char* vendor, size_t vendorBufSize,
                                        char* renderer, size_t rendererBufSize,
                                        char* version, size_t versionBufSize);

int android_showOpenglesWindow(void* window, int x, int y, int width, int height, float rotation);

int android_hideOpenglesWindow(void);

void android_redrawOpenglesWindow(void);

/* Stop the renderer process */
void android_stopOpenglesRenderer(void);

/* set to TRUE if you want to use fast GLES pipes, 0 if you want to
 * fallback to local TCP ones
 */
extern int  android_gles_fast_pipes;

/* Get the address of the socket that clients should connect to to access GLES.
 * For TCP this is just the port number (as a string) on the loopback address.
 * For UNIX and Win32 pipes it is the full pathname of the pipe.
 */
void android_gles_server_path(char* buff, size_t buffsize);

#endif /* ANDROID_OPENGLES_H */