1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #ifndef _OPENGL_RENDERER_RENDER_API_H 17 #define _OPENGL_RENDERER_RENDER_API_H 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 #include "render_api_platform_types.h" 24 25 // initLibrary - initialize the library and tries to load the corresponding 26 // GLES translator libraries. This function must be called before anything 27 // else to ensure that everything works. If it returns an error, then 28 // you cannot use the library at all (this can happen under certain 29 // environments where the desktop GL libraries are not available) 30 // 31 // returns true if the library could be initialized successfully; 32 // 33 bool initLibrary(void); 34 35 // list of constants to be passed to setStreamMode, which determines 36 // which 37 #define STREAM_MODE_DEFAULT 0 38 #define STREAM_MODE_TCP 1 39 #define STREAM_MODE_UNIX 2 40 #define STREAM_MODE_PIPE 3 41 42 // Change the stream mode. This must be called before initOpenGLRenderer 43 int setStreamMode(int mode); 44 45 // 46 // initOpenGLRenderer - initialize the OpenGL renderer process. 47 // portNum is the tcp port number the renderer is listening to. 48 // width and height are the framebuffer dimensions that will be 49 // reported to the guest display driver. 50 // 51 // returns true if renderer has been started successfully; 52 // 53 // This function is *NOT* thread safe and should be called first 54 // to initialize the renderer after initLibrary(). 55 // 56 bool initOpenGLRenderer(int width, int height, int portNum); 57 58 59 // 60 // createOpenGLSubwindow - 61 // Create a native subwindow which is a child of 'window' 62 // to be used for framebuffer display. 63 // Framebuffer will not get displayed if a subwindow is not 64 // created. 65 // x,y,width,height are the dimensions of the rendering subwindow. 66 // zRot is the rotation to apply on the framebuffer display image. 67 // 68 bool createOpenGLSubwindow(FBNativeWindowType window, 69 int x, int y, int width, int height, float zRot); 70 71 // 72 // destroyOpenGLSubwindow - 73 // destroys the created native subwindow. Once destroyed, 74 // Framebuffer content will not be visible until a new 75 // subwindow will be created. 76 // 77 bool destroyOpenGLSubwindow(); 78 79 // 80 // setOpenGLDisplatRotation - 81 // set the framebuffer display image rotation in units 82 // of degrees around the z axis 83 // 84 void setOpenGLDisplayRotation(float zRot); 85 86 // 87 // repaintOpenGLDisplay - 88 // causes the OpenGL subwindow to get repainted with the 89 // latest framebuffer content. 90 // 91 void repaintOpenGLDisplay(); 92 93 // 94 // stopOpenGLRenderer - stops the OpenGL renderer process. 95 // This functions is *NOT* thread safe and should be called 96 // only if previous initOpenGLRenderer has returned true. 97 // 98 bool stopOpenGLRenderer(); 99 100 #ifdef __cplusplus 101 } 102 #endif 103 104 #endif 105