From: a1batross Date: Wed, 16 Nov 2016 23:10:29 +0000 (+0300) Subject: Merge glLight changes. Thanks, Rikku2000! X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=98a2f2a11ba4f626620fce19fcd7ae8a2d7e3b8a;p=nanogl.git Merge glLight changes. Thanks, Rikku2000! --- diff --git a/GL/gl.h b/GL/gl.h index edf9102..d027d13 100644 --- a/GL/gl.h +++ b/GL/gl.h @@ -665,6 +665,15 @@ void glTexParameterx( GLenum target, GLenum pname, GLfixed param ); void glGenTextures( GLsizei n, GLuint *textures ); void glFrontFace( GLenum mode ); +// Rikku2000: Light +void glLightf( GLenum light, GLenum pname, GLfloat param ); +void glLightfv( GLenum light, GLenum pname, const GLfloat *params ); +void glLightModelf( GLenum pname, GLfloat param ); +void glLightModelfv( GLenum pname, const GLfloat *params ); +void glMaterialf( GLenum face, GLenum pname, GLfloat param ); +void glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ); +void glColorMaterial( GLenum face, GLenum mode ); + //nicknekit: for xash3d void glColor3ub( GLubyte red, GLubyte green, GLubyte blue ); diff --git a/GL/gl_entries.in b/GL/gl_entries.in index 250431c..244acea 100644 --- a/GL/gl_entries.in +++ b/GL/gl_entries.in @@ -186,6 +186,9 @@ GL_ENTRY( void, glOrtho, double left, double right, double bottom, double top, d GL_ENTRY( void, glDepthRange, double zNear, double zFar ) #endif +// Rikku2000: Light +GL_ENTRY( void, glColorMaterial, GLenum face, GLenum mode ) + // fbo GL_ENTRY( void, glGenFramebuffersOES, GLsizei n, GLuint *framebuffers ) GL_ENTRY( void, glGenRenderbuffersOES, GLsizei n, GLuint *renderbuffers ) diff --git a/GL/glesinterface.h b/GL/glesinterface.h index 8231fda..710dfd3 100644 --- a/GL/glesinterface.h +++ b/GL/glesinterface.h @@ -229,6 +229,10 @@ struct GlESInterface 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 + + // Rikku2000: Light + void( APIENTRY *glColorMaterial )( unsigned int face, unsigned int mode ) S; + 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; diff --git a/eglwrap.cpp b/eglwrap.cpp index a3870b7..208698b 100644 --- a/eglwrap.cpp +++ b/eglwrap.cpp @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "egl.h" -#include "glesinterface.h" #include "gl.h" +#include "glesinterface.h" #include diff --git a/funcnames.h b/funcnames.h index 8a88e29..cf26c55 100644 --- a/funcnames.h +++ b/funcnames.h @@ -184,3 +184,6 @@ "glOrtho", "glDepthRange", #endif + +// Rikku2000: Light + "glColorMaterial", diff --git a/nanoWrap.cpp b/nanoWrap.cpp index e159046..8fc8290 100644 --- a/nanoWrap.cpp +++ b/nanoWrap.cpp @@ -44,7 +44,14 @@ struct nanoState GLboolean depth_test; GLboolean dither; GLboolean fog; - GLboolean lighti; + GLboolean light0; + GLboolean light1; + GLboolean light2; + GLboolean light3; + GLboolean light4; + GLboolean light5; + GLboolean light6; + GLboolean light7; GLboolean lighting; GLboolean line_smooth; GLboolean matrix_palette_oes; @@ -87,6 +94,13 @@ static struct nanoState nanoglInitState = GL_FALSE, GL_FALSE, GL_FALSE, + GL_FALSE, + GL_FALSE, + GL_FALSE, + GL_FALSE, + GL_FALSE, + GL_FALSE, + GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE, @@ -485,7 +499,7 @@ void glEnd( void ) *ptrIndexArray++ = indexCount++; *ptrIndexArray++ = indexCount++; *ptrIndexArray++ = indexCount++; - int vcount = ( ( vertexCount - vertexMark ) - 3 ); + int vcount = ( ( vertexCount - vertexMark ) - 3 ); for ( int count = 0; count < vcount; count++ ) { *ptrIndexArray++ = indexbase; @@ -574,15 +588,86 @@ void glEnable( GLenum cap ) break; } case GL_FOG: - //case GL_LIGHTi + { + if ( !nanoglState.fog ) { - if ( !nanoglState.fog ) - { - nanoglState.fog = GL_TRUE; - statechanged = GL_TRUE; - } - break; + nanoglState.fog = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT0: + { + if ( !nanoglState.light0 ) + { + nanoglState.light0 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT1: + { + if ( !nanoglState.light1 ) + { + nanoglState.light1 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT2: + { + if ( !nanoglState.light2 ) + { + nanoglState.light2 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT3: + { + if ( !nanoglState.light3 ) + { + nanoglState.light3 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT4: + { + if ( !nanoglState.light4 ) + { + nanoglState.light4 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT5: + { + if ( !nanoglState.light5 ) + { + nanoglState.light5 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT6: + { + if ( !nanoglState.light6 ) + { + nanoglState.light6 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT7: + { + if ( !nanoglState.light7 ) + { + nanoglState.light7 = GL_TRUE; + statechanged = GL_TRUE; } + break; + } case GL_LIGHTING: { if ( !nanoglState.lighting ) @@ -793,15 +878,86 @@ void glDisable( GLenum cap ) break; } case GL_FOG: - //case GL_LIGHTi + { + if ( nanoglState.fog ) { - if ( nanoglState.fog ) - { - nanoglState.fog = GL_FALSE; - statechanged = GL_TRUE; - } - break; + nanoglState.fog = GL_FALSE; + statechanged = GL_TRUE; } + break; + } + case GL_LIGHT0: + { + if ( !nanoglState.light0 ) + { + nanoglState.light0 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT1: + { + if ( !nanoglState.light1 ) + { + nanoglState.light1 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT2: + { + if ( !nanoglState.light2 ) + { + nanoglState.light2 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT3: + { + if ( !nanoglState.light3 ) + { + nanoglState.light3 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT4: + { + if ( !nanoglState.light4 ) + { + nanoglState.light4 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT5: + { + if ( !nanoglState.light5 ) + { + nanoglState.light5 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT6: + { + if ( !nanoglState.light6 ) + { + nanoglState.light6 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT7: + { + if ( !nanoglState.light7 ) + { + nanoglState.light7 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } case GL_LIGHTING: { if ( nanoglState.lighting ) @@ -1006,6 +1162,50 @@ void glOrtho( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat #endif } +// Rikku2000: Light +void glLightf( GLenum light, GLenum pname, GLfloat param ) +{ + FlushOnStateChange( ); + + glEsImpl->glLightf( light, pname, param ); +} +void glLightfv( GLenum light, GLenum pname, const GLfloat *params ) +{ + FlushOnStateChange( ); + + glEsImpl->glLightfv( light, pname, params ); +} +void glLightModelf( GLenum pname, GLfloat param ) +{ + FlushOnStateChange( ); + + glEsImpl->glLightModelf( pname, param ); +} +void glLightModelfv( GLenum pname, const GLfloat *params ) +{ + FlushOnStateChange( ); + + glEsImpl->glLightModelfv( pname, params ); +} +void glMaterialf( GLenum face, GLenum pname, GLfloat param ) +{ + FlushOnStateChange( ); + + glEsImpl->glMaterialf( face, pname, param ); +} +void glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ) +{ + FlushOnStateChange( ); + + glEsImpl->glMaterialfv( face, pname, params ); +} +void glColorMaterial( GLenum face, GLenum mode ) +{ + FlushOnStateChange( ); + + glEsImpl->glColorMaterial( face, mode ); +} + void glMatrixMode( GLenum mode ) { if ( nanoglState.matrixmode == mode ) @@ -1144,7 +1344,7 @@ void glVertex3f( GLfloat x, GLfloat y, GLfloat z ) GLfloat *vert = (GLfloat *)ptrVertexAttribArray++; *vert++ = x; *vert++ = y; - *vert++ = z; + *vert++ = z; #if defined( __MULTITEXTURE_SUPPORT__ ) memcpy( vert, ¤tVertexAttrib.red, 5 * sizeof( GLfloat ) ); #else