blob: 63302878c1ac3154bbb2c47c399aad61886e997d [file] [log] [blame]
David 'Digit' Turnercb88e792011-08-26 01:35:14 +02001/* 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 Turner7b56a4a2011-09-12 18:21:58 +020015#include <stddef.h>
16
David 'Digit' Turnercb88e792011-08-26 01:35:14 +020017/* 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 */
21int android_initOpenglesEmulation(void);
22
23/* Tries to start the renderer process. Returns 0 on success, -1 on error.
Jesse Hall7105d422012-03-21 11:49:42 -070024 * At the moment, this must be done before the VM starts. The onPost callback
25 * may be NULL.
David 'Digit' Turnercb88e792011-08-26 01:35:14 +020026 */
Jesse Hallba5c1f62012-05-08 15:44:35 -070027int android_startOpenglesRenderer(int width, int height);
28
29/* See the description in render_api.h. */
30typedef void (*OnPostFunc)(void* context, int width, int height, int ydir,
31 int format, int type, unsigned char* pixels);
32void android_setPostCallback(OnPostFunc onPost, void* onPostContext);
David 'Digit' Turnercb88e792011-08-26 01:35:14 +020033
Jesse Hall733fffa2012-04-26 11:07:32 -070034/* 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 */
42void android_getOpenglesHardwareStrings(char* vendor, size_t vendorBufSize,
43 char* renderer, size_t rendererBufSize,
44 char* version, size_t versionBufSize);
45
David 'Digit' Turnercb88e792011-08-26 01:35:14 +020046int android_showOpenglesWindow(void* window, int x, int y, int width, int height, float rotation);
47
48int android_hideOpenglesWindow(void);
49
50void android_redrawOpenglesWindow(void);
51
52/* Stop the renderer process */
53void android_stopOpenglesRenderer(void);
54
David Turner7b56a4a2011-09-12 18:21:58 +020055/* set to TRUE if you want to use fast GLES pipes, 0 if you want to
56 * fallback to local TCP ones
57 */
58extern int android_gles_fast_pipes;
59
Jesse Hall055adab2012-07-11 16:48:28 -070060/* 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 */
64void android_gles_server_path(char* buff, size_t buffsize);
David Turner7b56a4a2011-09-12 18:21:58 +020065
David 'Digit' Turnercb88e792011-08-26 01:35:14 +020066#endif /* ANDROID_OPENGLES_H */