DEADSOFTWARE

glIsEnabled uses interanl structures, added glPushAttrib/glPopAttrib (not fully imple...
[nanogl.git] / eglwrap.cpp
1 /*
2 Copyright (C) 2007-2009 Olli Hinkka
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
21 #include "egl.h"
22 #include "gl.h"
23 #include "glesinterface.h"
25 #include <string.h>
27 extern "C++" GlESInterface *glEsImpl;
28 extern "C++" void FlushOnStateChange( );
29 void APIENTRY gl_unimplemented( GLenum none );
31 EGLint eglGetError( void )
32 {
33 return glEsImpl->eglGetError( );
34 }
36 EGLDisplay eglGetDisplay( NativeDisplayType display )
37 {
38 return glEsImpl->eglGetDisplay( display );
39 }
41 EGLBoolean eglInitialize( EGLDisplay dpy, EGLint *major, EGLint *minor )
42 {
43 return glEsImpl->eglInitialize( dpy, major, minor );
44 }
46 EGLBoolean eglTerminate( EGLDisplay dpy )
47 {
48 return glEsImpl->eglTerminate( dpy );
49 }
50 const char *eglQueryString( EGLDisplay dpy, EGLint name )
51 {
52 return glEsImpl->eglQueryString( dpy, name );
53 }
55 #if defined( __MULTITEXTURE_SUPPORT__ )
56 extern "C" void glMultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t );
57 #endif
59 void *eglGetProcAddress( const char *procname )
60 {
61 #if defined( __MULTITEXTURE_SUPPORT__ )
62 if ( !strcmp( procname, "glMultiTexCoord2fARB" ) )
63 {
64 return (void *)&glMultiTexCoord2fARB;
65 }
66 else if ( !strcmp( procname, "glActiveTextureARB" ) )
67 {
68 return (void *)&glActiveTexture;
69 }
70 else if ( !strcmp( procname, "glClientActiveTextureARB" ) )
71 {
72 return (void *)&glClientActiveTexture;
73 }
75 #endif
76 return (void *)glEsImpl->eglGetProcAddress( procname );
77 }
79 EGLBoolean eglGetConfigs( EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config )
80 {
81 return glEsImpl->eglGetConfigs( dpy, configs, config_size, num_config );
82 }
84 EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config )
85 {
86 return glEsImpl->eglChooseConfig( dpy, attrib_list, configs, config_size, num_config );
87 }
89 EGLBoolean eglGetConfigAttrib( EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value )
90 {
91 return glEsImpl->eglGetConfigAttrib( dpy, config, attribute, value );
92 }
94 EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list )
95 {
96 return glEsImpl->eglCreateWindowSurface( dpy, config, window, attrib_list );
97 }
99 EGLSurface eglCreatePixmapSurface( EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list )
101 return glEsImpl->eglCreatePixmapSurface( dpy, config, pixmap, attrib_list );
104 EGLSurface eglCreatePbufferSurface( EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list )
106 return glEsImpl->eglCreatePbufferSurface( dpy, config, attrib_list );
109 EGLBoolean eglDestroySurface( EGLDisplay dpy, EGLSurface surface )
111 return glEsImpl->eglDestroySurface( dpy, surface );
113 EGLBoolean eglQuerySurface( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value )
115 return glEsImpl->eglQuerySurface( dpy, surface, attribute, value );
117 /* EGL 1.1 render-to-texture APIs */
118 EGLBoolean eglSurfaceAttrib( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value )
120 return glEsImpl->eglSurfaceAttrib( dpy, surface, attribute, value );
123 EGLBoolean eglBindTexImage( EGLDisplay dpy, EGLSurface surface, EGLint buffer )
125 return glEsImpl->eglBindTexImage( dpy, surface, buffer );
127 EGLBoolean eglReleaseTexImage( EGLDisplay dpy, EGLSurface surface, EGLint buffer )
129 return glEsImpl->eglReleaseTexImage( dpy, surface, buffer );
132 /* EGL 1.1 swap control API */
133 EGLBoolean eglSwapInterval( EGLDisplay dpy, EGLint interval )
135 return glEsImpl->eglSwapInterval( dpy, interval );
138 EGLContext eglCreateContext( EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list )
140 return glEsImpl->eglCreateContext( dpy, config, share_list, attrib_list );
143 EGLBoolean eglDestroyContext( EGLDisplay dpy, EGLContext ctx )
145 return glEsImpl->eglDestroyContext( dpy, ctx );
148 EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx )
150 FlushOnStateChange( );
151 return glEsImpl->eglMakeCurrent( dpy, draw, read, ctx );
154 EGLContext eglGetCurrentContext( void )
156 return glEsImpl->eglGetCurrentContext( );
158 EGLSurface eglGetCurrentSurface( EGLint readdraw )
160 if ( (void *)glEsImpl->eglGetCurrentSurface == (void *)gl_unimplemented )
161 return EGL_NO_SURFACE;
162 return glEsImpl->eglGetCurrentSurface( readdraw );
164 EGLDisplay eglGetCurrentDisplay( void )
166 if ( (void *)glEsImpl->eglGetCurrentDisplay == (void *)gl_unimplemented )
167 return EGL_NO_DISPLAY;
168 return glEsImpl->eglGetCurrentDisplay( );
171 EGLBoolean eglQueryContext( EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value )
173 return glEsImpl->eglQueryContext( dpy, ctx, attribute, value );
176 EGLBoolean eglWaitGL( void )
178 FlushOnStateChange( );
179 return glEsImpl->eglWaitGL( );
182 EGLBoolean eglWaitNative( EGLint engine )
184 FlushOnStateChange( );
185 return glEsImpl->eglWaitNative( engine );
188 EGLBoolean eglSwapBuffers( EGLDisplay dpy, EGLSurface draw )
190 FlushOnStateChange( );
191 return glEsImpl->eglSwapBuffers( dpy, draw );
194 EGLBoolean eglCopyBuffers( EGLDisplay dpy, EGLSurface surface, NativePixmapType target )
196 FlushOnStateChange( );
197 return glEsImpl->eglCopyBuffers( dpy, surface, target );