DEADSOFTWARE

Implement some wrappers for xashxt
authormittorn <mittorn@sibmail.com>
Sun, 24 Jul 2016 10:37:11 +0000 (10:37 +0000)
committermittorn <mittorn@sibmail.com>
Sun, 24 Jul 2016 10:37:11 +0000 (10:37 +0000)
GL/gl.h
GL/gl_entries.in
GL/glesinterface.h
nanoWrap.cpp
nanogl.cpp

diff --git a/GL/gl.h b/GL/gl.h
index 5bdc4727b62b6ddfa7d85bd7f175611e310df427..48fb508121d87303a14b54b4497dfd61fc1632c7 100644 (file)
--- a/GL/gl.h
+++ b/GL/gl.h
@@ -691,6 +691,37 @@ void glTexGeni( GLenum coord, GLenum pname, GLint param );
 void glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
 void glColor4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
 
+// for XashXT
+
+void glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+
+void glTexEnvi(GLenum target, GLenum pname, GLint param);
+
+void glBindFramebuffer(GLenum target, GLuint framebuffer);
+void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
+void glGenFramebuffers (GLsizei n, GLuint *framebuffers);
+GLenum glCheckFramebufferStatus(GLenum target);
+
+//GLboolean glIsRenderbuffer (GLuint renderbuffer);
+void glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+void glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
+void glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
+
+
+void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+
+
+void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+
+void glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+
+
+void glNormalPointer(GLenum type, GLsizei stride, const void *ptr);
+
+void pglMultiTexCoord3f(GLenum, GLfloat, GLfloat, GLfloat);
+
+void pglMultiTexCoord2f(GLenum, GLfloat, GLfloat);
+
 
 #ifdef __cplusplus
 }
index 57d7a87d7932c94c42fa6af87d3ea6016b0ea216..70b1fb3a65d2ce29f13c0122209b90281ec8f46f 100644 (file)
@@ -37,7 +37,7 @@
     GL_ENTRY(void,glClearColor,float red, float green, float blue, float alpha)
     GL_ENTRY(void,glClearColorx,int red, int green, int blue, int alpha)
     GL_ENTRY(void,glClearDepthf,float depth)
-    GL_ENTRY(void,glClearDepthx,int depth)
+       GL_ENTRY(void,glClearDepthx,int depth)
     GL_ENTRY(void,glClearStencil,int s)
     GL_ENTRY(void,glClientActiveTexture,unsigned int texture)
     GL_ENTRY(void,glColor4f,float red, float green, float blue, float alpha)
     GL_ENTRY(void,glOrtho,double left, double right, double bottom, double top, double zNear, double zFar)
     GL_ENTRY(void,glDepthRange,double zNear, double zFar)
 #endif
+
+// fbo
+GL_ENTRY(void, glGenFramebuffers, GLsizei n, GLuint* framebuffers)
+GL_ENTRY(void, glGenRenderbuffers, GLsizei n, GLuint* renderbuffers)
+GL_ENTRY(void, glRenderbufferStorage, GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+GL_ENTRY(void, glBindFramebuffer, GLenum target, GLuint framebuffer)
+GL_ENTRY(void, glBindRenderbuffer, GLenum target, GLuint renderbuffer)
+GL_ENTRY(void, glFramebufferTexture2D, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+GL_ENTRY(void, glDeleteRenderbuffers, GLsizei n, const GLuint* renderbuffers)
+GL_ENTRY(void, glDeleteFramebuffers, GLsizei n, const GLuint* framebuffers)
+GL_ENTRY(void, glFramebufferRenderbuffer, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
index 47fd58480230abf8ff2d45e6f07f7f01c71badd0..0003ef690d16a56c30b0c8a0e77f3b9217a34272 100644 (file)
@@ -229,9 +229,18 @@ struct GlESInterface
 #ifdef USE_CORE_PROFILE
        void ( APIENTRY *glOrtho) (double left, double right, double bottom, double top, double zNear, double zFar) S;
        void ( APIENTRY *glDepthRange) (double zNear, double zFar) S;
-#endif 
-
-    };
+#endif
+    void ( APIENTRY *glGenFramebuffers) (unsigned int n, unsigned int* framebuffers) S;
+    void ( APIENTRY *glGenRenderbuffers) (unsigned int n, unsigned int* renderbuffers) S;
+    void ( APIENTRY *glRenderbufferStorage) (unsigned int target, unsigned int internalformat, unsigned int width, unsigned int height) S;
+    void ( APIENTRY *glBindFramebuffer) (unsigned int target, unsigned int framebuffer) S;
+    void ( APIENTRY *glBindRenderbuffer) (unsigned int target, unsigned int renderbuffer) S;
+    void ( APIENTRY *glFramebufferTexture2D) (unsigned int target, unsigned int attachment, unsigned int textarget, unsigned int texture, int level) S;
+    void ( APIENTRY *glDeleteRenderbuffers) (unsigned int n, const unsigned int* renderbuffers) S;
+    void ( APIENTRY *glDeleteFramebuffers) (unsigned int n, const unsigned int* framebuffers) S;
+    void ( APIENTRY *glFramebufferRenderbuffer) (unsigned int target, unsigned int attachment, unsigned int renderbuffertarget, unsigned int renderbuffer) S;
+
+};
 #if !defined (__WINS__)
     #if        defined(__TARGET_FPU_VFP)
         #pragma no_softfp_linkage
index c13aea311d72a7f902275de277d4f156227a7039..fa3829e35aefd1c22e42c13e43a1db9fdcbfae00 100644 (file)
@@ -146,6 +146,8 @@ struct nanotmuState
     struct ptrstate vertex_array;                                       
     struct ptrstate color_array;
     struct ptrstate texture_coord_array;
+    struct ptrstate normal_array;
+
     };
 
 static struct nanotmuState tmuState0;
