最近忙着折腾引擎的移植。大部分的OpenGL 功能都已经搞定。还有一些边边角角的东西尚未完善。
今天刚考完交规,回来就顺手折腾最边角的事情---Win32下的ES Emulator的支持。
原来我的GLES2用的是ati最新的驱动里带的。使用的ati自己的 sample。 但是这个有点囧。感觉不是特别靠谱,毕竟是大集里裁下来的东西,也许这个集合支持的更好一些。而真正硬件会严格很多。于是准备支持多个Emulator.
目前我手边可选的Emulator有这些
1. Mali ARM的ES 2.0 Emulator [libEGL.dll libEGLSv2.dll]
2. AMD 2009的Emulator [libEGL.dll libEGLSv2.dll]
3. Ati的atioglxx.dll
4. NV的Emulator.
这几个Emulator中,第二个是我以前用过。但是没成功。NV的据龚敏敏说不好使,暂时不考虑。现在就先支持前面三个。因为atioglxx.dll中大部分的函数加载都做完了,于是决定做一个EGL2Wrapper。程序只连接这个Wrapper。这个Wrapper则动态的加载不同的dll
这些Emulator中, 当然atioglxx.dll是性能最好的,最省事的。其次是AMD 2009的Emulator。但是这个模拟器明显就对glsl语法严格很多。precesion lowp float这样的语句必须放在最前面。
而Mali的则是最头疼的,性能也最差,glShaderBinary没法用。glCompileShader又弹出个console来,而且,对语法要求比AMD 2009还恶心。 mul函数不支持矩阵和向量乘法, highp就更不想了。0.0f 这样的浮点数写法都有错,更多的细节大家慢慢体会吧。
因此,如果想多平台运行,还是推荐AMD2009那个Emulator。官网已经吓不倒了。其它地方再找找吧。
注意一下,libEGL.dll是有可能依赖于libEGLSv2.dll的。 所以,在很多时候,在LoadLibrary(libEGL.dll)的时候,应该把当前路劲设置到libEGL.dll所在的路径。
整个EGL2Wrapper.lib的使用如下:
SetCurrentDirectory( eglPath.c_str() );
Init_EGL_WRAPPER( L"Mali/libEGL.dll" , L"Mali/libEGLSv2.dll" );
//初始化EGL.....
Init_GLES_WRAPPER( L"Mali/libEGLSv2.dll" );
为啥要在EGL初始化好后再初始化EGLS_WRAPPER呢?因为有些时候,如果Context没创建好,eglGetProccAdress可能拿不到东西。
另外,下面的代码中,GetGLEntry 函数也长的比较奇怪,这是因为有些库函数名比较奇怪。暴力法则,兼容性好一些。
下面只提供了EGL2Wrapper。同时我还做了EGLWrapper。支持Mali的EGL1.1 Emulator.
用Wrapper的好处是,一不要lib了。二可以很多个Emulator通过配置文件来切换了。
----------------------------------------------------------------------------------------------
我是分割线,分割线以下的代码请编译成.dll和.lib. 部分代码来自AMD的es_sample
----------------------------------------------------------------------------------------------
#include <windows.h>
#include <GLES2/gl2.h>
#include <EGL/egl.h>
#define FNDEF(retType, funcName, args) retType (APIENTRY *funcPtr_##funcName ) args = NULL
FNDEF(EGLint , eglGetError, (void));
FNDEF(EGLDisplay, eglGetDisplay, (NativeDisplayType display));
FNDEF(EGLBoolean, eglInitialize, (EGLDisplay dpy, EGLint *major, EGLint *minor));
FNDEF(EGLBoolean, eglTerminate, (EGLDisplay dpy));
FNDEF(const char*, eglQueryString, (EGLDisplay dpy, EGLint name));
FNDEF(EGLBoolean, eglGetConfigs, (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config));
FNDEF(EGLBoolean, eglChooseConfig, (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config));
FNDEF(EGLBoolean, eglGetConfigAttrib, (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value));
FNDEF(EGLSurface, eglCreateWindowSurface, (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list));
FNDEF(EGLBoolean, eglDestroySurface, (EGLDisplay dpy, EGLSurface surface));
FNDEF(EGLBoolean, eglQuerySurface, (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value));
FNDEF(EGLBoolean, eglBindAPI, (EGLenum api));
FNDEF(EGLenum, eglQueryAPI, (void));
FNDEF(EGLBoolean, eglWaitClient, (void));
FNDEF(EGLBoolean, eglReleaseThread, (void));
FNDEF(EGLBoolean, eglSurfaceAttrib, (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value));
FNDEF(EGLBoolean, eglBindTexImage, (EGLDisplay dpy, EGLSurface surface, EGLint buffer));
FNDEF(EGLBoolean, eglReleaseTexImage, (EGLDisplay dpy, EGLSurface surface, EGLint buffer));
FNDEF(EGLBoolean, eglSwapInterval, (EGLDisplay dpy, EGLint interval));
FNDEF(EGLContext, eglCreateContext, (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list));
FNDEF(EGLBoolean, eglDestroyContext, (EGLDisplay dpy, EGLContext ctx));
FNDEF(EGLBoolean, eglMakeCurrent, (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx));
FNDEF(EGLContext, eglGetCurrentContext, (void));
FNDEF(EGLSurface, eglGetCurrentSurface, (EGLint readdraw));
FNDEF(EGLDisplay, eglGetCurrentDisplay, (void));
FNDEF(EGLBoolean, eglQueryContext, (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value));
FNDEF(EGLBoolean, eglWaitGL, (void));
FNDEF(EGLBoolean, eglWaitNative, (EGLint engine));
FNDEF(EGLBoolean, eglSwapBuffers, (EGLDisplay dpy, EGLSurface draw));
FNDEF(EGLBoolean, eglCopyBuffers, (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target));
FNDEF(__eglMustCastToProperFunctionPointerType, eglGetProcAddress, (const char *procname));
//////////////////////////////////////////////////////////////////////////
FNDEF( void , glActiveTexture , (GLenum texture));
FNDEF( void , glAttachShader , (GLuint program, GLuint shader));
FNDEF( void , glBindAttribLocation , (GLuint program, GLuint index, const char* name));
FNDEF( void , glBindBuffer , (GLenum target, GLuint buffer));
FNDEF( void , glBindFramebuffer , (GLenum target, GLuint framebuffer));
FNDEF( void , glBindRenderbuffer , (GLenum target, GLuint renderbuffer));
FNDEF( void , glBindTexture , (GLenum target, GLuint texture));
FNDEF( void , glBlendColor , (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha));
FNDEF( void , glBlendEquation , ( GLenum mode ));
FNDEF( void , glBlendEquationSeparate , (GLenum modeRGB, GLenum modeAlpha));
FNDEF( void , glBlendFunc , (GLenum sfactor, GLenum dfactor));
FNDEF( void , glBlendFuncSeparate , (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha));
FNDEF( void , glBufferData , (GLenum target, GLsizeiptr size, const void* data, GLenum usage));
FNDEF( void , glBufferSubData , (GLenum target, GLintptr offset, GLsizeiptr size, const void* data));
FNDEF( GLenum , glCheckFramebufferStatus , (GLenum target));
FNDEF( void , glClear , (GLbitfield mask));
FNDEF( void , glClearColor , (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha));
FNDEF( void , glClearDepthf , (GLclampf depth));
FNDEF( void , glClearStencil , (GLint s));
FNDEF( void , glColorMask , (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha));
FNDEF( void , glCompileShader , (GLuint shader));
FNDEF( void , glCompressedTexImage2D , (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data));
FNDEF( void , glCompressedTexSubImage2D , (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data));
FNDEF( void , glCopyTexImage2D , (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border));
FNDEF( void , glCopyTexSubImage2D , (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height));
FNDEF( GLuint , glCreateProgram , (void));
FNDEF( GLuint , glCreateShader , (GLenum type));
FNDEF( void , glCullFace , (GLenum mode));
FNDEF( void , glDeleteBuffers , (GLsizei n, const GLuint* buffers));
FNDEF( void , glDeleteFramebuffers , (GLsizei n, const GLuint* framebuffers));
FNDEF( void , glDeleteTextures , (GLsizei n, const GLuint* textures));
FNDEF( void , glDeleteProgram , (GLuint program));
FNDEF( void , glDeleteRenderbuffers , (GLsizei n, const GLuint* renderbuffers));
FNDEF( void , glDeleteShader , (GLuint shader));
FNDEF( void , glDetachShader , (GLuint program, GLuint shader));
FNDEF( void , glDepthFunc , (GLenum func));
FNDEF( void , glDepthMask , (GLboolean flag));
FNDEF( void , glDepthRangef , (GLclampf zNear, GLclampf zFar));
FNDEF( void , glDisable , (GLenum cap));
FNDEF( void , glDisableVertexAttribArray , (GLuint index));
FNDEF( void , glDrawArrays , (GLenum mode, GLint first, GLsizei count));
FNDEF( void , glDrawElements , (GLenum mode, GLsizei count, GLenum type, const void* indices));
FNDEF( void , glEnable , (GLenum cap));
FNDEF( void , glEnableVertexAttribArray , (GLuint index));
FNDEF( void , glFinish , (void));
FNDEF( void , glFlush , (void));
FNDEF( void , glFramebufferRenderbuffer , (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer));
FNDEF( void , glFramebufferTexture2D , (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level));
FNDEF( void , glFrontFace , (GLenum mode));
FNDEF( void , glGenBuffers , (GLsizei n, GLuint* buffers));
FNDEF( void , glGenerateMipmap , (GLenum target));
FNDEF( void , glGenFramebuffers , (GLsizei n, GLuint* framebuffers));
FNDEF( void , glGenRenderbuffers , (GLsizei n, GLuint* renderbuffers));
FNDEF( void , glGenTextures , (GLsizei n, GLuint* textures));
FNDEF( void , glGetActiveAttrib , (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name));
FNDEF( void , glGetActiveUniform , (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name));
FNDEF( void , glGetAttachedShaders , (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders));
FNDEF( int , glGetAttribLocation , (GLuint program, const char* name));
FNDEF( void , glGetBooleanv , (GLenum pname, GLboolean* params));
FNDEF( void , glGetBufferParameteriv , (GLenum target, GLenum pname, GLint* params));
FNDEF( GLenum , glGetError , (void));
FNDEF( void , glGetFloatv , (GLenum pname, GLfloat* params));
FNDEF( void , glGetFramebufferAttachmentParameteriv , (GLenum target, GLenum attachment, GLenum pname, GLint* params));
FNDEF( void , glGetIntegerv , (GLenum pname, GLint* params));
FNDEF( void , glGetProgramiv , (GLuint program, GLenum pname, GLint* params));
FNDEF( void , glGetProgramInfoLog , (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog));
FNDEF( void , glGetRenderbufferParameteriv , (GLenum target, GLenum pname, GLint* params));
FNDEF( void , glGetShaderiv , (GLuint shader, GLenum pname, GLint* params));
FNDEF( void , glGetShaderInfoLog , (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog));
FNDEF( void , glGetShaderPrecisionFormat , (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision));
FNDEF( void , glGetShaderSource , (GLuint shader, GLsizei bufsize, GLsizei* length, char* source));
FNDEF( const GLubyte* , glGetString , (GLenum name));
FNDEF( void , glGetTexParameterfv , (GLenum target, GLenum pname, GLfloat* params));
FNDEF( void , glGetTexParameteriv , (GLenum target, GLenum pname, GLint* params));
FNDEF( void , glGetUniformfv , (GLuint program, GLint location, GLfloat* params));
FNDEF( void , glGetUniformiv , (GLuint program, GLint location, GLint* params));
FNDEF( int , glGetUniformLocation , (GLuint program, const char* name));
FNDEF( void , glGetVertexAttribfv , (GLuint index, GLenum pname, GLfloat* params));
FNDEF( void , glGetVertexAttribiv , (GLuint index, GLenum pname, GLint* params));
FNDEF( void , glGetVertexAttribPointerv , (GLuint index, GLenum pname, void** pointer));
FNDEF( void , glHint , (GLenum target, GLenum mode));
FNDEF( GLboolean , glIsBuffer , (GLuint buffer));
FNDEF( GLboolean , glIsEnabled , (GLenum cap));
FNDEF( GLboolean , glIsFramebuffer , (GLuint framebuffer));
FNDEF( GLboolean , glIsProgram , (GLuint program));
FNDEF( GLboolean , glIsRenderbuffer , (GLuint renderbuffer));
FNDEF( GLboolean , glIsShader , (GLuint shader));
FNDEF( GLboolean , glIsTexture , (GLuint texture));
FNDEF( void , glLineWidth , (GLfloat width));
FNDEF( void , glLinkProgram , (GLuint program));
FNDEF( void , glPixelStorei , (GLenum pname, GLint param));
FNDEF( void , glPolygonOffset , (GLfloat factor, GLfloat units));
FNDEF( void , glReadPixels , (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels));
FNDEF( void , glReleaseShaderCompiler , (void));
FNDEF( void , glRenderbufferStorage , (GLenum target, GLenum internalformat, GLsizei width, GLsizei height));
FNDEF( void , glSampleCoverage , (GLclampf value, GLboolean invert));
FNDEF( void , glScissor , (GLint x, GLint y, GLsizei width, GLsizei height));
FNDEF( void , glShaderBinary , (GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length));
FNDEF( void , glShaderSource , (GLuint shader, GLsizei count, const char** string, const GLint* length));
FNDEF( void , glStencilFunc , (GLenum func, GLint ref, GLuint mask));
FNDEF( void , glStencilFuncSeparate , (GLenum face, GLenum func, GLint ref, GLuint mask));
FNDEF( void , glStencilMask , (GLuint mask));
FNDEF( void , glStencilMaskSeparate , (GLenum face, GLuint mask));
FNDEF( void , glStencilOp , (GLenum fail, GLenum zfail, GLenum zpass));
FNDEF( void , glStencilOpSeparate , (GLenum face, GLenum fail, GLenum zfail, GLenum zpass));
FNDEF( void , glTexImage2D , (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels));
FNDEF( void , glTexParameterf , (GLenum target, GLenum pname, GLfloat param));
FNDEF( void , glTexParameterfv , (GLenum target, GLenum pname, const GLfloat* params));
FNDEF( void , glTexParameteri , (GLenum target, GLenum pname, GLint param));
FNDEF( void , glTexParameteriv , (GLenum target, GLenum pname, const GLint* params));
FNDEF( void , glTexSubImage2D , (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels));
FNDEF( void , glUniform1f , (GLint location, GLfloat x));
FNDEF( void , glUniform1fv , (GLint location, GLsizei count, const GLfloat* v));
FNDEF( void , glUniform1i , (GLint location, GLint x));
FNDEF( void , glUniform1iv , (GLint location, GLsizei count, const GLint* v));
FNDEF( void , glUniform2f , (GLint location, GLfloat x, GLfloat y));
FNDEF( void , glUniform2fv , (GLint location, GLsizei count, const GLfloat* v));
FNDEF( void , glUniform2i , (GLint location, GLint x, GLint y));
FNDEF( void , glUniform2iv , (GLint location, GLsizei count, const GLint* v));
FNDEF( void , glUniform3f , (GLint location, GLfloat x, GLfloat y, GLfloat z));
FNDEF( void , glUniform3fv , (GLint location, GLsizei count, const GLfloat* v));
FNDEF( void , glUniform3i , (GLint location, GLint x, GLint y, GLint z));
FNDEF( void , glUniform3iv , (GLint location, GLsizei count, const GLint* v));
FNDEF( void , glUniform4f , (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w));
FNDEF( void , glUniform4fv , (GLint location, GLsizei count, const GLfloat* v));
FNDEF( void , glUniform4i , (GLint location, GLint x, GLint y, GLint z, GLint w));
FNDEF( void , glUniform4iv , (GLint location, GLsizei count, const GLint* v));
FNDEF( void , glUniformMatrix2fv , (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value));
FNDEF( void , glUniformMatrix3fv , (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value));
FNDEF( void , glUniformMatrix4fv , (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value));
FNDEF( void , glUseProgram , (GLuint program));
FNDEF( void , glValidateProgram , (GLuint program));
FNDEF( void , glVertexAttrib1f , (GLuint indx, GLfloat x));
FNDEF( void , glVertexAttrib1fv , (GLuint indx, const GLfloat* values));
FNDEF( void , glVertexAttrib2f , (GLuint indx, GLfloat x, GLfloat y));
FNDEF( void , glVertexAttrib2fv , (GLuint indx, const GLfloat* values));
FNDEF( void , glVertexAttrib3f , (GLuint indx, GLfloat x, GLfloat y, GLfloat z));
FNDEF( void , glVertexAttrib3fv , (GLuint indx, const GLfloat* values));
FNDEF( void , glVertexAttrib4f , (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w));
FNDEF( void , glVertexAttrib4fv , (GLuint indx, const GLfloat* values));
FNDEF( void , glVertexAttribPointer , (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr));
FNDEF( void , glViewport , (GLint x, GLint y, GLsizei width, GLsizei height));
#undef FN
#undef FNPTR
#define FNPTR(name) funcPtr_##name
#pragma warning(disable : 4273)
__declspec(dllexport) EGLint EGLAPIENTRY eglGetError(void)
{
return funcPtr_eglGetError() ;
}
__declspec(dllexport) EGLDisplay EGLAPIENTRY eglGetDisplay(NativeDisplayType display)
{
return funcPtr_eglGetDisplay(display);
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
{
return funcPtr_eglInitialize(dpy , major , minor);
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy)
{
return funcPtr_eglTerminate(dpy);
}
__declspec(dllexport) const char* EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name)
{
return funcPtr_eglQueryString(dpy , name);
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
{
return funcPtr_eglGetConfigs(dpy, configs, config_size, num_config);
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
{
return funcPtr_eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
{
return funcPtr_eglGetConfigAttrib(dpy, config, attribute, value);
}
__declspec(dllexport) EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list)
{
return funcPtr_eglCreateWindowSurface(dpy, config, window, attrib_list);
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
{
return funcPtr_eglDestroySurface(dpy, surface);
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
{
return funcPtr_eglQuerySurface(dpy, surface, attribute, value);
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api)
{
return funcPtr_eglBindAPI( api );
}
__declspec(dllexport) EGLenum EGLAPIENTRY eglQueryAPI(void)
{
return funcPtr_eglQueryAPI();
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglWaitClient(void)
{
return funcPtr_eglWaitClient();
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglReleaseThread(void)
{
return funcPtr_eglReleaseThread();
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
{
return funcPtr_eglSurfaceAttrib(dpy, surface, attribute, value);
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
return funcPtr_eglBindTexImage(dpy, surface, buffer) ;
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
return funcPtr_eglReleaseTexImage(dpy, surface, buffer) ;
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval)
{
return funcPtr_eglSwapInterval(dpy, interval);
}
__declspec(dllexport) EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
{
return funcPtr_eglCreateContext(dpy, config, share_list, attrib_list) ;
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
{
return funcPtr_eglDestroyContext(dpy, ctx);
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
{
return funcPtr_eglMakeCurrent(dpy, draw, read, ctx);
}
__declspec(dllexport) EGLContext EGLAPIENTRY eglGetCurrentContext(void)
{
return funcPtr_eglGetCurrentContext();
}
__declspec(dllexport) EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw)
{
return funcPtr_eglGetCurrentSurface(readdraw);
}
__declspec(dllexport) EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void)
{
return funcPtr_eglGetCurrentDisplay();
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
{
return funcPtr_eglQueryContext(dpy, ctx, attribute, value);
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglWaitGL(void)
{
return funcPtr_eglWaitGL();
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine)
{
return funcPtr_eglWaitNative(engine);
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
{
return funcPtr_eglSwapBuffers(dpy, draw);
}
__declspec(dllexport) EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
{
return funcPtr_eglCopyBuffers(dpy, surface, target);
}
__declspec(dllexport) __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname)
{
return funcPtr_eglGetProcAddress(procname) ;
}
//////////////////////////////////////////////////////////////////////////
__declspec(dllexport) void GL_APIENTRY glActiveTexture(GLenum texture) { funcPtr_glActiveTexture( texture); }
__declspec(dllexport) void GL_APIENTRY glAttachShader(GLuint program, GLuint shader) { funcPtr_glAttachShader( program, shader); }
__declspec(dllexport) void GL_APIENTRY glBindAttribLocation(GLuint program, GLuint index, const char* name) { funcPtr_glBindAttribLocation( program, index, name); }
__declspec(dllexport) void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer) { funcPtr_glBindBuffer( target, buffer); }
__declspec(dllexport) void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer) { funcPtr_glBindFramebuffer( target, framebuffer); }
__declspec(dllexport) void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer) { funcPtr_glBindRenderbuffer( target, renderbuffer); }
__declspec(dllexport) void GL_APIENTRY glBindTexture(GLenum target, GLuint texture) { funcPtr_glBindTexture( target, texture); }
__declspec(dllexport) void GL_APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { funcPtr_glBlendColor( red, green, blue, alpha); }
__declspec(dllexport) void GL_APIENTRY glBlendEquation( GLenum mode ) { funcPtr_glBlendEquation( mode ); }
__declspec(dllexport) void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { funcPtr_glBlendEquationSeparate( modeRGB, modeAlpha); }
__declspec(dllexport) void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) { funcPtr_glBlendFunc( sfactor, dfactor); }
__declspec(dllexport) void GL_APIENTRY glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { funcPtr_glBlendFuncSeparate( srcRGB, dstRGB, srcAlpha, dstAlpha); }
__declspec(dllexport) void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage) { funcPtr_glBufferData( target, size, data, usage); }
__declspec(dllexport) void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { funcPtr_glBufferSubData( target, offset, size, data); }
__declspec(dllexport) GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target) { return funcPtr_glCheckFramebufferStatus( target); }
__declspec(dllexport) void GL_APIENTRY glClear(GLbitfield mask) { funcPtr_glClear( mask); }
__declspec(dllexport) void GL_APIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { funcPtr_glClearColor( red, green, blue, alpha); }
__declspec(dllexport) void GL_APIENTRY glClearDepthf(GLclampf depth) { funcPtr_glClearDepthf( depth); }
__declspec(dllexport) void GL_APIENTRY glClearStencil(GLint s) { funcPtr_glClearStencil( s); }
__declspec(dllexport) void GL_APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { funcPtr_glColorMask( red, green, blue, alpha); }
__declspec(dllexport) void GL_APIENTRY glCompileShader(GLuint shader) { funcPtr_glCompileShader( shader); }
__declspec(dllexport) void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) { funcPtr_glCompressedTexImage2D( target, level, internalformat, width, height, border, imageSize, data); }
__declspec(dllexport) void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) { funcPtr_glCompressedTexSubImage2D( target, level, xoffset, yoffset, width, height, format, imageSize, data); }
__declspec(dllexport) void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { funcPtr_glCopyTexImage2D( target, level, internalformat, x, y, width, height, border); }
__declspec(dllexport) void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { funcPtr_glCopyTexSubImage2D( target, level, xoffset, yoffset, x, y, width, height); }
__declspec(dllexport) GLuint GL_APIENTRY glCreateProgram(void) { return funcPtr_glCreateProgram(); }
__declspec(dllexport) GLuint GL_APIENTRY glCreateShader(GLenum type) { return funcPtr_glCreateShader( type); }
__declspec(dllexport) void GL_APIENTRY glCullFace(GLenum mode) { funcPtr_glCullFace( mode); }
__declspec(dllexport) void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers) { funcPtr_glDeleteBuffers( n, buffers); }
__declspec(dllexport) void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { funcPtr_glDeleteFramebuffers( n, framebuffers); }
__declspec(dllexport) void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint* textures) { funcPtr_glDeleteTextures( n, textures); }
__declspec(dllexport) void GL_APIENTRY glDeleteProgram(GLuint program) { funcPtr_glDeleteProgram( program); }
__declspec(dllexport) void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { funcPtr_glDeleteRenderbuffers( n, renderbuffers); }
__declspec(dllexport) void GL_APIENTRY glDeleteShader(GLuint shader) { funcPtr_glDeleteShader( shader); }
__declspec(dllexport) void GL_APIENTRY glDetachShader(GLuint program, GLuint shader) { funcPtr_glDetachShader( program, shader); }
__declspec(dllexport) void GL_APIENTRY glDepthFunc(GLenum func) { funcPtr_glDepthFunc( func); }
__declspec(dllexport) void GL_APIENTRY glDepthMask(GLboolean flag) { funcPtr_glDepthMask( flag); }
__declspec(dllexport) void GL_APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar) { funcPtr_glDepthRangef( zNear, zFar); }
__declspec(dllexport) void GL_APIENTRY glDisable(GLenum cap) { funcPtr_glDisable( cap); }
__declspec(dllexport) void GL_APIENTRY glDisableVertexAttribArray(GLuint index) { funcPtr_glDisableVertexAttribArray( index); }
__declspec(dllexport) void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) { funcPtr_glDrawArrays( mode, first, count); }
__declspec(dllexport) void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) { funcPtr_glDrawElements( mode, count, type, indices); }
__declspec(dllexport) void GL_APIENTRY glEnable(GLenum cap) { funcPtr_glEnable( cap); }
__declspec(dllexport) void GL_APIENTRY glEnableVertexAttribArray(GLuint index) { funcPtr_glEnableVertexAttribArray( index); }
__declspec(dllexport) void GL_APIENTRY glFinish(void) { funcPtr_glFinish(); }
__declspec(dllexport) void GL_APIENTRY glFlush(void) { funcPtr_glFlush(); }
__declspec(dllexport) void GL_APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { funcPtr_glFramebufferRenderbuffer( target, attachment, renderbuffertarget, renderbuffer); }
__declspec(dllexport) void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { funcPtr_glFramebufferTexture2D( target, attachment, textarget, texture, level); }
__declspec(dllexport) void GL_APIENTRY glFrontFace(GLenum mode) { funcPtr_glFrontFace( mode); }
__declspec(dllexport) void GL_APIENTRY glGenBuffers(GLsizei n, GLuint* buffers) { funcPtr_glGenBuffers( n, buffers); }
__declspec(dllexport) void GL_APIENTRY glGenerateMipmap(GLenum target) { funcPtr_glGenerateMipmap( target); }
__declspec(dllexport) void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers) { funcPtr_glGenFramebuffers( n, framebuffers); }
__declspec(dllexport) void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) { funcPtr_glGenRenderbuffers( n, renderbuffers); }
__declspec(dllexport) void GL_APIENTRY glGenTextures(GLsizei n, GLuint* textures) { funcPtr_glGenTextures( n, textures); }
__declspec(dllexport) void GL_APIENTRY glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { funcPtr_glGetActiveAttrib( program, index, bufsize, length, size, type, name); }
__declspec(dllexport) void GL_APIENTRY glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { funcPtr_glGetActiveUniform( program, index, bufsize, length, size, type, name); }
__declspec(dllexport) void GL_APIENTRY glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { funcPtr_glGetAttachedShaders( program, maxcount, count, shaders); }
__declspec(dllexport) int GL_APIENTRY glGetAttribLocation(GLuint program, const char* name) { return funcPtr_glGetAttribLocation( program, name); }
__declspec(dllexport) void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* params) { funcPtr_glGetBooleanv( pname, params); }
__declspec(dllexport) void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { funcPtr_glGetBufferParameteriv( target, pname, params); }
__declspec(dllexport) GLenum GL_APIENTRY glGetError(void) { return funcPtr_glGetError(); }
__declspec(dllexport) void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params) { funcPtr_glGetFloatv( pname, params); }
__declspec(dllexport) void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) { funcPtr_glGetFramebufferAttachmentParameteriv( target, attachment, pname, params); }
__declspec(dllexport) void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params) { funcPtr_glGetIntegerv( pname, params); }
__declspec(dllexport) void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params) { funcPtr_glGetProgramiv( program, pname, params); }
__declspec(dllexport) void GL_APIENTRY glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { funcPtr_glGetProgramInfoLog( program, bufsize, length, infolog); }
__declspec(dllexport) void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { funcPtr_glGetRenderbufferParameteriv( target, pname, params); }
__declspec(dllexport) void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params) { funcPtr_glGetShaderiv( shader, pname, params); }
__declspec(dllexport) void GL_APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { funcPtr_glGetShaderInfoLog( shader, bufsize, length, infolog); }
__declspec(dllexport) void GL_APIENTRY glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { funcPtr_glGetShaderPrecisionFormat( shadertype, precisiontype, range, precision); }
__declspec(dllexport) void GL_APIENTRY glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { funcPtr_glGetShaderSource( shader, bufsize, length, source); }
__declspec(dllexport) const GLubyte* GL_APIENTRY glGetString(GLenum name) { return funcPtr_glGetString( name); }
__declspec(dllexport) void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { funcPtr_glGetTexParameterfv( target, pname, params); }
__declspec(dllexport) void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) { funcPtr_glGetTexParameteriv( target, pname, params); }
__declspec(dllexport) void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params) { funcPtr_glGetUniformfv( program, location, params); }
__declspec(dllexport) void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params) { funcPtr_glGetUniformiv( program, location, params); }
__declspec(dllexport) int GL_APIENTRY glGetUniformLocation(GLuint program, const char* name) { return funcPtr_glGetUniformLocation( program, name); }
__declspec(dllexport) void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) { funcPtr_glGetVertexAttribfv( index, pname, params); }
__declspec(dllexport) void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) { funcPtr_glGetVertexAttribiv( index, pname, params); }
__declspec(dllexport) void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) { funcPtr_glGetVertexAttribPointerv( index, pname, pointer); }
__declspec(dllexport) void GL_APIENTRY glHint(GLenum target, GLenum mode) { funcPtr_glHint( target, mode); }
__declspec(dllexport) GLboolean GL_APIENTRY glIsBuffer(GLuint buffer) { return funcPtr_glIsBuffer( buffer); }
__declspec(dllexport) GLboolean GL_APIENTRY glIsEnabled(GLenum cap) { return funcPtr_glIsEnabled( cap); }
__declspec(dllexport) GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer) { return funcPtr_glIsFramebuffer( framebuffer); }
__declspec(dllexport) GLboolean GL_APIENTRY glIsProgram(GLuint program) { return funcPtr_glIsProgram( program); }
__declspec(dllexport) GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer) { return funcPtr_glIsRenderbuffer( renderbuffer); }
__declspec(dllexport) GLboolean GL_APIENTRY glIsShader(GLuint shader) { return funcPtr_glIsShader( shader); }
__declspec(dllexport) GLboolean GL_APIENTRY glIsTexture(GLuint texture) { return funcPtr_glIsTexture( texture); }
__declspec(dllexport) void GL_APIENTRY glLineWidth(GLfloat width) { funcPtr_glLineWidth( width); }
__declspec(dllexport) void GL_APIENTRY glLinkProgram(GLuint program) { funcPtr_glLinkProgram( program); }
__declspec(dllexport) void GL_APIENTRY glPixelStorei(GLenum pname, GLint param) { funcPtr_glPixelStorei( pname, param); }
__declspec(dllexport) void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units) { funcPtr_glPolygonOffset( factor, units); }
__declspec(dllexport) void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) { funcPtr_glReadPixels( x, y, width, height, format, type, pixels); }
__declspec(dllexport) void GL_APIENTRY glReleaseShaderCompiler(void) { funcPtr_glReleaseShaderCompiler(); }
__declspec(dllexport) void GL_APIENTRY glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { funcPtr_glRenderbufferStorage( target, internalformat, width, height); }
__declspec(dllexport) void GL_APIENTRY glSampleCoverage(GLclampf value, GLboolean invert) { funcPtr_glSampleCoverage( value, invert); }
__declspec(dllexport) void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height) { funcPtr_glScissor( x, y, width, height); }
__declspec(dllexport) void GL_APIENTRY glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length) { funcPtr_glShaderBinary( n, shaders, binaryformat, binary, length); }
__declspec(dllexport) void GL_APIENTRY glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) { funcPtr_glShaderSource( shader, count, string, length); }
__declspec(dllexport) void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask) { funcPtr_glStencilFunc( func, ref, mask); }
__declspec(dllexport) void GL_APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { funcPtr_glStencilFuncSeparate( face, func, ref, mask); }
__declspec(dllexport) void GL_APIENTRY glStencilMask(GLuint mask) { funcPtr_glStencilMask( mask); }
__declspec(dllexport) void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask) { funcPtr_glStencilMaskSeparate( face, mask); }
__declspec(dllexport) void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) { funcPtr_glStencilOp( fail, zfail, zpass); }
__declspec(dllexport) void GL_APIENTRY glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { funcPtr_glStencilOpSeparate( face, fail, zfail, zpass); }
__declspec(dllexport) void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) { funcPtr_glTexImage2D( target, level, internalformat, width, height, border, format, type, pixels); }
__declspec(dllexport) void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param) { funcPtr_glTexParameterf( target, pname, param); }
__declspec(dllexport) void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) { funcPtr_glTexParameterfv( target, pname, params); }
__declspec(dllexport) void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param) { funcPtr_glTexParameteri( target, pname, param); }
__declspec(dllexport) void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params) { funcPtr_glTexParameteriv( target, pname, params); }
__declspec(dllexport) void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { funcPtr_glTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels); }
__declspec(dllexport) void GL_APIENTRY glUniform1f(GLint location, GLfloat x) { funcPtr_glUniform1f( location, x); }
__declspec(dllexport) void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat* v) { funcPtr_glUniform1fv( location, count, v); }
__declspec(dllexport) void GL_APIENTRY glUniform1i(GLint location, GLint x) { funcPtr_glUniform1i( location, x); }
__declspec(dllexport) void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint* v) { funcPtr_glUniform1iv( location, count, v); }
__declspec(dllexport) void GL_APIENTRY glUniform2f(GLint location, GLfloat x, GLfloat y) { funcPtr_glUniform2f( location, x, y); }
__declspec(dllexport) void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat* v) { funcPtr_glUniform2fv( location, count, v); }
__declspec(dllexport) void GL_APIENTRY glUniform2i(GLint location, GLint x, GLint y) { funcPtr_glUniform2i( location, x, y); }
__declspec(dllexport) void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint* v) { funcPtr_glUniform2iv( location, count, v); }
__declspec(dllexport) void GL_APIENTRY glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) { funcPtr_glUniform3f( location, x, y, z); }
__declspec(dllexport) void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat* v) { funcPtr_glUniform3fv( location, count, v); }
__declspec(dllexport) void GL_APIENTRY glUniform3i(GLint location, GLint x, GLint y, GLint z) { funcPtr_glUniform3i( location, x, y, z); }
__declspec(dllexport) void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint* v) { funcPtr_glUniform3iv( location, count, v); }
__declspec(dllexport) void GL_APIENTRY glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { funcPtr_glUniform4f( location, x, y, z, w); }
__declspec(dllexport) void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat* v) { funcPtr_glUniform4fv( location, count, v); }
__declspec(dllexport) void GL_APIENTRY glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) { funcPtr_glUniform4i( location, x, y, z, w); }
__declspec(dllexport) void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint* v) { funcPtr_glUniform4iv( location, count, v); }
__declspec(dllexport) void GL_APIENTRY glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { funcPtr_glUniformMatrix2fv( location, count, transpose, value); }
__declspec(dllexport) void GL_APIENTRY glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { funcPtr_glUniformMatrix3fv( location, count, transpose, value); }
__declspec(dllexport) void GL_APIENTRY glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { funcPtr_glUniformMatrix4fv( location, count, transpose, value); }
__declspec(dllexport) void GL_APIENTRY glUseProgram(GLuint program) { funcPtr_glUseProgram( program); }
__declspec(dllexport) void GL_APIENTRY glValidateProgram(GLuint program) { funcPtr_glValidateProgram( program); }
__declspec(dllexport) void GL_APIENTRY glVertexAttrib1f(GLuint indx, GLfloat x) { funcPtr_glVertexAttrib1f( indx, x); }
__declspec(dllexport) void GL_APIENTRY glVertexAttrib1fv(GLuint indx, const GLfloat* values) { funcPtr_glVertexAttrib1fv( indx, values); }
__declspec(dllexport) void GL_APIENTRY glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { funcPtr_glVertexAttrib2f( indx, x, y); }
__declspec(dllexport) void GL_APIENTRY glVertexAttrib2fv(GLuint indx, const GLfloat* values) { funcPtr_glVertexAttrib2fv( indx, values); }
__declspec(dllexport) void GL_APIENTRY glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { funcPtr_glVertexAttrib3f( indx, x, y, z); }
__declspec(dllexport) void GL_APIENTRY glVertexAttrib3fv(GLuint indx, const GLfloat* values) { funcPtr_glVertexAttrib3fv( indx, values); }
__declspec(dllexport) void GL_APIENTRY glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { funcPtr_glVertexAttrib4f( indx, x, y, z, w); }
__declspec(dllexport) void GL_APIENTRY glVertexAttrib4fv(GLuint indx, const GLfloat* values) { funcPtr_glVertexAttrib4fv( indx, values); }
__declspec(dllexport) void GL_APIENTRY glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) { funcPtr_glVertexAttribPointer( indx, size, type, normalized, stride, ptr); }
__declspec(dllexport) void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height) { funcPtr_glViewport( x, y, width, height); }
//////////////////////////////////////////////////////////////////////////
const char* Decode_FUNC_NAME_NUM(const char* _name , const char* _pre , int iNum)
{
static char decFunName[512];
sprintf(decFunName , "%s%s@%d" , _pre , _name , iNum);
return decFunName;
}
const char* Decode_FUNC_NAME(const char* _name , const char* _pre)
{
static char decFunName[512];
sprintf(decFunName , "%s%s" , _pre , _name);
return decFunName;
}
void* GetGLEntry(HMODULE hDll , const char* _name)
{
void *procAddress = NULL;
const char* _newName = NULL;
procAddress = (void *)GetProcAddress(hDll, _name);
if(procAddress == NULL && funcPtr_eglGetProcAddress )
{
procAddress = (void *)eglGetProcAddress(_name);
}
if(procAddress == NULL)
{
_newName = Decode_FUNC_NAME(_name ,"_");
procAddress = (void *)GetProcAddress(hDll, _newName);
}
if(procAddress == NULL)
{
_newName = Decode_FUNC_NAME(_name ,"_imp_");
procAddress = (void *)GetProcAddress(hDll, _newName);
}
if(procAddress == NULL)
{
int i = 0;
while(procAddress == NULL && i < 1024)
{
_newName = Decode_FUNC_NAME_NUM(_name , "_" , i);
procAddress = (void *)GetProcAddress(hDll, _newName);
i++;
}
}
if(procAddress == NULL)
{
OutputDebugStringA("GL function not loaded :");
OutputDebugStringA(_name);
OutputDebugStringA("/n");
return NULL;
}
if(_newName != NULL)
{
OutputDebugStringA("GL function name mangling func=");
OutputDebugStringA(_name);
OutputDebugStringA(" in dll=");
OutputDebugStringA(_newName);
OutputDebugStringA("/n");
}
return procAddress;
}
#undef FNPTR
#define FNPTR(name) funcPtr_##name
#define IMPORT_FUNC_DLL(dll , funcName) do { /
void *procAddress = (void *)GetGLEntry(dll, (#funcName)); /
if (procAddress == NULL) nRet = 0; /
*((void **)&( FNPTR(funcName) )) = procAddress; } while (0)
__declspec(dllexport) int Init_EGL_WRAPPER(const wchar_t* eglDll , const wchar_t* glDll)
{
int nRet = 0;
HMODULE hEGLDll = NULL;
HMODULE hGLDll = NULL;
void *procAddress = NULL;
DWORD lastError = 0;
hEGLDll = LoadLibraryW(eglDll);
if(hEGLDll == NULL)
{
return 0;
}
hGLDll = LoadLibraryW(glDll);
if(hGLDll == NULL)
{
return 0;
}
IMPORT_FUNC_DLL(hEGLDll,eglGetError);
IMPORT_FUNC_DLL(hEGLDll,eglGetDisplay);
IMPORT_FUNC_DLL(hEGLDll,eglInitialize);
IMPORT_FUNC_DLL(hEGLDll,eglTerminate);
IMPORT_FUNC_DLL(hEGLDll,eglQueryString);
IMPORT_FUNC_DLL(hEGLDll,eglGetConfigs);
IMPORT_FUNC_DLL(hEGLDll,eglChooseConfig);
IMPORT_FUNC_DLL(hEGLDll,eglGetConfigAttrib);
IMPORT_FUNC_DLL(hEGLDll,eglCreateWindowSurface);
IMPORT_FUNC_DLL(hEGLDll,eglDestroySurface);
IMPORT_FUNC_DLL(hEGLDll,eglQuerySurface);
IMPORT_FUNC_DLL(hEGLDll,eglBindAPI);
IMPORT_FUNC_DLL(hEGLDll,eglQueryAPI);
IMPORT_FUNC_DLL(hEGLDll,eglWaitClient);
IMPORT_FUNC_DLL(hEGLDll,eglReleaseThread);
IMPORT_FUNC_DLL(hEGLDll,eglSurfaceAttrib);
IMPORT_FUNC_DLL(hEGLDll,eglBindTexImage);
IMPORT_FUNC_DLL(hEGLDll,eglReleaseTexImage);
IMPORT_FUNC_DLL(hEGLDll,eglSwapInterval);
IMPORT_FUNC_DLL(hEGLDll,eglCreateContext);
IMPORT_FUNC_DLL(hEGLDll,eglDestroyContext);
IMPORT_FUNC_DLL(hEGLDll,eglMakeCurrent);
IMPORT_FUNC_DLL(hEGLDll,eglGetCurrentContext);
IMPORT_FUNC_DLL(hEGLDll,eglGetCurrentSurface);
IMPORT_FUNC_DLL(hEGLDll,eglGetCurrentDisplay);
IMPORT_FUNC_DLL(hEGLDll,eglQueryContext);
IMPORT_FUNC_DLL(hEGLDll,eglWaitGL);
IMPORT_FUNC_DLL(hEGLDll,eglWaitNative);
IMPORT_FUNC_DLL(hEGLDll,eglSwapBuffers);
IMPORT_FUNC_DLL(hEGLDll,eglCopyBuffers);
IMPORT_FUNC_DLL(hEGLDll,eglGetProcAddress);
return nRet;
}
__declspec(dllexport) int Init_GLES_WRAPPER(const wchar_t* glDll )
{
int nRet = 0;
HMODULE hEGLDll = NULL;
HMODULE hGLDll = NULL;
void *procAddress = NULL;
DWORD lastError = 0;
hGLDll = LoadLibraryW(glDll);
if(hGLDll == NULL)
{
return 0;
}
//////////////////////////////////////////////////////////////////////////
IMPORT_FUNC_DLL(hGLDll,glActiveTexture);
IMPORT_FUNC_DLL(hGLDll,glAttachShader);
IMPORT_FUNC_DLL(hGLDll,glBindAttribLocation);
IMPORT_FUNC_DLL(hGLDll,glBindBuffer);
IMPORT_FUNC_DLL(hGLDll,glBindFramebuffer);
IMPORT_FUNC_DLL(hGLDll,glBindRenderbuffer);
IMPORT_FUNC_DLL(hGLDll,glBindTexture);
IMPORT_FUNC_DLL(hGLDll,glBlendColor);
IMPORT_FUNC_DLL(hGLDll,glBlendEquation);
IMPORT_FUNC_DLL(hGLDll,glBlendEquationSeparate);
IMPORT_FUNC_DLL(hGLDll,glBlendFunc);
IMPORT_FUNC_DLL(hGLDll,glBlendFuncSeparate);
IMPORT_FUNC_DLL(hGLDll,glBufferData);
IMPORT_FUNC_DLL(hGLDll,glBufferSubData);
IMPORT_FUNC_DLL(hGLDll,glCheckFramebufferStatus);
IMPORT_FUNC_DLL(hGLDll,glClear);
IMPORT_FUNC_DLL(hGLDll,glClearColor);
IMPORT_FUNC_DLL(hGLDll,glClearDepthf);
IMPORT_FUNC_DLL(hGLDll,glClearStencil);
IMPORT_FUNC_DLL(hGLDll,glColorMask);
IMPORT_FUNC_DLL(hGLDll,glCompileShader);
IMPORT_FUNC_DLL(hGLDll,glCompressedTexImage2D);
IMPORT_FUNC_DLL(hGLDll,glCompressedTexSubImage2D);
IMPORT_FUNC_DLL(hGLDll,glCopyTexImage2D);
IMPORT_FUNC_DLL(hGLDll,glCopyTexSubImage2D);
IMPORT_FUNC_DLL(hGLDll,glCreateProgram);
IMPORT_FUNC_DLL(hGLDll,glCreateShader);
IMPORT_FUNC_DLL(hGLDll,glCullFace);
IMPORT_FUNC_DLL(hGLDll,glDeleteBuffers);
IMPORT_FUNC_DLL(hGLDll,glDeleteFramebuffers);
IMPORT_FUNC_DLL(hGLDll,glDeleteTextures);
IMPORT_FUNC_DLL(hGLDll,glDeleteProgram);
IMPORT_FUNC_DLL(hGLDll,glDeleteRenderbuffers);
IMPORT_FUNC_DLL(hGLDll,glDeleteShader);
IMPORT_FUNC_DLL(hGLDll,glDetachShader);
IMPORT_FUNC_DLL(hGLDll,glDepthFunc);
IMPORT_FUNC_DLL(hGLDll,glDepthMask);
IMPORT_FUNC_DLL(hGLDll,glDepthRangef);
IMPORT_FUNC_DLL(hGLDll,glDisable);
IMPORT_FUNC_DLL(hGLDll,glDisableVertexAttribArray);
IMPORT_FUNC_DLL(hGLDll,glDrawArrays);
IMPORT_FUNC_DLL(hGLDll,glDrawElements);
IMPORT_FUNC_DLL(hGLDll,glEnable);
IMPORT_FUNC_DLL(hGLDll,glEnableVertexAttribArray);
IMPORT_FUNC_DLL(hGLDll,glFinish);
IMPORT_FUNC_DLL(hGLDll,glFlush);
IMPORT_FUNC_DLL(hGLDll,glFramebufferRenderbuffer);
IMPORT_FUNC_DLL(hGLDll,glFramebufferTexture2D);
IMPORT_FUNC_DLL(hGLDll,glFrontFace);
IMPORT_FUNC_DLL(hGLDll,glGenBuffers);
IMPORT_FUNC_DLL(hGLDll,glGenerateMipmap);
IMPORT_FUNC_DLL(hGLDll,glGenFramebuffers);
IMPORT_FUNC_DLL(hGLDll,glGenRenderbuffers);
IMPORT_FUNC_DLL(hGLDll,glGenTextures);
IMPORT_FUNC_DLL(hGLDll,glGetActiveAttrib);
IMPORT_FUNC_DLL(hGLDll,glGetActiveUniform);
IMPORT_FUNC_DLL(hGLDll,glGetAttachedShaders);
IMPORT_FUNC_DLL(hGLDll,glGetAttribLocation);
IMPORT_FUNC_DLL(hGLDll,glGetBooleanv);
IMPORT_FUNC_DLL(hGLDll,glGetBufferParameteriv);
IMPORT_FUNC_DLL(hGLDll,glGetError);
IMPORT_FUNC_DLL(hGLDll,glGetFloatv);
IMPORT_FUNC_DLL(hGLDll,glGetFramebufferAttachmentParameteriv);
IMPORT_FUNC_DLL(hGLDll,glGetIntegerv);
IMPORT_FUNC_DLL(hGLDll,glGetProgramiv);
IMPORT_FUNC_DLL(hGLDll,glGetProgramInfoLog);
IMPORT_FUNC_DLL(hGLDll,glGetRenderbufferParameteriv);
IMPORT_FUNC_DLL(hGLDll,glGetShaderiv);
IMPORT_FUNC_DLL(hGLDll,glGetShaderInfoLog);
IMPORT_FUNC_DLL(hGLDll,glGetShaderPrecisionFormat);
IMPORT_FUNC_DLL(hGLDll,glGetShaderSource);
IMPORT_FUNC_DLL(hGLDll,glGetString);
IMPORT_FUNC_DLL(hGLDll,glGetTexParameterfv);
IMPORT_FUNC_DLL(hGLDll,glGetTexParameteriv);
IMPORT_FUNC_DLL(hGLDll,glGetUniformfv);
IMPORT_FUNC_DLL(hGLDll,glGetUniformiv);
IMPORT_FUNC_DLL(hGLDll,glGetUniformLocation);
IMPORT_FUNC_DLL(hGLDll,glGetVertexAttribfv);
IMPORT_FUNC_DLL(hGLDll,glGetVertexAttribiv);
IMPORT_FUNC_DLL(hGLDll,glGetVertexAttribPointerv);
IMPORT_FUNC_DLL(hGLDll,glHint);
IMPORT_FUNC_DLL(hGLDll,glIsBuffer);
IMPORT_FUNC_DLL(hGLDll,glIsEnabled);
IMPORT_FUNC_DLL(hGLDll,glIsFramebuffer);
IMPORT_FUNC_DLL(hGLDll,glIsProgram);
IMPORT_FUNC_DLL(hGLDll,glIsRenderbuffer);
IMPORT_FUNC_DLL(hGLDll,glIsShader);
IMPORT_FUNC_DLL(hGLDll,glIsTexture);
IMPORT_FUNC_DLL(hGLDll,glLineWidth);
IMPORT_FUNC_DLL(hGLDll,glLinkProgram);
IMPORT_FUNC_DLL(hGLDll,glPixelStorei);
IMPORT_FUNC_DLL(hGLDll,glPolygonOffset);
IMPORT_FUNC_DLL(hGLDll,glReadPixels);
IMPORT_FUNC_DLL(hGLDll,glReleaseShaderCompiler);
IMPORT_FUNC_DLL(hGLDll,glRenderbufferStorage);
IMPORT_FUNC_DLL(hGLDll,glSampleCoverage);
IMPORT_FUNC_DLL(hGLDll,glScissor);
IMPORT_FUNC_DLL(hGLDll,glShaderBinary);
IMPORT_FUNC_DLL(hGLDll,glShaderSource);
IMPORT_FUNC_DLL(hGLDll,glStencilFunc);
IMPORT_FUNC_DLL(hGLDll,glStencilFuncSeparate);
IMPORT_FUNC_DLL(hGLDll,glStencilMask);
IMPORT_FUNC_DLL(hGLDll,glStencilMaskSeparate);
IMPORT_FUNC_DLL(hGLDll,glStencilOp);
IMPORT_FUNC_DLL(hGLDll,glStencilOpSeparate);
IMPORT_FUNC_DLL(hGLDll,glTexImage2D);
IMPORT_FUNC_DLL(hGLDll,glTexParameterf);
IMPORT_FUNC_DLL(hGLDll,glTexParameterfv);
IMPORT_FUNC_DLL(hGLDll,glTexParameteri);
IMPORT_FUNC_DLL(hGLDll,glTexParameteriv);
IMPORT_FUNC_DLL(hGLDll,glTexSubImage2D);
IMPORT_FUNC_DLL(hGLDll,glUniform1f);
IMPORT_FUNC_DLL(hGLDll,glUniform1fv);
IMPORT_FUNC_DLL(hGLDll,glUniform1i);
IMPORT_FUNC_DLL(hGLDll,glUniform1iv);
IMPORT_FUNC_DLL(hGLDll,glUniform2f);
IMPORT_FUNC_DLL(hGLDll,glUniform2fv);
IMPORT_FUNC_DLL(hGLDll,glUniform2i);
IMPORT_FUNC_DLL(hGLDll,glUniform2iv);
IMPORT_FUNC_DLL(hGLDll,glUniform3f);
IMPORT_FUNC_DLL(hGLDll,glUniform3fv);
IMPORT_FUNC_DLL(hGLDll,glUniform3i);
IMPORT_FUNC_DLL(hGLDll,glUniform3iv);
IMPORT_FUNC_DLL(hGLDll,glUniform4f);
IMPORT_FUNC_DLL(hGLDll,glUniform4fv);
IMPORT_FUNC_DLL(hGLDll,glUniform4i);
IMPORT_FUNC_DLL(hGLDll,glUniform4iv);
IMPORT_FUNC_DLL(hGLDll,glUniformMatrix2fv);
IMPORT_FUNC_DLL(hGLDll,glUniformMatrix3fv);
IMPORT_FUNC_DLL(hGLDll,glUniformMatrix4fv);
IMPORT_FUNC_DLL(hGLDll,glUseProgram);
IMPORT_FUNC_DLL(hGLDll,glValidateProgram);
IMPORT_FUNC_DLL(hGLDll,glVertexAttrib1f);
IMPORT_FUNC_DLL(hGLDll,glVertexAttrib1fv);
IMPORT_FUNC_DLL(hGLDll,glVertexAttrib2f);
IMPORT_FUNC_DLL(hGLDll,glVertexAttrib2fv);
IMPORT_FUNC_DLL(hGLDll,glVertexAttrib3f);
IMPORT_FUNC_DLL(hGLDll,glVertexAttrib3fv);
IMPORT_FUNC_DLL(hGLDll,glVertexAttrib4f);
IMPORT_FUNC_DLL(hGLDll,glVertexAttrib4fv);
IMPORT_FUNC_DLL(hGLDll,glVertexAttribPointer);
IMPORT_FUNC_DLL(hGLDll,glViewport);
return nRet;
}