From: mittorn Date: Thu, 17 Aug 2017 20:15:12 +0000 (+0000) Subject: Remove dangerous type changes, add missing functions X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=5bb54c3b963ff631c41dae7c87687f930a3b8c7d;p=nanogl.git Remove dangerous type changes, add missing functions --- diff --git a/GL/gl.h b/GL/gl.h index 833e966..e1dc878 100644 --- a/GL/gl.h +++ b/GL/gl.h @@ -18,7 +18,7 @@ typedef unsigned int GLuint; typedef float GLfloat; typedef double GLdouble; typedef float GLclampf; -typedef float GLclampd; +typedef double GLclampd; typedef void GLvoid; typedef int GLfixed; typedef int GLclampx; @@ -570,10 +570,6 @@ typedef int GLclampx; #define glVertex2i( x, y ) glVertex3f( x, y, 0.0 ) #define glTexCoord2d glTexCoord2f #define glVertex3d glVertex3f -//#define glColor4ub(x,y,z,p) glColor4f(x,y,z,p) //nicknekit: wtf??? -#define glFogi glFogf -#define glActiveTextureARB glActiveTexture -#define glClientActiveTextureARB glClientActiveTexture // void glBegin( GLenum mode ); @@ -586,7 +582,7 @@ void glTexCoord2f( GLfloat s, GLfloat t ); void glViewport( GLint x, GLint y, GLsizei width, GLsizei height ); void glLoadIdentity( void ); void glColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); -void glOrtho( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ); +void glOrtho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar ); void glMatrixMode( GLenum mode ); void glTexParameterf( GLenum target, GLenum pname, GLfloat param ); void glTexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); @@ -594,13 +590,13 @@ void glDrawBuffer( GLenum mode ); void glTranslatef( GLfloat x, GLfloat y, GLfloat z ); void glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); void glScalef( GLfloat x, GLfloat y, GLfloat z ); -void glDepthRange( GLclampf zNear, GLclampf zFar ); +void glDepthRange(GLclampd zNear, GLclampd zFar ); void glDepthFunc( GLenum func ); void glFinish( void ); void glGetFloatv( GLenum pname, GLfloat *params ); void glGetIntegerv( GLenum pname, GLint *params ); void glCullFace( GLenum mode ); -void glFrustum( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ); +void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar ); void glClear( GLbitfield mask ); void glVertex3f( GLfloat x, GLfloat y, GLfloat z ); void glColor4fv( const GLfloat *v ); @@ -624,6 +620,8 @@ void glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) GLenum glGetError( void ); void glActiveTexture( GLenum texture ); void glClientActiveTexture( GLenum texture ); +void glActiveTextureARB( GLenum texture ); +void glClientActiveTextureARB( GLenum texture ); void glColor3ubv( const GLubyte *v ); void glPolygonMode( GLenum face, GLenum mode ); @@ -657,6 +655,7 @@ void glPointSize( GLfloat size ); void glDrawArrays( GLenum mode, int first, int count ); void glMultMatrixf( const GLfloat *m ); void glPixelStorei( GLenum pname, GLint param ); +void glFogi( GLenum pname, GLint param ); void glFogf( GLenum pname, GLfloat param ); void glFogfv( GLenum pname, const GLfloat *params ); void glGetTexParameteriv( GLenum target, GLenum pname, GLint *params ); diff --git a/nanoWrap.cpp b/nanoWrap.cpp index 8749bfb..5c5eec8 100644 --- a/nanoWrap.cpp +++ b/nanoWrap.cpp @@ -67,8 +67,8 @@ struct nanoState GLboolean scissor_test; GLboolean stencil_test; GLboolean depthmask; - GLclampf depth_range_near; - GLclampf depth_range_far; + GLclampd depth_range_near; + GLclampd depth_range_far; GLenum depth_func; GLenum cullface; GLenum shademodel; @@ -1190,7 +1190,7 @@ void glColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) currentVertexAttrib.alpha = (unsigned char)ClampTo255( alpha * 255.0f ); } -void glOrtho( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) +void glOrtho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar ) { FlushOnStateChange( ); #ifdef USE_CORE_PROFILE @@ -1324,7 +1324,7 @@ void glScalef( GLfloat x, GLfloat y, GLfloat z ) glEsImpl->glScalef( x, y, z ); } -void glDepthRange( GLclampf zNear, GLclampf zFar ) +void glDepthRange( GLclampd zNear, GLclampd zFar ) { if ( ( nanoglState.depth_range_near == zNear ) && ( nanoglState.depth_range_far == zFar ) ) { @@ -1383,7 +1383,7 @@ void glCullFace( GLenum mode ) glEsImpl->glCullFace( mode ); } -void glFrustum( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) +void glFrustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar ) { FlushOnStateChange( ); glEsImpl->glFrustumf( left, right, bottom, top, zNear, zFar ); @@ -1757,6 +1757,37 @@ void glActiveTexture( GLenum texture ) activetmu = texture; } +void glActiveTextureARB( GLenum texture ) +{ + if( skipnanogl ) + { + glEsImpl->glActiveTexture( texture ); + return; + } + if ( activetmu == texture ) + { + return; + } + if ( delayedttmuchange ) + { + delayedttmuchange = GL_FALSE; + } + else + { + delayedttmuchange = GL_TRUE; + delayedtmutarget = texture; + } + if ( texture == GL_TEXTURE0 ) + { + activetmuState = &tmuState0; + } + else + { + activetmuState = &tmuState1; + } + activetmu = texture; +} + void glClientActiveTexture( GLenum texture ) { if( skipnanogl ) @@ -1766,6 +1797,16 @@ void glClientActiveTexture( GLenum texture ) } clientactivetmu = texture; } +void glClientActiveTextureARB( GLenum texture ) +{ + if( skipnanogl ) + { + glEsImpl->glClientActiveTexture( texture ); + return; + } + clientactivetmu = texture; +} + void glPolygonMode( GLenum face, GLenum mode ) { @@ -1777,7 +1818,7 @@ void glDeleteTextures( GLsizei n, const GLuint *textures ) glEsImpl->glDeleteTextures( n, textures ); } -void glClearDepth( GLclampf depth ) +void glClearDepth( GLclampd depth ) { FlushOnStateChange( ); glEsImpl->glClearDepthf( depth ); @@ -2189,6 +2230,12 @@ void glPixelStorei( GLenum pname, GLint param ) glEsImpl->glPixelStorei( pname, param ); } +void glFogi( GLenum pname, GLint param ) +{ + FlushOnStateChange( ); + glEsImpl->glFogf( pname, param ); +} + void glFogf( GLenum pname, GLfloat param ) { FlushOnStateChange( );