@@ -159,6 +161,7 @@ static struct nanotmuState tmuInitState =
     {4,GL_FLOAT,0, NULL, GL_FALSE, GL_FALSE},
     {4,GL_FLOAT,0, NULL, GL_FALSE, GL_FALSE},
     {4,GL_FLOAT,0, NULL, GL_FALSE, GL_FALSE},
+    {0,GL_FLOAT,0, NULL, GL_FALSE, GL_FALSE},
     };   
 
 static struct nanotmuState* activetmuState = &tmuState0;
@@ -289,6 +292,15 @@ void ResetNanoState()
        {
                glEsImpl->glDisableClientState(GL_TEXTURE_COORD_ARRAY);
        }
+
+    if (tmuState0.normal_array.enabled)
+    {
+        glEsImpl->glEnableClientState(GL_NORMAL_ARRAY);
+    }
+    else
+    {
+        glEsImpl->glDisableClientState(GL_NORMAL_ARRAY);
+    }
        glEsImpl->glVertexPointer(tmuState0.vertex_array.size,
                        tmuState0.vertex_array.type,
                        tmuState0.vertex_array.stride,
@@ -304,6 +316,11 @@ void ResetNanoState()
                        tmuState0.color_array.stride,
                        tmuState0.color_array.ptr);
 
+    glEsImpl->glNormalPointer(
+            tmuState0.normal_array.type,
+            tmuState0.normal_array.stride,
+            tmuState0.normal_array.ptr);
+
        glEsImpl->glMatrixMode(nanoglState.matrixmode);
 
 
@@ -1524,7 +1541,7 @@ void glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indi
     if (arraysValid || 
         tmuState0.vertex_array.changed ||
         tmuState0.color_array.changed ||
-        tmuState0.texture_coord_array.changed)
+        tmuState0.texture_coord_array.changed || tmuState0.normal_array.changed)
         {
         glEsImpl->glClientActiveTexture(GL_TEXTURE0);
         }
@@ -1560,6 +1577,22 @@ void glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indi
                                  tmuState0.color_array.ptr);
         tmuState0.color_array.changed = GL_FALSE;
         }
+    if (arraysValid || tmuState0.normal_array.changed)
+        {
+        if (tmuState0.normal_array.enabled)
+            {
+            glEsImpl->glEnableClientState(GL_NORMAL_ARRAY);
+            }
+        else
+            {
+            glEsImpl->glDisableClientState(GL_NORMAL_ARRAY);
+            }
+        glEsImpl->glColorPointer(tmuState0.normal_array.size,
+                                 tmuState0.normal_array.type,
+                                 tmuState0.normal_array.stride,
+                                 tmuState0.normal_array.ptr);
+        tmuState0.normal_array.changed = GL_FALSE;
+        }
     if (arraysValid || tmuState0.texture_coord_array.changed)
         {
         tmuState0.texture_coord_array.changed = GL_FALSE;
@@ -1632,6 +1665,15 @@ void glEnableClientState(GLenum  array)
             clientstate->color_array.enabled = GL_TRUE;
             clientstate->color_array.changed = GL_TRUE;
 
+            break;
+        case GL_NORMAL_ARRAY:
+            if (clientstate->normal_array.enabled)
+                {
+                return;
+                }
+            clientstate->normal_array.enabled = GL_TRUE;
+            clientstate->normal_array.changed = GL_TRUE;
+
             break;
         case GL_TEXTURE_COORD_ARRAY:
             if (clientstate->texture_coord_array.enabled)
@@ -1678,6 +1720,15 @@ void glDisableClientState(GLenum  array)
             clientstate->color_array.enabled = GL_FALSE;
             clientstate->color_array.changed = GL_TRUE;
 
+            break;
+        case GL_NORMAL_ARRAY:
+            if (!clientstate->normal_array.enabled)
+                {
+                return;
+                }
+            clientstate->normal_array.enabled = GL_FALSE;
+            clientstate->normal_array.changed = GL_TRUE;
+
             break;
         case GL_TEXTURE_COORD_ARRAY:
             if (!clientstate->texture_coord_array.enabled)
@@ -1745,6 +1796,23 @@ void glColorPointer( GLint size,  GLenum type,  GLsizei stride,  const GLvoid *p
     tmuState0.color_array.ptr  = (GLvoid*)pointer;
     tmuState0.color_array.changed = GL_TRUE;
     }
+
+void glNormalPointer( GLenum type,  GLsizei stride,  const GLvoid *pointer )
+    {
+    int size = 0;
+    if (tmuState0.normal_array.size == size &&
+        tmuState0.normal_array.stride == stride &&
+        tmuState0.normal_array.type == type &&
+        tmuState0.normal_array.ptr == pointer)
+        {
+        return;
+        }
+    tmuState0.normal_array.size = size;
+    tmuState0.normal_array.stride = stride;
+    tmuState0.normal_array.type = type;
+    tmuState0.normal_array.ptr  = (GLvoid*)pointer;
+    tmuState0.normal_array.changed = GL_TRUE;
+    }
 void glPolygonOffset( GLfloat factor, GLfloat units ) 
     {
     FlushOnStateChange();
@@ -1850,10 +1918,103 @@ void glFrontFace (GLenum mode)
        FlushOnStateChange();
        glEsImpl->glFrontFace(mode);
 }
+// End Vladimir
+
+void glTexEnvi (GLenum target, GLenum pname, GLint param)
+    {
+    if (target == GL_TEXTURE_ENV)
+        {
+        if (pname == GL_TEXTURE_ENV_MODE)
+            {
+            if (param == activetmuState->texture_env_mode.value)
+                {
+                return;
+                }
+            else
+                {
+                FlushOnStateChange();
+                glEsImpl->glTexEnvi(target, pname, param);
+                activetmuState->texture_env_mode.value = param;
+                return;
+                }
+            }
+        }
+    FlushOnStateChange();
+    glEsImpl->glTexEnvi(target, pname, param);
+    }
+
+void pglMultiTexCoord3f(GLenum, GLfloat, GLfloat, GLfloat)
+{
+
+}
 
+void pglMultiTexCoord2f(GLenum, GLfloat, GLfloat)
+{
 
+}
 
-// End Vladimir
+/*void glNormalPointer(GLenum type, GLsizei stride, const void *ptr)
+{
+    glEsImpl->glNormalPointer( type, stride, ptr );
+}*/
+
+void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+    FlushOnStateChange();
+    glEsImpl->glCopyTexSubImage2D( target, level, xoffset, yoffset, x, y, width, height );
+}
+
+void glGenFramebuffers (GLsizei n, GLuint* framebuffers)
+{
+    FlushOnStateChange();
+    glEsImpl->glGenFramebuffers( n, framebuffers );
+}
 
 
+void glGenRenderbuffers( GLsizei n, GLuint* renderbuffers )
+{
+    FlushOnStateChange();
+    glEsImpl->glGenFramebuffers( n, renderbuffers );
+}
+
+void glBindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+    FlushOnStateChange();
+    glEsImpl->glBindRenderbuffer( target, renderbuffer );
+}
+
+void glBindFramebuffer(GLenum target, GLuint framebuffer)\
+{
+    FlushOnStateChange();
+    glEsImpl->glBindFramebuffer( target, framebuffer );
+}
+
+void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+{
+    FlushOnStateChange();
+    glEsImpl->glFramebufferRenderbuffer( target, attachment, renderbuffertarget, renderbuffer );
+}
+
+void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
+{
+    FlushOnStateChange();
+    glEsImpl->glDeleteFramebuffers(n, framebuffers);
+}
+
+void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
+{
+    FlushOnStateChange();
+    glEsImpl->glDeleteRenderbuffers( n, renderbuffers );
+}
+void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+{
+    FlushOnStateChange();
+    glEsImpl->glFramebufferTexture2D(target, attachment,textarget,texture,level);
+}
+
+void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+{
+    FlushOnStateChange();
+    glEsImpl->glRenderbufferStorage(target, internalformat, width, height );
+}
 
index 0f4bc6a2de12c0744ebfea90fb41a2cb3e1c1972..5f97fedb31343614e90665792f708383dcebe332 100644 (file)
@@ -143,7 +143,11 @@ static int CreateGlEsInterface( const char * name, void * lib, void * lib1, void
                                
                                if ( f == NULL ) {
                                        LOGE ( "<%s> not found in libEGL.so", *api);
-                                       f = default_func; //(void*)gl_unimplemented;
+                    if( glEsImpl->eglGetProcAddress && ( (void*)glEsImpl->eglGetProcAddress != (void*)gl_unimplemented ) )
+                        f = glEsImpl->eglGetProcAddress( *api );
+                    if(f == NULL)
+                        f = default_func; //(void*)gl_unimplemented;
+
                                }
                                else {
                                        LOGD ("<%s> @ 0x%p\n", *api, f);
@@ -152,6 +156,9 @@ static int CreateGlEsInterface( const char * name, void * lib, void * lib1, void
                        else
                        {
                                LOGE ( "libEGL.so not loaded!");
+                            if( glEsImpl->eglGetProcAddress && ( (void*)glEsImpl->eglGetProcAddress != (void*)gl_unimplemented ) )
+                                f = glEsImpl->eglGetProcAddress( *api );
+                if( !f )
                                f = default_func;
                        }
                }