From: TimePath Date: Sun, 4 Mar 2018 03:29:56 +0000 (+1100) Subject: Inject OpenGLBinding instead of using GlobalOpenGL() everywhere X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2FTimePath%2Fdevelop;p=xonotic%2Fnetradiant.git Inject OpenGLBinding instead of using GlobalOpenGL() everywhere --- diff --git a/contrib/bobtoolz/DBobView.cpp b/contrib/bobtoolz/DBobView.cpp index 940d1918..be5612b7 100644 --- a/contrib/bobtoolz/DBobView.cpp +++ b/contrib/bobtoolz/DBobView.cpp @@ -69,7 +69,7 @@ DBobView::~DBobView() // Implementation ////////////////////////////////////////////////////////////////////// -void DBobView::render(RenderStateFlags state) const +void DBobView::render(OpenGLBinding &GL, RenderStateFlags state) const { glBegin(GL_LINE_STRIP); diff --git a/contrib/bobtoolz/DBobView.h b/contrib/bobtoolz/DBobView.h index f0f40fd6..5d21115b 100644 --- a/contrib/bobtoolz/DBobView.h +++ b/contrib/bobtoolz/DBobView.h @@ -72,7 +72,7 @@ public: void SetPath(vec3_t *pPath); - void render(RenderStateFlags state) const; + void render(OpenGLBinding &GL, RenderStateFlags state) const; void renderSolid(Renderer &renderer, const VolumeTest &volume) const; diff --git a/contrib/bobtoolz/DTrainDrawer.cpp b/contrib/bobtoolz/DTrainDrawer.cpp index 0a3307de..f02f10f8 100644 --- a/contrib/bobtoolz/DTrainDrawer.cpp +++ b/contrib/bobtoolz/DTrainDrawer.cpp @@ -104,7 +104,7 @@ void CalculateSpline_r(vec3_t *v, int count, vec3_t out, float tension) delete[] v2; } -void DTrainDrawer::render(RenderStateFlags state) const +void DTrainDrawer::render(OpenGLBinding &GL, RenderStateFlags state) const { for (std::list::const_iterator sp = m_splineList.begin(); sp != m_splineList.end(); sp++) { splinePoint_t *pSP = (*sp); diff --git a/contrib/bobtoolz/DTrainDrawer.h b/contrib/bobtoolz/DTrainDrawer.h index b8ae15c9..14a6b170 100644 --- a/contrib/bobtoolz/DTrainDrawer.h +++ b/contrib/bobtoolz/DTrainDrawer.h @@ -71,7 +71,7 @@ public: virtual ~DTrainDrawer(void); - void render(RenderStateFlags state) const; + void render(OpenGLBinding &GL, RenderStateFlags state) const; void renderSolid(Renderer &renderer, const VolumeTest &volume) const; diff --git a/contrib/bobtoolz/DVisDrawer.cpp b/contrib/bobtoolz/DVisDrawer.cpp index 3699a477..76dcada7 100644 --- a/contrib/bobtoolz/DVisDrawer.cpp +++ b/contrib/bobtoolz/DVisDrawer.cpp @@ -88,7 +88,7 @@ void DVisDrawer::destroyShaders() GlobalOpenGLStateLibrary().erase(g_state_wireframe); } -void DVisDrawer::render(RenderStateFlags state) const +void DVisDrawer::render(OpenGLBinding &GL, RenderStateFlags state) const { //bleh std::list::const_iterator l = m_list->begin(); diff --git a/contrib/bobtoolz/DVisDrawer.h b/contrib/bobtoolz/DVisDrawer.h index 11b5d215..da7bfa38 100644 --- a/contrib/bobtoolz/DVisDrawer.h +++ b/contrib/bobtoolz/DVisDrawer.h @@ -51,7 +51,7 @@ public: void SetList(std::list *pointList); - void render(RenderStateFlags state) const; + void render(OpenGLBinding &GL, RenderStateFlags state) const; void renderSolid(Renderer &renderer, const VolumeTest &volume) const; diff --git a/contrib/prtview/portals.cpp b/contrib/prtview/portals.cpp index c4d3b04d..7dbc4052 100644 --- a/contrib/prtview/portals.cpp +++ b/contrib/prtview/portals.cpp @@ -452,7 +452,7 @@ void CPortalsRender::renderWireframe(Renderer &renderer, const VolumeTest &volum renderer.addRenderable(m_drawWireframe, g_matrix4_identity); } -void CPortalsDrawWireframe::render(RenderStateFlags state) const +void CPortalsDrawWireframe::render(OpenGLBinding &GL, RenderStateFlags state) const { unsigned int n, p; @@ -510,7 +510,7 @@ void CPortalsRender::renderSolid(Renderer &renderer, const VolumeTest &volume) c } } -void CPortalsDrawSolid::render(RenderStateFlags state) const +void CPortalsDrawSolid::render(OpenGLBinding &GL, RenderStateFlags state) const { float trans = (100.0f - portals.trans_3d) / 100.0f; @@ -601,7 +601,7 @@ void CPortalsDrawSolid::render(RenderStateFlags state) const } } -void CPortalsDrawSolidOutline::render(RenderStateFlags state) const +void CPortalsDrawSolidOutline::render(OpenGLBinding &GL, RenderStateFlags state) const { for (unsigned int n = 0; n < portals.portal_count; n++) { if (portals.lines == 2 && !portals.portal[n].hint) { diff --git a/contrib/prtview/portals.h b/contrib/prtview/portals.h index b3d29052..60b78a4b 100644 --- a/contrib/prtview/portals.h +++ b/contrib/prtview/portals.h @@ -123,19 +123,19 @@ class CPortalsDrawSolid : public OpenGLRenderable { public: mutable CubicClipVolume clip; - void render(RenderStateFlags state) const; + void render(OpenGLBinding &GL, RenderStateFlags state) const; }; class CPortalsDrawSolidOutline : public OpenGLRenderable { public: mutable CubicClipVolume clip; - void render(RenderStateFlags state) const; + void render(OpenGLBinding &GL, RenderStateFlags state) const; }; class CPortalsDrawWireframe : public OpenGLRenderable { public: - void render(RenderStateFlags state) const; + void render(OpenGLBinding &GL, RenderStateFlags state) const; }; class CPortalsRender : public Renderable { diff --git a/include/igl.h b/include/igl.h index cb7b66d1..92a6aed5 100644 --- a/include/igl.h +++ b/include/igl.h @@ -579,342 +579,342 @@ typedef void GLvoid; #define GL_T2F_C4F_N3F_V3F 0x2A2C #define GL_T4F_C4F_N3F_V4F 0x2A2D -#define glAccum GlobalOpenGL().m_glAccum -#define glAlphaFunc GlobalOpenGL().m_glAlphaFunc -#define glAreTexturesResident GlobalOpenGL().m_glAreTexturesResident -#define glArrayElement GlobalOpenGL().m_glArrayElement -#define glBegin GlobalOpenGL().m_glBegin -#define glBindTexture GlobalOpenGL().m_glBindTexture -#define glBitmap GlobalOpenGL().m_glBitmap -#define glBlendFunc GlobalOpenGL().m_glBlendFunc -#define glCallList GlobalOpenGL().m_glCallList -#define glCallLists GlobalOpenGL().m_glCallLists -#define glClear GlobalOpenGL().m_glClear -#define glClearAccum GlobalOpenGL().m_glClearAccum -#define glClearColor GlobalOpenGL().m_glClearColor -#define glClearDepth GlobalOpenGL().m_glClearDepth -#define glClearIndex GlobalOpenGL().m_glClearIndex -#define glClearStencil GlobalOpenGL().m_glClearStencil -#define glClipPlane GlobalOpenGL().m_glClipPlane -#define glColor3b GlobalOpenGL().m_glColor3b -#define glColor3bv GlobalOpenGL().m_glColor3bv -#define glColor3d GlobalOpenGL().m_glColor3d -#define glColor3dv GlobalOpenGL().m_glColor3dv -#define glColor3f GlobalOpenGL().m_glColor3f -#define glColor3fv GlobalOpenGL().m_glColor3fv -#define glColor3i GlobalOpenGL().m_glColor3i -#define glColor3iv GlobalOpenGL().m_glColor3iv -#define glColor3s GlobalOpenGL().m_glColor3s -#define glColor3sv GlobalOpenGL().m_glColor3sv -#define glColor3ub GlobalOpenGL().m_glColor3ub -#define glColor3ubv GlobalOpenGL().m_glColor3ubv -#define glColor3ui GlobalOpenGL().m_glColor3ui -#define glColor3uiv GlobalOpenGL().m_glColor3uiv -#define glColor3us GlobalOpenGL().m_glColor3us -#define glColor3usv GlobalOpenGL().m_glColor3usv -#define glColor4b GlobalOpenGL().m_glColor4b -#define glColor4bv GlobalOpenGL().m_glColor4bv -#define glColor4d GlobalOpenGL().m_glColor4d -#define glColor4dv GlobalOpenGL().m_glColor4dv -#define glColor4f GlobalOpenGL().m_glColor4f -#define glColor4fv GlobalOpenGL().m_glColor4fv -#define glColor4i GlobalOpenGL().m_glColor4i -#define glColor4iv GlobalOpenGL().m_glColor4iv -#define glColor4s GlobalOpenGL().m_glColor4s -#define glColor4sv GlobalOpenGL().m_glColor4sv -#define glColor4ub GlobalOpenGL().m_glColor4ub -#define glColor4ubv GlobalOpenGL().m_glColor4ubv -#define glColor4ui GlobalOpenGL().m_glColor4ui -#define glColor4uiv GlobalOpenGL().m_glColor4uiv -#define glColor4us GlobalOpenGL().m_glColor4us -#define glColor4usv GlobalOpenGL().m_glColor4usv -#define glColorMask GlobalOpenGL().m_glColorMask -#define glColorMaterial GlobalOpenGL().m_glColorMaterial -#define glColorPointer GlobalOpenGL().m_glColorPointer -#define glCopyPixels GlobalOpenGL().m_glCopyPixels -#define glCopyTexImage1D GlobalOpenGL().m_glCopyTexImage1D -#define glCopyTexImage2D GlobalOpenGL().m_glCopyTexImage2D -#define glCopyTexSubImage1D GlobalOpenGL().m_glCopyTexSubImage1D -#define glCopyTexSubImage2D GlobalOpenGL().m_glCopyTexSubImage2D -#define glCullFace GlobalOpenGL().m_glCullFace -#define glDeleteLists GlobalOpenGL().m_glDeleteLists -#define glDeleteTextures GlobalOpenGL().m_glDeleteTextures -#define glDepthFunc GlobalOpenGL().m_glDepthFunc -#define glDepthMask GlobalOpenGL().m_glDepthMask -#define glDepthRange GlobalOpenGL().m_glDepthRange -#define glDisable GlobalOpenGL().m_glDisable -#define glDisableClientState GlobalOpenGL().m_glDisableClientState -#define glDrawArrays GlobalOpenGL().m_glDrawArrays -#define glDrawBuffer GlobalOpenGL().m_glDrawBuffer -#define glDrawElements GlobalOpenGL().m_glDrawElements -#define glDrawPixels GlobalOpenGL().m_glDrawPixels -#define glEdgeFlag GlobalOpenGL().m_glEdgeFlag -#define glEdgeFlagPointer GlobalOpenGL().m_glEdgeFlagPointer -#define glEdgeFlagv GlobalOpenGL().m_glEdgeFlagv -#define glEnable GlobalOpenGL().m_glEnable -#define glEnableClientState GlobalOpenGL().m_glEnableClientState -#define glEnd GlobalOpenGL().m_glEnd -#define glEndList GlobalOpenGL().m_glEndList -#define glEvalCoord1d GlobalOpenGL().m_glEvalCoord1d -#define glEvalCoord1dv GlobalOpenGL().m_glEvalCoord1dv -#define glEvalCoord1f GlobalOpenGL().m_glEvalCoord1f -#define glEvalCoord1fv GlobalOpenGL().m_glEvalCoord1fv -#define glEvalCoord2d GlobalOpenGL().m_glEvalCoord2d -#define glEvalCoord2dv GlobalOpenGL().m_glEvalCoord2dv -#define glEvalCoord2f GlobalOpenGL().m_glEvalCoord2f -#define glEvalCoord2fv GlobalOpenGL().m_glEvalCoord2fv -#define glEvalMesh1 GlobalOpenGL().m_glEvalMesh1 -#define glEvalMesh2 GlobalOpenGL().m_glEvalMesh2 -#define glEvalPoint1 GlobalOpenGL().m_glEvalPoint1 -#define glEvalPoint2 GlobalOpenGL().m_glEvalPoint2 -#define glFeedbackBuffer GlobalOpenGL().m_glFeedbackBuffer -#define glFinish GlobalOpenGL().m_glFinish -#define glFlush GlobalOpenGL().m_glFlush -#define glFogf GlobalOpenGL().m_glFogf -#define glFogfv GlobalOpenGL().m_glFogfv -#define glFogi GlobalOpenGL().m_glFogi -#define glFogiv GlobalOpenGL().m_glFogiv -#define glFrontFace GlobalOpenGL().m_glFrontFace -#define glFrustum GlobalOpenGL().m_glFrustum -#define glGenLists GlobalOpenGL().m_glGenLists -#define glGenTextures GlobalOpenGL().m_glGenTextures -#define glGetBooleanv GlobalOpenGL().m_glGetBooleanv -#define glGetClipPlane GlobalOpenGL().m_glGetClipPlane -#define glGetDoublev GlobalOpenGL().m_glGetDoublev -#define glGetError GlobalOpenGL().m_glGetError -#define glGetFloatv GlobalOpenGL().m_glGetFloatv -#define glGetIntegerv GlobalOpenGL().m_glGetIntegerv -#define glGetLightfv GlobalOpenGL().m_glGetLightfv -#define glGetLightiv GlobalOpenGL().m_glGetLightiv -#define glGetMapdv GlobalOpenGL().m_glGetMapdv -#define glGetMapfv GlobalOpenGL().m_glGetMapfv -#define glGetMapiv GlobalOpenGL().m_glGetMapiv -#define glGetMaterialfv GlobalOpenGL().m_glGetMaterialfv -#define glGetMaterialiv GlobalOpenGL().m_glGetMaterialiv -#define glGetPixelMapfv GlobalOpenGL().m_glGetPixelMapfv -#define glGetPixelMapuiv GlobalOpenGL().m_glGetPixelMapuiv -#define glGetPixelMapusv GlobalOpenGL().m_glGetPixelMapusv -#define glGetPointerv GlobalOpenGL().m_glGetPointerv -#define glGetPolygonStipple GlobalOpenGL().m_glGetPolygonStipple -#define glGetString GlobalOpenGL().m_glGetString -#define glGetTexEnvfv GlobalOpenGL().m_glGetTexEnvfv -#define glGetTexEnviv GlobalOpenGL().m_glGetTexEnviv -#define glGetTexGendv GlobalOpenGL().m_glGetTexGendv -#define glGetTexGenfv GlobalOpenGL().m_glGetTexGenfv -#define glGetTexGeniv GlobalOpenGL().m_glGetTexGeniv -#define glGetTexImage GlobalOpenGL().m_glGetTexImage -#define glGetTexLevelParameterfv GlobalOpenGL().m_glGetTexLevelParameter -#define glGetTexLevelParameteriv GlobalOpenGL().m_glGetTexLevelParameteriv -#define glGetTexParameterfv GlobalOpenGL().m_glGetTexParameterfv -#define glGetTexParameteriv GlobalOpenGL().m_glGetTexParameteriv -#define glHint GlobalOpenGL().m_glHint -#define glIndexMask GlobalOpenGL().m_glIndexMask -#define glIndexPointer GlobalOpenGL().m_glIndexPointer -#define glIndexd GlobalOpenGL().m_glIndexd -#define glIndexdv GlobalOpenGL().m_glIndexdv -#define glIndexf GlobalOpenGL().m_glIndexf -#define glIndexfv GlobalOpenGL().m_glIndexfv -#define glIndexi GlobalOpenGL().m_glIndexi -#define glIndexiv GlobalOpenGL().m_glIndexiv -#define glIndexs GlobalOpenGL().m_glIndexs -#define glIndexsv GlobalOpenGL().m_glIndexsv -#define glIndexub GlobalOpenGL().m_glIndexub -#define glIndexubv GlobalOpenGL().m_glIndexubv -#define glInitNames GlobalOpenGL().m_glInitNames -#define glInterleavedArrays GlobalOpenGL().m_glInterleavedArrays -#define glIsEnabled GlobalOpenGL().m_glIsEnabled -#define glIsList GlobalOpenGL().m_glIsList -#define glIsTexture GlobalOpenGL().m_glIsTexture -#define glLightModelf GlobalOpenGL().m_glLightModelf -#define glLightModelfv GlobalOpenGL().m_glLightModelfv -#define glLightModeli GlobalOpenGL().m_glLightModeli -#define glLightModeliv GlobalOpenGL().m_glLightModeliv -#define glLightf GlobalOpenGL().m_glLightf -#define glLightfv GlobalOpenGL().m_glLightfv -#define glLighti GlobalOpenGL().m_glLighti -#define glLightiv GlobalOpenGL().m_glLightiv -#define glLineStipple GlobalOpenGL().m_glLineStipple -#define glLineWidth GlobalOpenGL().m_glLineWidth -#define glListBase GlobalOpenGL().m_glListBase -#define glLoadIdentity GlobalOpenGL().m_glLoadIdentity -#define glLoadMatrixd GlobalOpenGL().m_glLoadMatrixd -#define glLoadMatrixf GlobalOpenGL().m_glLoadMatrixf -#define glLoadName GlobalOpenGL().m_glLoadName -#define glLogicOp GlobalOpenGL().m_glLogicOp -#define glMap1d GlobalOpenGL().m_glMap1d -#define glMap1f GlobalOpenGL().m_glMap1f -#define glMap2d GlobalOpenGL().m_glMap2d -#define glMap2f GlobalOpenGL().m_glMap2f -#define glMapGrid1d GlobalOpenGL().m_glMapGrid1d -#define glMapGrid1f GlobalOpenGL().m_glMapGrid1f -#define glMapGrid2d GlobalOpenGL().m_glMapGrid2d -#define glMapGrid2f GlobalOpenGL().m_glMapGrid2f -#define glMaterialf GlobalOpenGL().m_glMaterialf -#define glMaterialfv GlobalOpenGL().m_glMaterialfv -#define glMateriali GlobalOpenGL().m_glMateriali -#define glMaterialiv GlobalOpenGL().m_glMaterialiv -#define glMatrixMode GlobalOpenGL().m_glMatrixMode -#define glMultMatrixd GlobalOpenGL().m_glMultMatrixd -#define glMultMatrixf GlobalOpenGL().m_glMultMatrixf -#define glNewList GlobalOpenGL().m_glNewList -#define glNormal3b GlobalOpenGL().m_glNormal3b -#define glNormal3bv GlobalOpenGL().m_glNormal3bv -#define glNormal3d GlobalOpenGL().m_glNormal3d -#define glNormal3dv GlobalOpenGL().m_glNormal3dv -#define glNormal3f GlobalOpenGL().m_glNormal3f -#define glNormal3fv GlobalOpenGL().m_glNormal3fv -#define glNormal3i GlobalOpenGL().m_glNormal3i -#define glNormal3iv GlobalOpenGL().m_glNormal3iv -#define glNormal3s GlobalOpenGL().m_glNormal3s -#define glNormal3sv GlobalOpenGL().m_glNormal3sv -#define glNormalPointer GlobalOpenGL().m_glNormalPointer -#define glOrtho GlobalOpenGL().m_glOrtho -#define glPassThrough GlobalOpenGL().m_glPassThrough -#define glPixelMapfv GlobalOpenGL().m_glPixelMapfv -#define glPixelMapuiv GlobalOpenGL().m_glPixelMapuiv -#define glPixelMapusv GlobalOpenGL().m_glPixelMapusv -#define glPixelStoref GlobalOpenGL().m_glPixelStoref -#define glPixelStorei GlobalOpenGL().m_glPixelStorei -#define glPixelTransferf GlobalOpenGL().m_glPixelTransferf -#define glPixelTransferi GlobalOpenGL().m_glPixelTransferi -#define glPixelZoom GlobalOpenGL().m_glPixelZoom -#define glPointSize GlobalOpenGL().m_glPointSize -#define glPolygonMode GlobalOpenGL().m_glPolygonMode -#define glPolygonOffset GlobalOpenGL().m_glPolygonOffset -#define glPolygonStipple GlobalOpenGL().m_glPolygonStipple -#define glPopAttrib GlobalOpenGL().m_glPopAttrib -#define glPopClientAttrib GlobalOpenGL().m_glPopClientAttrib -#define glPopMatrix GlobalOpenGL().m_glPopMatrix -#define glPopName GlobalOpenGL().m_glPopName -#define glPrioritizeTextures GlobalOpenGL().m_glPrioritizeTextures -#define glPushAttrib GlobalOpenGL().m_glPushAttrib -#define glPushClientAttrib GlobalOpenGL().m_glPushClientAttrib -#define glPushMatrix GlobalOpenGL().m_glPushMatrix -#define glPushName GlobalOpenGL().m_glPushName -#define glRasterPos2d GlobalOpenGL().m_glRasterPos2d -#define glRasterPos2dv GlobalOpenGL().m_glRasterPos2dv -#define glRasterPos2f GlobalOpenGL().m_glRasterPos2f -#define glRasterPos2fv GlobalOpenGL().m_glRasterPos2fv -#define glRasterPos2i GlobalOpenGL().m_glRasterPos2i -#define glRasterPos2iv GlobalOpenGL().m_glRasterPos2iv -#define glRasterPos2s GlobalOpenGL().m_glRasterPos2s -#define glRasterPos2sv GlobalOpenGL().m_glRasterPos2sv -#define glRasterPos3d GlobalOpenGL().m_glRasterPos3d -#define glRasterPos3dv GlobalOpenGL().m_glRasterPos3dv -#define glRasterPos3f GlobalOpenGL().m_glRasterPos3f -#define glRasterPos3fv GlobalOpenGL().m_glRasterPos3fv -#define glRasterPos3i GlobalOpenGL().m_glRasterPos3i -#define glRasterPos3iv GlobalOpenGL().m_glRasterPos3iv -#define glRasterPos3s GlobalOpenGL().m_glRasterPos3s -#define glRasterPos3sv GlobalOpenGL().m_glRasterPos3sv -#define glRasterPos4d GlobalOpenGL().m_glRasterPos4d -#define glRasterPos4dv GlobalOpenGL().m_glRasterPos4dv -#define glRasterPos4f GlobalOpenGL().m_glRasterPos4f -#define glRasterPos4fv GlobalOpenGL().m_glRasterPos4fv -#define glRasterPos4i GlobalOpenGL().m_glRasterPos4i -#define glRasterPos4iv GlobalOpenGL().m_glRasterPos4iv -#define glRasterPos4s GlobalOpenGL().m_glRasterPos4s -#define glRasterPos4sv GlobalOpenGL().m_glRasterPos4sv -#define glReadBuffer GlobalOpenGL().m_glReadBuffer -#define glReadPixels GlobalOpenGL().m_glReadPixels -#define glRectd GlobalOpenGL().m_glRectd -#define glRectdv GlobalOpenGL().m_glRectdv -#define glRectf GlobalOpenGL().m_glRectf -#define glRectfv GlobalOpenGL().m_glRectfv -#define glRecti GlobalOpenGL().m_glRecti -#define glRectiv GlobalOpenGL().m_glRectiv -#define glRects GlobalOpenGL().m_glRects -#define glRectsv GlobalOpenGL().m_glRectsv -#define glRenderMode GlobalOpenGL().m_glRenderMode -#define glRotated GlobalOpenGL().m_glRotated -#define glRotatef GlobalOpenGL().m_glRotatef -#define glScaled GlobalOpenGL().m_glScaled -#define glScalef GlobalOpenGL().m_glScalef -#define glScissor GlobalOpenGL().m_glScissor -#define glSelectBuffer GlobalOpenGL().m_glSelectBuffer -#define glShadeModel GlobalOpenGL().m_glShadeModel -#define glStencilFunc GlobalOpenGL().m_glStencilFunc -#define glStencilMask GlobalOpenGL().m_glStencilMask -#define glStencilOp GlobalOpenGL().m_glStencilOp -#define glTexCoord1d GlobalOpenGL().m_glTexCoord1d -#define glTexCoord1dv GlobalOpenGL().m_glTexCoord1dv -#define glTexCoord1f GlobalOpenGL().m_glTexCoord1f -#define glTexCoord1fv GlobalOpenGL().m_glTexCoord1fv -#define glTexCoord1i GlobalOpenGL().m_glTexCoord1i -#define glTexCoord1iv GlobalOpenGL().m_glTexCoord1iv -#define glTexCoord1s GlobalOpenGL().m_glTexCoord1s -#define glTexCoord1sv GlobalOpenGL().m_glTexCoord1sv -#define glTexCoord2d GlobalOpenGL().m_glTexCoord2d -#define glTexCoord2dv GlobalOpenGL().m_glTexCoord2dv -#define glTexCoord2f GlobalOpenGL().m_glTexCoord2f -#define glTexCoord2fv GlobalOpenGL().m_glTexCoord2fv -#define glTexCoord2i GlobalOpenGL().m_glTexCoord2i -#define glTexCoord2iv GlobalOpenGL().m_glTexCoord2iv -#define glTexCoord2s GlobalOpenGL().m_glTexCoord2s -#define glTexCoord2sv GlobalOpenGL().m_glTexCoord2sv -#define glTexCoord3d GlobalOpenGL().m_glTexCoord3d -#define glTexCoord3dv GlobalOpenGL().m_glTexCoord3dv -#define glTexCoord3f GlobalOpenGL().m_glTexCoord3f -#define glTexCoord3fv GlobalOpenGL().m_glTexCoord3fv -#define glTexCoord3i GlobalOpenGL().m_glTexCoord3i -#define glTexCoord3iv GlobalOpenGL().m_glTexCoord3iv -#define glTexCoord3s GlobalOpenGL().m_glTexCoord3s -#define glTexCoord3sv GlobalOpenGL().m_glTexCoord3sv -#define glTexCoord4d GlobalOpenGL().m_glTexCoord4d -#define glTexCoord4dv GlobalOpenGL().m_glTexCoord4dv -#define glTexCoord4f GlobalOpenGL().m_glTexCoord4f -#define glTexCoord4fv GlobalOpenGL().m_glTexCoord4fv -#define glTexCoord4i GlobalOpenGL().m_glTexCoord4i -#define glTexCoord4iv GlobalOpenGL().m_glTexCoord4iv -#define glTexCoord4s GlobalOpenGL().m_glTexCoord4s -#define glTexCoord4sv GlobalOpenGL().m_glTexCoord4sv -#define glTexCoordPointer GlobalOpenGL().m_glTexCoordPointer -#define glTexEnvf GlobalOpenGL().m_glTexEnvf -#define glTexEnvfv GlobalOpenGL().m_glTexEnvfv -#define glTexEnvi GlobalOpenGL().m_glTexEnvi -#define glTexEnviv GlobalOpenGL().m_glTexEnviv -#define glTexGend GlobalOpenGL().m_glTexGend -#define glTexGendv GlobalOpenGL().m_glTexGendv -#define glTexGenf GlobalOpenGL().m_glTexGenf -#define glTexGenfv GlobalOpenGL().m_glTexGenfv -#define glTexGeni GlobalOpenGL().m_glTexGeni -#define glTexGeniv GlobalOpenGL().m_glTexGeniv -#define glTexImage1D GlobalOpenGL().m_glTexImage1D -#define glTexImage2D GlobalOpenGL().m_glTexImage2D -#define glTexParameterf GlobalOpenGL().m_glTexParameterf -#define glTexParameterfv GlobalOpenGL().m_glTexParameterfv -#define glTexParameteri GlobalOpenGL().m_glTexParameteri -#define glTexParameteriv GlobalOpenGL().m_glTexParameteriv -#define glTexSubImage1D GlobalOpenGL().m_glTexSubImage1D -#define glTexSubImage2D GlobalOpenGL().m_glTexSubImage2D -#define glTranslated GlobalOpenGL().m_glTranslated -#define glTranslatef GlobalOpenGL().m_glTranslatef -#define glVertex2d GlobalOpenGL().m_glVertex2d -#define glVertex2dv GlobalOpenGL().m_glVertex2dv -#define glVertex2f GlobalOpenGL().m_glVertex2f -#define glVertex2fv GlobalOpenGL().m_glVertex2fv -#define glVertex2i GlobalOpenGL().m_glVertex2i -#define glVertex2iv GlobalOpenGL().m_glVertex2iv -#define glVertex2s GlobalOpenGL().m_glVertex2s -#define glVertex2sv GlobalOpenGL().m_glVertex2sv -#define glVertex3d GlobalOpenGL().m_glVertex3d -#define glVertex3dv GlobalOpenGL().m_glVertex3dv -#define glVertex3f GlobalOpenGL().m_glVertex3f -#define glVertex3fv GlobalOpenGL().m_glVertex3fv -#define glVertex3i GlobalOpenGL().m_glVertex3i -#define glVertex3iv GlobalOpenGL().m_glVertex3iv -#define glVertex3s GlobalOpenGL().m_glVertex3s -#define glVertex3sv GlobalOpenGL().m_glVertex3sv -#define glVertex4d GlobalOpenGL().m_glVertex4d -#define glVertex4dv GlobalOpenGL().m_glVertex4dv -#define glVertex4f GlobalOpenGL().m_glVertex4f -#define glVertex4fv GlobalOpenGL().m_glVertex4fv -#define glVertex4i GlobalOpenGL().m_glVertex4i -#define glVertex4iv GlobalOpenGL().m_glVertex4iv -#define glVertex4s GlobalOpenGL().m_glVertex4s -#define glVertex4sv GlobalOpenGL().m_glVertex4sv -#define glVertexPointer GlobalOpenGL().m_glVertexPointer -#define glViewport GlobalOpenGL().m_glViewport +#define glAccum GL.m_glAccum +#define glAlphaFunc GL.m_glAlphaFunc +#define glAreTexturesResident GL.m_glAreTexturesResident +#define glArrayElement GL.m_glArrayElement +#define glBegin GL.m_glBegin +#define glBindTexture GL.m_glBindTexture +#define glBitmap GL.m_glBitmap +#define glBlendFunc GL.m_glBlendFunc +#define glCallList GL.m_glCallList +#define glCallLists GL.m_glCallLists +#define glClear GL.m_glClear +#define glClearAccum GL.m_glClearAccum +#define glClearColor GL.m_glClearColor +#define glClearDepth GL.m_glClearDepth +#define glClearIndex GL.m_glClearIndex +#define glClearStencil GL.m_glClearStencil +#define glClipPlane GL.m_glClipPlane +#define glColor3b GL.m_glColor3b +#define glColor3bv GL.m_glColor3bv +#define glColor3d GL.m_glColor3d +#define glColor3dv GL.m_glColor3dv +#define glColor3f GL.m_glColor3f +#define glColor3fv GL.m_glColor3fv +#define glColor3i GL.m_glColor3i +#define glColor3iv GL.m_glColor3iv +#define glColor3s GL.m_glColor3s +#define glColor3sv GL.m_glColor3sv +#define glColor3ub GL.m_glColor3ub +#define glColor3ubv GL.m_glColor3ubv +#define glColor3ui GL.m_glColor3ui +#define glColor3uiv GL.m_glColor3uiv +#define glColor3us GL.m_glColor3us +#define glColor3usv GL.m_glColor3usv +#define glColor4b GL.m_glColor4b +#define glColor4bv GL.m_glColor4bv +#define glColor4d GL.m_glColor4d +#define glColor4dv GL.m_glColor4dv +#define glColor4f GL.m_glColor4f +#define glColor4fv GL.m_glColor4fv +#define glColor4i GL.m_glColor4i +#define glColor4iv GL.m_glColor4iv +#define glColor4s GL.m_glColor4s +#define glColor4sv GL.m_glColor4sv +#define glColor4ub GL.m_glColor4ub +#define glColor4ubv GL.m_glColor4ubv +#define glColor4ui GL.m_glColor4ui +#define glColor4uiv GL.m_glColor4uiv +#define glColor4us GL.m_glColor4us +#define glColor4usv GL.m_glColor4usv +#define glColorMask GL.m_glColorMask +#define glColorMaterial GL.m_glColorMaterial +#define glColorPointer GL.m_glColorPointer +#define glCopyPixels GL.m_glCopyPixels +#define glCopyTexImage1D GL.m_glCopyTexImage1D +#define glCopyTexImage2D GL.m_glCopyTexImage2D +#define glCopyTexSubImage1D GL.m_glCopyTexSubImage1D +#define glCopyTexSubImage2D GL.m_glCopyTexSubImage2D +#define glCullFace GL.m_glCullFace +#define glDeleteLists GL.m_glDeleteLists +#define glDeleteTextures GL.m_glDeleteTextures +#define glDepthFunc GL.m_glDepthFunc +#define glDepthMask GL.m_glDepthMask +#define glDepthRange GL.m_glDepthRange +#define glDisable GL.m_glDisable +#define glDisableClientState GL.m_glDisableClientState +#define glDrawArrays GL.m_glDrawArrays +#define glDrawBuffer GL.m_glDrawBuffer +#define glDrawElements GL.m_glDrawElements +#define glDrawPixels GL.m_glDrawPixels +#define glEdgeFlag GL.m_glEdgeFlag +#define glEdgeFlagPointer GL.m_glEdgeFlagPointer +#define glEdgeFlagv GL.m_glEdgeFlagv +#define glEnable GL.m_glEnable +#define glEnableClientState GL.m_glEnableClientState +#define glEnd GL.m_glEnd +#define glEndList GL.m_glEndList +#define glEvalCoord1d GL.m_glEvalCoord1d +#define glEvalCoord1dv GL.m_glEvalCoord1dv +#define glEvalCoord1f GL.m_glEvalCoord1f +#define glEvalCoord1fv GL.m_glEvalCoord1fv +#define glEvalCoord2d GL.m_glEvalCoord2d +#define glEvalCoord2dv GL.m_glEvalCoord2dv +#define glEvalCoord2f GL.m_glEvalCoord2f +#define glEvalCoord2fv GL.m_glEvalCoord2fv +#define glEvalMesh1 GL.m_glEvalMesh1 +#define glEvalMesh2 GL.m_glEvalMesh2 +#define glEvalPoint1 GL.m_glEvalPoint1 +#define glEvalPoint2 GL.m_glEvalPoint2 +#define glFeedbackBuffer GL.m_glFeedbackBuffer +#define glFinish GL.m_glFinish +#define glFlush GL.m_glFlush +#define glFogf GL.m_glFogf +#define glFogfv GL.m_glFogfv +#define glFogi GL.m_glFogi +#define glFogiv GL.m_glFogiv +#define glFrontFace GL.m_glFrontFace +#define glFrustum GL.m_glFrustum +#define glGenLists GL.m_glGenLists +#define glGenTextures GL.m_glGenTextures +#define glGetBooleanv GL.m_glGetBooleanv +#define glGetClipPlane GL.m_glGetClipPlane +#define glGetDoublev GL.m_glGetDoublev +#define glGetError GL.m_glGetError +#define glGetFloatv GL.m_glGetFloatv +#define glGetIntegerv GL.m_glGetIntegerv +#define glGetLightfv GL.m_glGetLightfv +#define glGetLightiv GL.m_glGetLightiv +#define glGetMapdv GL.m_glGetMapdv +#define glGetMapfv GL.m_glGetMapfv +#define glGetMapiv GL.m_glGetMapiv +#define glGetMaterialfv GL.m_glGetMaterialfv +#define glGetMaterialiv GL.m_glGetMaterialiv +#define glGetPixelMapfv GL.m_glGetPixelMapfv +#define glGetPixelMapuiv GL.m_glGetPixelMapuiv +#define glGetPixelMapusv GL.m_glGetPixelMapusv +#define glGetPointerv GL.m_glGetPointerv +#define glGetPolygonStipple GL.m_glGetPolygonStipple +#define glGetString GL.m_glGetString +#define glGetTexEnvfv GL.m_glGetTexEnvfv +#define glGetTexEnviv GL.m_glGetTexEnviv +#define glGetTexGendv GL.m_glGetTexGendv +#define glGetTexGenfv GL.m_glGetTexGenfv +#define glGetTexGeniv GL.m_glGetTexGeniv +#define glGetTexImage GL.m_glGetTexImage +#define glGetTexLevelParameterfv GL.m_glGetTexLevelParameter +#define glGetTexLevelParameteriv GL.m_glGetTexLevelParameteriv +#define glGetTexParameterfv GL.m_glGetTexParameterfv +#define glGetTexParameteriv GL.m_glGetTexParameteriv +#define glHint GL.m_glHint +#define glIndexMask GL.m_glIndexMask +#define glIndexPointer GL.m_glIndexPointer +#define glIndexd GL.m_glIndexd +#define glIndexdv GL.m_glIndexdv +#define glIndexf GL.m_glIndexf +#define glIndexfv GL.m_glIndexfv +#define glIndexi GL.m_glIndexi +#define glIndexiv GL.m_glIndexiv +#define glIndexs GL.m_glIndexs +#define glIndexsv GL.m_glIndexsv +#define glIndexub GL.m_glIndexub +#define glIndexubv GL.m_glIndexubv +#define glInitNames GL.m_glInitNames +#define glInterleavedArrays GL.m_glInterleavedArrays +#define glIsEnabled GL.m_glIsEnabled +#define glIsList GL.m_glIsList +#define glIsTexture GL.m_glIsTexture +#define glLightModelf GL.m_glLightModelf +#define glLightModelfv GL.m_glLightModelfv +#define glLightModeli GL.m_glLightModeli +#define glLightModeliv GL.m_glLightModeliv +#define glLightf GL.m_glLightf +#define glLightfv GL.m_glLightfv +#define glLighti GL.m_glLighti +#define glLightiv GL.m_glLightiv +#define glLineStipple GL.m_glLineStipple +#define glLineWidth GL.m_glLineWidth +#define glListBase GL.m_glListBase +#define glLoadIdentity GL.m_glLoadIdentity +#define glLoadMatrixd GL.m_glLoadMatrixd +#define glLoadMatrixf GL.m_glLoadMatrixf +#define glLoadName GL.m_glLoadName +#define glLogicOp GL.m_glLogicOp +#define glMap1d GL.m_glMap1d +#define glMap1f GL.m_glMap1f +#define glMap2d GL.m_glMap2d +#define glMap2f GL.m_glMap2f +#define glMapGrid1d GL.m_glMapGrid1d +#define glMapGrid1f GL.m_glMapGrid1f +#define glMapGrid2d GL.m_glMapGrid2d +#define glMapGrid2f GL.m_glMapGrid2f +#define glMaterialf GL.m_glMaterialf +#define glMaterialfv GL.m_glMaterialfv +#define glMateriali GL.m_glMateriali +#define glMaterialiv GL.m_glMaterialiv +#define glMatrixMode GL.m_glMatrixMode +#define glMultMatrixd GL.m_glMultMatrixd +#define glMultMatrixf GL.m_glMultMatrixf +#define glNewList GL.m_glNewList +#define glNormal3b GL.m_glNormal3b +#define glNormal3bv GL.m_glNormal3bv +#define glNormal3d GL.m_glNormal3d +#define glNormal3dv GL.m_glNormal3dv +#define glNormal3f GL.m_glNormal3f +#define glNormal3fv GL.m_glNormal3fv +#define glNormal3i GL.m_glNormal3i +#define glNormal3iv GL.m_glNormal3iv +#define glNormal3s GL.m_glNormal3s +#define glNormal3sv GL.m_glNormal3sv +#define glNormalPointer GL.m_glNormalPointer +#define glOrtho GL.m_glOrtho +#define glPassThrough GL.m_glPassThrough +#define glPixelMapfv GL.m_glPixelMapfv +#define glPixelMapuiv GL.m_glPixelMapuiv +#define glPixelMapusv GL.m_glPixelMapusv +#define glPixelStoref GL.m_glPixelStoref +#define glPixelStorei GL.m_glPixelStorei +#define glPixelTransferf GL.m_glPixelTransferf +#define glPixelTransferi GL.m_glPixelTransferi +#define glPixelZoom GL.m_glPixelZoom +#define glPointSize GL.m_glPointSize +#define glPolygonMode GL.m_glPolygonMode +#define glPolygonOffset GL.m_glPolygonOffset +#define glPolygonStipple GL.m_glPolygonStipple +#define glPopAttrib GL.m_glPopAttrib +#define glPopClientAttrib GL.m_glPopClientAttrib +#define glPopMatrix GL.m_glPopMatrix +#define glPopName GL.m_glPopName +#define glPrioritizeTextures GL.m_glPrioritizeTextures +#define glPushAttrib GL.m_glPushAttrib +#define glPushClientAttrib GL.m_glPushClientAttrib +#define glPushMatrix GL.m_glPushMatrix +#define glPushName GL.m_glPushName +#define glRasterPos2d GL.m_glRasterPos2d +#define glRasterPos2dv GL.m_glRasterPos2dv +#define glRasterPos2f GL.m_glRasterPos2f +#define glRasterPos2fv GL.m_glRasterPos2fv +#define glRasterPos2i GL.m_glRasterPos2i +#define glRasterPos2iv GL.m_glRasterPos2iv +#define glRasterPos2s GL.m_glRasterPos2s +#define glRasterPos2sv GL.m_glRasterPos2sv +#define glRasterPos3d GL.m_glRasterPos3d +#define glRasterPos3dv GL.m_glRasterPos3dv +#define glRasterPos3f GL.m_glRasterPos3f +#define glRasterPos3fv GL.m_glRasterPos3fv +#define glRasterPos3i GL.m_glRasterPos3i +#define glRasterPos3iv GL.m_glRasterPos3iv +#define glRasterPos3s GL.m_glRasterPos3s +#define glRasterPos3sv GL.m_glRasterPos3sv +#define glRasterPos4d GL.m_glRasterPos4d +#define glRasterPos4dv GL.m_glRasterPos4dv +#define glRasterPos4f GL.m_glRasterPos4f +#define glRasterPos4fv GL.m_glRasterPos4fv +#define glRasterPos4i GL.m_glRasterPos4i +#define glRasterPos4iv GL.m_glRasterPos4iv +#define glRasterPos4s GL.m_glRasterPos4s +#define glRasterPos4sv GL.m_glRasterPos4sv +#define glReadBuffer GL.m_glReadBuffer +#define glReadPixels GL.m_glReadPixels +#define glRectd GL.m_glRectd +#define glRectdv GL.m_glRectdv +#define glRectf GL.m_glRectf +#define glRectfv GL.m_glRectfv +#define glRecti GL.m_glRecti +#define glRectiv GL.m_glRectiv +#define glRects GL.m_glRects +#define glRectsv GL.m_glRectsv +#define glRenderMode GL.m_glRenderMode +#define glRotated GL.m_glRotated +#define glRotatef GL.m_glRotatef +#define glScaled GL.m_glScaled +#define glScalef GL.m_glScalef +#define glScissor GL.m_glScissor +#define glSelectBuffer GL.m_glSelectBuffer +#define glShadeModel GL.m_glShadeModel +#define glStencilFunc GL.m_glStencilFunc +#define glStencilMask GL.m_glStencilMask +#define glStencilOp GL.m_glStencilOp +#define glTexCoord1d GL.m_glTexCoord1d +#define glTexCoord1dv GL.m_glTexCoord1dv +#define glTexCoord1f GL.m_glTexCoord1f +#define glTexCoord1fv GL.m_glTexCoord1fv +#define glTexCoord1i GL.m_glTexCoord1i +#define glTexCoord1iv GL.m_glTexCoord1iv +#define glTexCoord1s GL.m_glTexCoord1s +#define glTexCoord1sv GL.m_glTexCoord1sv +#define glTexCoord2d GL.m_glTexCoord2d +#define glTexCoord2dv GL.m_glTexCoord2dv +#define glTexCoord2f GL.m_glTexCoord2f +#define glTexCoord2fv GL.m_glTexCoord2fv +#define glTexCoord2i GL.m_glTexCoord2i +#define glTexCoord2iv GL.m_glTexCoord2iv +#define glTexCoord2s GL.m_glTexCoord2s +#define glTexCoord2sv GL.m_glTexCoord2sv +#define glTexCoord3d GL.m_glTexCoord3d +#define glTexCoord3dv GL.m_glTexCoord3dv +#define glTexCoord3f GL.m_glTexCoord3f +#define glTexCoord3fv GL.m_glTexCoord3fv +#define glTexCoord3i GL.m_glTexCoord3i +#define glTexCoord3iv GL.m_glTexCoord3iv +#define glTexCoord3s GL.m_glTexCoord3s +#define glTexCoord3sv GL.m_glTexCoord3sv +#define glTexCoord4d GL.m_glTexCoord4d +#define glTexCoord4dv GL.m_glTexCoord4dv +#define glTexCoord4f GL.m_glTexCoord4f +#define glTexCoord4fv GL.m_glTexCoord4fv +#define glTexCoord4i GL.m_glTexCoord4i +#define glTexCoord4iv GL.m_glTexCoord4iv +#define glTexCoord4s GL.m_glTexCoord4s +#define glTexCoord4sv GL.m_glTexCoord4sv +#define glTexCoordPointer GL.m_glTexCoordPointer +#define glTexEnvf GL.m_glTexEnvf +#define glTexEnvfv GL.m_glTexEnvfv +#define glTexEnvi GL.m_glTexEnvi +#define glTexEnviv GL.m_glTexEnviv +#define glTexGend GL.m_glTexGend +#define glTexGendv GL.m_glTexGendv +#define glTexGenf GL.m_glTexGenf +#define glTexGenfv GL.m_glTexGenfv +#define glTexGeni GL.m_glTexGeni +#define glTexGeniv GL.m_glTexGeniv +#define glTexImage1D GL.m_glTexImage1D +#define glTexImage2D GL.m_glTexImage2D +#define glTexParameterf GL.m_glTexParameterf +#define glTexParameterfv GL.m_glTexParameterfv +#define glTexParameteri GL.m_glTexParameteri +#define glTexParameteriv GL.m_glTexParameteriv +#define glTexSubImage1D GL.m_glTexSubImage1D +#define glTexSubImage2D GL.m_glTexSubImage2D +#define glTranslated GL.m_glTranslated +#define glTranslatef GL.m_glTranslatef +#define glVertex2d GL.m_glVertex2d +#define glVertex2dv GL.m_glVertex2dv +#define glVertex2f GL.m_glVertex2f +#define glVertex2fv GL.m_glVertex2fv +#define glVertex2i GL.m_glVertex2i +#define glVertex2iv GL.m_glVertex2iv +#define glVertex2s GL.m_glVertex2s +#define glVertex2sv GL.m_glVertex2sv +#define glVertex3d GL.m_glVertex3d +#define glVertex3dv GL.m_glVertex3dv +#define glVertex3f GL.m_glVertex3f +#define glVertex3fv GL.m_glVertex3fv +#define glVertex3i GL.m_glVertex3i +#define glVertex3iv GL.m_glVertex3iv +#define glVertex3s GL.m_glVertex3s +#define glVertex3sv GL.m_glVertex3sv +#define glVertex4d GL.m_glVertex4d +#define glVertex4dv GL.m_glVertex4dv +#define glVertex4f GL.m_glVertex4f +#define glVertex4fv GL.m_glVertex4fv +#define glVertex4i GL.m_glVertex4i +#define glVertex4iv GL.m_glVertex4iv +#define glVertex4s GL.m_glVertex4s +#define glVertex4sv GL.m_glVertex4sv +#define glVertexPointer GL.m_glVertexPointer +#define glViewport GL.m_glViewport #endif @@ -1031,40 +1031,40 @@ typedef void GLvoid; #define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 #define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 -#define glActiveTextureARB GlobalOpenGL().m_glActiveTextureARB -#define glClientActiveTextureARB GlobalOpenGL().m_glClientActiveTextureARB -#define glMultiTexCoord1dARB GlobalOpenGL().m_glMultiTexCoord1dARB -#define glMultiTexCoord1dvARB GlobalOpenGL().m_glMultiTexCoord1dvARB -#define glMultiTexCoord1fARB GlobalOpenGL().m_glMultiTexCoord1fARB -#define glMultiTexCoord1fvARB GlobalOpenGL().m_glMultiTexCoord1fvARB -#define glMultiTexCoord1iARB GlobalOpenGL().m_glMultiTexCoord1iARB -#define glMultiTexCoord1ivARB GlobalOpenGL().m_glMultiTexCoord1ivARB -#define glMultiTexCoord1sARB GlobalOpenGL().m_glMultiTexCoord1sARB -#define glMultiTexCoord1svARB GlobalOpenGL().m_glMultiTexCoord1svARB -#define glMultiTexCoord2dARB GlobalOpenGL().m_glMultiTexCoord2dARB -#define glMultiTexCoord2dvARB GlobalOpenGL().m_glMultiTexCoord2dvARB -#define glMultiTexCoord2fARB GlobalOpenGL().m_glMultiTexCoord2fARB -#define glMultiTexCoord2fvARB GlobalOpenGL().m_glMultiTexCoord2fvARB -#define glMultiTexCoord2iARB GlobalOpenGL().m_glMultiTexCoord2iARB -#define glMultiTexCoord2ivARB GlobalOpenGL().m_glMultiTexCoord2ivARB -#define glMultiTexCoord2sARB GlobalOpenGL().m_glMultiTexCoord2sARB -#define glMultiTexCoord2svARB GlobalOpenGL().m_glMultiTexCoord2svARB -#define glMultiTexCoord3dARB GlobalOpenGL().m_glMultiTexCoord3dARB -#define glMultiTexCoord3dvARB GlobalOpenGL().m_glMultiTexCoord3dvARB -#define glMultiTexCoord3fARB GlobalOpenGL().m_glMultiTexCoord3fARB -#define glMultiTexCoord3fvARB GlobalOpenGL().m_glMultiTexCoord3fvARB -#define glMultiTexCoord3iARB GlobalOpenGL().m_glMultiTexCoord3iARB -#define glMultiTexCoord3ivARB GlobalOpenGL().m_glMultiTexCoord3ivARB -#define glMultiTexCoord3sARB GlobalOpenGL().m_glMultiTexCoord3sARB -#define glMultiTexCoord3svARB GlobalOpenGL().m_glMultiTexCoord3svARB -#define glMultiTexCoord4dARB GlobalOpenGL().m_glMultiTexCoord4dARB -#define glMultiTexCoord4dvARB GlobalOpenGL().m_glMultiTexCoord4dvARB -#define glMultiTexCoord4fARB GlobalOpenGL().m_glMultiTexCoord4fARB -#define glMultiTexCoord4fvARB GlobalOpenGL().m_glMultiTexCoord4fvARB -#define glMultiTexCoord4iARB GlobalOpenGL().m_glMultiTexCoord4iARB -#define glMultiTexCoord4ivARB GlobalOpenGL().m_glMultiTexCoord4ivARB -#define glMultiTexCoord4sARB GlobalOpenGL().m_glMultiTexCoord4sARB -#define glMultiTexCoord4svARB GlobalOpenGL().m_glMultiTexCoord4svARB +#define glActiveTextureARB GL.m_glActiveTextureARB +#define glClientActiveTextureARB GL.m_glClientActiveTextureARB +#define glMultiTexCoord1dARB GL.m_glMultiTexCoord1dARB +#define glMultiTexCoord1dvARB GL.m_glMultiTexCoord1dvARB +#define glMultiTexCoord1fARB GL.m_glMultiTexCoord1fARB +#define glMultiTexCoord1fvARB GL.m_glMultiTexCoord1fvARB +#define glMultiTexCoord1iARB GL.m_glMultiTexCoord1iARB +#define glMultiTexCoord1ivARB GL.m_glMultiTexCoord1ivARB +#define glMultiTexCoord1sARB GL.m_glMultiTexCoord1sARB +#define glMultiTexCoord1svARB GL.m_glMultiTexCoord1svARB +#define glMultiTexCoord2dARB GL.m_glMultiTexCoord2dARB +#define glMultiTexCoord2dvARB GL.m_glMultiTexCoord2dvARB +#define glMultiTexCoord2fARB GL.m_glMultiTexCoord2fARB +#define glMultiTexCoord2fvARB GL.m_glMultiTexCoord2fvARB +#define glMultiTexCoord2iARB GL.m_glMultiTexCoord2iARB +#define glMultiTexCoord2ivARB GL.m_glMultiTexCoord2ivARB +#define glMultiTexCoord2sARB GL.m_glMultiTexCoord2sARB +#define glMultiTexCoord2svARB GL.m_glMultiTexCoord2svARB +#define glMultiTexCoord3dARB GL.m_glMultiTexCoord3dARB +#define glMultiTexCoord3dvARB GL.m_glMultiTexCoord3dvARB +#define glMultiTexCoord3fARB GL.m_glMultiTexCoord3fARB +#define glMultiTexCoord3fvARB GL.m_glMultiTexCoord3fvARB +#define glMultiTexCoord3iARB GL.m_glMultiTexCoord3iARB +#define glMultiTexCoord3ivARB GL.m_glMultiTexCoord3ivARB +#define glMultiTexCoord3sARB GL.m_glMultiTexCoord3sARB +#define glMultiTexCoord3svARB GL.m_glMultiTexCoord3svARB +#define glMultiTexCoord4dARB GL.m_glMultiTexCoord4dARB +#define glMultiTexCoord4dvARB GL.m_glMultiTexCoord4dvARB +#define glMultiTexCoord4fARB GL.m_glMultiTexCoord4fARB +#define glMultiTexCoord4fvARB GL.m_glMultiTexCoord4fvARB +#define glMultiTexCoord4iARB GL.m_glMultiTexCoord4iARB +#define glMultiTexCoord4ivARB GL.m_glMultiTexCoord4ivARB +#define glMultiTexCoord4sARB GL.m_glMultiTexCoord4sARB +#define glMultiTexCoord4svARB GL.m_glMultiTexCoord4svARB #endif @@ -1097,13 +1097,13 @@ typedef void GLvoid; #define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 -#define glCompressedTexImage3DARB GlobalOpenGL().m_glCompressedTexImage3DARB -#define glCompressedTexImage2DARB GlobalOpenGL().m_glCompressedTexImage2DARB -#define glCompressedTexImage1DARB GlobalOpenGL().m_glCompressedTexImage1DARB -#define glCompressedTexSubImage3DARB GlobalOpenGL().m_glCompressedTexSubImage3DARB -#define glCompressedTexSubImage2DARB GlobalOpenGL().m_glCompressedTexSubImage2DARB -#define glCompressedTexSubImage1DARB GlobalOpenGL().m_glCompressedTexSubImage1DARB -#define glGetCompressedTexImageARB GlobalOpenGL().m_glGetCompressedTexImageARB +#define glCompressedTexImage3DARB GL.m_glCompressedTexImage3DARB +#define glCompressedTexImage2DARB GL.m_glCompressedTexImage2DARB +#define glCompressedTexImage1DARB GL.m_glCompressedTexImage1DARB +#define glCompressedTexSubImage3DARB GL.m_glCompressedTexSubImage3DARB +#define glCompressedTexSubImage2DARB GL.m_glCompressedTexSubImage2DARB +#define glCompressedTexSubImage1DARB GL.m_glCompressedTexSubImage1DARB +#define glGetCompressedTexImageARB GL.m_glGetCompressedTexImageARB #endif @@ -1154,10 +1154,10 @@ typedef void GLvoid; #define GL_ALIASED_POINT_SIZE_RANGE 0x846D #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#define glCopyTexSubImage3D GlobalOpenGL().m_glCopyTexSubImage3D -#define glDrawRangeElements GlobalOpenGL().m_glDrawRangeElements -#define glTexImage3D GlobalOpenGL().m_glTexImage3D -#define glTexSubImage3D GlobalOpenGL().m_glTexSubImage3D +#define glCopyTexSubImage3D GL.m_glCopyTexSubImage3D +#define glDrawRangeElements GL.m_glDrawRangeElements +#define glTexImage3D GL.m_glTexImage3D +#define glTexSubImage3D GL.m_glTexSubImage3D #endif @@ -1264,52 +1264,52 @@ typedef void GLvoid; #define GL_DOT3_RGBA 0x86AF #define GL_MULTISAMPLE_BIT 0x20000000 -#define glActiveTexture GlobalOpenGL().m_glActiveTexture -#define glClientActiveTexture GlobalOpenGL().m_glClientActiveTexture -#define glCompressedTexImage1D GlobalOpenGL().m_glCompressedTexImage1D -#define glCompressedTexImage2D GlobalOpenGL().m_glCompressedTexImage2D -#define glCompressedTexImage3D GlobalOpenGL().m_glCompressedTexImage3D -#define glCompressedTexSubImage1D GlobalOpenGL().m_glCompressedTexSubImage1D -#define glCompressedTexSubImage2D GlobalOpenGL().m_glCompressedTexSubImage2D -#define glCompressedTexSubImage3D GlobalOpenGL().m_glCompressedTexSubImage3D -#define glGetCompressedTexImage GlobalOpenGL().m_glGetCompressedTexImage -#define glLoadTransposeMatrixd GlobalOpenGL().m_glLoadTransposeMatrixd -#define glLoadTransposeMatrixf GlobalOpenGL().m_glLoadTransposeMatrixf -#define glMultTransposeMatrixd GlobalOpenGL().m_glMultTransposeMatrixd -#define glMultTransposeMatrixf GlobalOpenGL().m_glMultTransposeMatrixf -#define glMultiTexCoord1d GlobalOpenGL().m_glMultiTexCoord1d -#define glMultiTexCoord1dv GlobalOpenGL().m_glMultiTexCoord1dv -#define glMultiTexCoord1f GlobalOpenGL().m_glMultiTexCoord1f -#define glMultiTexCoord1fv GlobalOpenGL().m_glMultiTexCoord1fv -#define glMultiTexCoord1i GlobalOpenGL().m_glMultiTexCoord1i -#define glMultiTexCoord1iv GlobalOpenGL().m_glMultiTexCoord1iv -#define glMultiTexCoord1s GlobalOpenGL().m_glMultiTexCoord1s -#define glMultiTexCoord1sv GlobalOpenGL().m_glMultiTexCoord1sv -#define glMultiTexCoord2d GlobalOpenGL().m_glMultiTexCoord2d -#define glMultiTexCoord2dv GlobalOpenGL().m_glMultiTexCoord2dv -#define glMultiTexCoord2f GlobalOpenGL().m_glMultiTexCoord2f -#define glMultiTexCoord2fv GlobalOpenGL().m_glMultiTexCoord2fv -#define glMultiTexCoord2i GlobalOpenGL().m_glMultiTexCoord2i -#define glMultiTexCoord2iv GlobalOpenGL().m_glMultiTexCoord2iv -#define glMultiTexCoord2s GlobalOpenGL().m_glMultiTexCoord2s -#define glMultiTexCoord2sv GlobalOpenGL().m_glMultiTexCoord2sv -#define glMultiTexCoord3d GlobalOpenGL().m_glMultiTexCoord3d -#define glMultiTexCoord3dv GlobalOpenGL().m_glMultiTexCoord3dv -#define glMultiTexCoord3f GlobalOpenGL().m_glMultiTexCoord3f -#define glMultiTexCoord3fv GlobalOpenGL().m_glMultiTexCoord3fv -#define glMultiTexCoord3i GlobalOpenGL().m_glMultiTexCoord3i -#define glMultiTexCoord3iv GlobalOpenGL().m_glMultiTexCoord3iv -#define glMultiTexCoord3s GlobalOpenGL().m_glMultiTexCoord3s -#define glMultiTexCoord3sv GlobalOpenGL().m_glMultiTexCoord3sv -#define glMultiTexCoord4d GlobalOpenGL().m_glMultiTexCoord4d -#define glMultiTexCoord4dv GlobalOpenGL().m_glMultiTexCoord4dv -#define glMultiTexCoord4f GlobalOpenGL().m_glMultiTexCoord4f -#define glMultiTexCoord4fv GlobalOpenGL().m_glMultiTexCoord4fv -#define glMultiTexCoord4i GlobalOpenGL().m_glMultiTexCoord4i -#define glMultiTexCoord4iv GlobalOpenGL().m_glMultiTexCoord4iv -#define glMultiTexCoord4s GlobalOpenGL().m_glMultiTexCoord4s -#define glMultiTexCoord4sv GlobalOpenGL().m_glMultiTexCoord4sv -#define glSampleCoverage GlobalOpenGL().m_glSampleCoverage +#define glActiveTexture GL.m_glActiveTexture +#define glClientActiveTexture GL.m_glClientActiveTexture +#define glCompressedTexImage1D GL.m_glCompressedTexImage1D +#define glCompressedTexImage2D GL.m_glCompressedTexImage2D +#define glCompressedTexImage3D GL.m_glCompressedTexImage3D +#define glCompressedTexSubImage1D GL.m_glCompressedTexSubImage1D +#define glCompressedTexSubImage2D GL.m_glCompressedTexSubImage2D +#define glCompressedTexSubImage3D GL.m_glCompressedTexSubImage3D +#define glGetCompressedTexImage GL.m_glGetCompressedTexImage +#define glLoadTransposeMatrixd GL.m_glLoadTransposeMatrixd +#define glLoadTransposeMatrixf GL.m_glLoadTransposeMatrixf +#define glMultTransposeMatrixd GL.m_glMultTransposeMatrixd +#define glMultTransposeMatrixf GL.m_glMultTransposeMatrixf +#define glMultiTexCoord1d GL.m_glMultiTexCoord1d +#define glMultiTexCoord1dv GL.m_glMultiTexCoord1dv +#define glMultiTexCoord1f GL.m_glMultiTexCoord1f +#define glMultiTexCoord1fv GL.m_glMultiTexCoord1fv +#define glMultiTexCoord1i GL.m_glMultiTexCoord1i +#define glMultiTexCoord1iv GL.m_glMultiTexCoord1iv +#define glMultiTexCoord1s GL.m_glMultiTexCoord1s +#define glMultiTexCoord1sv GL.m_glMultiTexCoord1sv +#define glMultiTexCoord2d GL.m_glMultiTexCoord2d +#define glMultiTexCoord2dv GL.m_glMultiTexCoord2dv +#define glMultiTexCoord2f GL.m_glMultiTexCoord2f +#define glMultiTexCoord2fv GL.m_glMultiTexCoord2fv +#define glMultiTexCoord2i GL.m_glMultiTexCoord2i +#define glMultiTexCoord2iv GL.m_glMultiTexCoord2iv +#define glMultiTexCoord2s GL.m_glMultiTexCoord2s +#define glMultiTexCoord2sv GL.m_glMultiTexCoord2sv +#define glMultiTexCoord3d GL.m_glMultiTexCoord3d +#define glMultiTexCoord3dv GL.m_glMultiTexCoord3dv +#define glMultiTexCoord3f GL.m_glMultiTexCoord3f +#define glMultiTexCoord3fv GL.m_glMultiTexCoord3fv +#define glMultiTexCoord3i GL.m_glMultiTexCoord3i +#define glMultiTexCoord3iv GL.m_glMultiTexCoord3iv +#define glMultiTexCoord3s GL.m_glMultiTexCoord3s +#define glMultiTexCoord3sv GL.m_glMultiTexCoord3sv +#define glMultiTexCoord4d GL.m_glMultiTexCoord4d +#define glMultiTexCoord4dv GL.m_glMultiTexCoord4dv +#define glMultiTexCoord4f GL.m_glMultiTexCoord4f +#define glMultiTexCoord4fv GL.m_glMultiTexCoord4fv +#define glMultiTexCoord4i GL.m_glMultiTexCoord4i +#define glMultiTexCoord4iv GL.m_glMultiTexCoord4iv +#define glMultiTexCoord4s GL.m_glMultiTexCoord4s +#define glMultiTexCoord4sv GL.m_glMultiTexCoord4sv +#define glSampleCoverage GL.m_glSampleCoverage #endif @@ -1360,51 +1360,51 @@ typedef void GLvoid; #define GL_TEXTURE_COMPARE_FUNC 0x884D #define GL_COMPARE_R_TO_TEXTURE 0x884E -#define glBlendColor GlobalOpenGL().m_glBlendColor -#define glBlendEquation GlobalOpenGL().m_glBlendEquation -#define glBlendFuncSeparate GlobalOpenGL().m_glBlendFuncSeparate -#define glFogCoordPointer GlobalOpenGL().m_glFogCoordPointer -#define glFogCoordd GlobalOpenGL().m_glFogCoordd -#define glFogCoorddv GlobalOpenGL().m_glFogCoorddv -#define glFogCoordf GlobalOpenGL().m_glFogCoordf -#define glFogCoordfv GlobalOpenGL().m_glFogCoordfv -#define glMultiDrawArrays GlobalOpenGL().m_glMultiDrawArrays -#define glMultiDrawElements GlobalOpenGL().m_glMultiDrawElements -#define glPointParameterf GlobalOpenGL().m_glPointParameterf -#define glPointParameterfv GlobalOpenGL().m_glPointParameterfv -#define glSecondaryColor3b GlobalOpenGL().m_glSecondaryColor3b -#define glSecondaryColor3bv GlobalOpenGL().m_glSecondaryColor3bv -#define glSecondaryColor3d GlobalOpenGL().m_glSecondaryColor3d -#define glSecondaryColor3dv GlobalOpenGL().m_glSecondaryColor3dv -#define glSecondaryColor3f GlobalOpenGL().m_glSecondaryColor3f -#define glSecondaryColor3fv GlobalOpenGL().m_glSecondaryColor3fv -#define glSecondaryColor3i GlobalOpenGL().m_glSecondaryColor3i -#define glSecondaryColor3iv GlobalOpenGL().m_glSecondaryColor3iv -#define glSecondaryColor3s GlobalOpenGL().m_glSecondaryColor3s -#define glSecondaryColor3sv GlobalOpenGL().m_glSecondaryColor3sv -#define glSecondaryColor3ub GlobalOpenGL().m_glSecondaryColor3ub -#define glSecondaryColor3ubv GlobalOpenGL().m_glSecondaryColor3ubv -#define glSecondaryColor3ui GlobalOpenGL().m_glSecondaryColor3ui -#define glSecondaryColor3uiv GlobalOpenGL().m_glSecondaryColor3uiv -#define glSecondaryColor3us GlobalOpenGL().m_glSecondaryColor3us -#define glSecondaryColor3usv GlobalOpenGL().m_glSecondaryColor3usv -#define glSecondaryColorPointer GlobalOpenGL().m_glSecondaryColorPointer -#define glWindowPos2d GlobalOpenGL().m_glWindowPos2d -#define glWindowPos2dv GlobalOpenGL().m_glWindowPos2dv -#define glWindowPos2f GlobalOpenGL().m_glWindowPos2f -#define glWindowPos2fv GlobalOpenGL().m_glWindowPos2fv -#define glWindowPos2i GlobalOpenGL().m_glWindowPos2i -#define glWindowPos2iv GlobalOpenGL().m_glWindowPos2iv -#define glWindowPos2s GlobalOpenGL().m_glWindowPos2s -#define glWindowPos2sv GlobalOpenGL().m_glWindowPos2sv -#define glWindowPos3d GlobalOpenGL().m_glWindowPos3d -#define glWindowPos3dv GlobalOpenGL().m_glWindowPos3dv -#define glWindowPos3f GlobalOpenGL().m_glWindowPos3f -#define glWindowPos3fv GlobalOpenGL().m_glWindowPos3fv -#define glWindowPos3i GlobalOpenGL().m_glWindowPos3i -#define glWindowPos3iv GlobalOpenGL().m_glWindowPos3iv -#define glWindowPos3s GlobalOpenGL().m_glWindowPos3s -#define glWindowPos3sv GlobalOpenGL().m_glWindowPos3sv +#define glBlendColor GL.m_glBlendColor +#define glBlendEquation GL.m_glBlendEquation +#define glBlendFuncSeparate GL.m_glBlendFuncSeparate +#define glFogCoordPointer GL.m_glFogCoordPointer +#define glFogCoordd GL.m_glFogCoordd +#define glFogCoorddv GL.m_glFogCoorddv +#define glFogCoordf GL.m_glFogCoordf +#define glFogCoordfv GL.m_glFogCoordfv +#define glMultiDrawArrays GL.m_glMultiDrawArrays +#define glMultiDrawElements GL.m_glMultiDrawElements +#define glPointParameterf GL.m_glPointParameterf +#define glPointParameterfv GL.m_glPointParameterfv +#define glSecondaryColor3b GL.m_glSecondaryColor3b +#define glSecondaryColor3bv GL.m_glSecondaryColor3bv +#define glSecondaryColor3d GL.m_glSecondaryColor3d +#define glSecondaryColor3dv GL.m_glSecondaryColor3dv +#define glSecondaryColor3f GL.m_glSecondaryColor3f +#define glSecondaryColor3fv GL.m_glSecondaryColor3fv +#define glSecondaryColor3i GL.m_glSecondaryColor3i +#define glSecondaryColor3iv GL.m_glSecondaryColor3iv +#define glSecondaryColor3s GL.m_glSecondaryColor3s +#define glSecondaryColor3sv GL.m_glSecondaryColor3sv +#define glSecondaryColor3ub GL.m_glSecondaryColor3ub +#define glSecondaryColor3ubv GL.m_glSecondaryColor3ubv +#define glSecondaryColor3ui GL.m_glSecondaryColor3ui +#define glSecondaryColor3uiv GL.m_glSecondaryColor3uiv +#define glSecondaryColor3us GL.m_glSecondaryColor3us +#define glSecondaryColor3usv GL.m_glSecondaryColor3usv +#define glSecondaryColorPointer GL.m_glSecondaryColorPointer +#define glWindowPos2d GL.m_glWindowPos2d +#define glWindowPos2dv GL.m_glWindowPos2dv +#define glWindowPos2f GL.m_glWindowPos2f +#define glWindowPos2fv GL.m_glWindowPos2fv +#define glWindowPos2i GL.m_glWindowPos2i +#define glWindowPos2iv GL.m_glWindowPos2iv +#define glWindowPos2s GL.m_glWindowPos2s +#define glWindowPos2sv GL.m_glWindowPos2sv +#define glWindowPos3d GL.m_glWindowPos3d +#define glWindowPos3dv GL.m_glWindowPos3dv +#define glWindowPos3f GL.m_glWindowPos3f +#define glWindowPos3fv GL.m_glWindowPos3fv +#define glWindowPos3i GL.m_glWindowPos3i +#define glWindowPos3iv GL.m_glWindowPos3iv +#define glWindowPos3s GL.m_glWindowPos3s +#define glWindowPos3sv GL.m_glWindowPos3sv #endif @@ -1467,25 +1467,25 @@ typedef void GLvoid; typedef std::ptrdiff_t GLsizeiptr; typedef std::ptrdiff_t GLintptr; -#define glBeginQuery GlobalOpenGL().m_glBeginQuery -#define glBindBuffer GlobalOpenGL().m_glBindBuffer -#define glBufferData GlobalOpenGL().m_glBufferData -#define glBufferSubData GlobalOpenGL().m_glBufferSubData -#define glDeleteBuffers GlobalOpenGL().m_glDeleteBuffers -#define glDeleteQueries GlobalOpenGL().m_glDeleteQueries -#define glEndQuery GlobalOpenGL().m_glEndQuery -#define glGenBuffers GlobalOpenGL().m_glGenBuffers -#define glGenQueries GlobalOpenGL().m_glGenQueries -#define glGetBufferParameteriv GlobalOpenGL().m_glGetBufferParameteriv -#define glGetBufferPointerv GlobalOpenGL().m_glGetBufferPointerv -#define glGetBufferSubData GlobalOpenGL().m_glGetBufferSubData -#define glGetQueryObjectiv GlobalOpenGL().m_glGetQueryObjectiv -#define glGetQueryObjectuiv GlobalOpenGL().m_glGetQueryObjectuiv -#define glGetQueryiv GlobalOpenGL().m_glGetQueryiv -#define glIsBuffer GlobalOpenGL().m_glIsBuffer -#define glIsQuery GlobalOpenGL().m_glIsQuery -#define glMapBuffer GlobalOpenGL().m_glMapBuffer -#define glUnmapBuffer GlobalOpenGL().m_glUnmapBuffer +#define glBeginQuery GL.m_glBeginQuery +#define glBindBuffer GL.m_glBindBuffer +#define glBufferData GL.m_glBufferData +#define glBufferSubData GL.m_glBufferSubData +#define glDeleteBuffers GL.m_glDeleteBuffers +#define glDeleteQueries GL.m_glDeleteQueries +#define glEndQuery GL.m_glEndQuery +#define glGenBuffers GL.m_glGenBuffers +#define glGenQueries GL.m_glGenQueries +#define glGetBufferParameteriv GL.m_glGetBufferParameteriv +#define glGetBufferPointerv GL.m_glGetBufferPointerv +#define glGetBufferSubData GL.m_glGetBufferSubData +#define glGetQueryObjectiv GL.m_glGetQueryObjectiv +#define glGetQueryObjectuiv GL.m_glGetQueryObjectuiv +#define glGetQueryiv GL.m_glGetQueryiv +#define glIsBuffer GL.m_glIsBuffer +#define glIsQuery GL.m_glIsQuery +#define glMapBuffer GL.m_glMapBuffer +#define glUnmapBuffer GL.m_glUnmapBuffer #endif @@ -1574,68 +1574,68 @@ typedef std::ptrdiff_t GLintptr; #define GL_MATRIX30_ARB 0x88DE #define GL_MATRIX31_ARB 0x88DF -#define glVertexAttrib1sARB GlobalOpenGL().m_glVertexAttrib1sARB -#define glVertexAttrib1fARB GlobalOpenGL().m_glVertexAttrib1fARB -#define glVertexAttrib1dARB GlobalOpenGL().m_glVertexAttrib1dARB -#define glVertexAttrib2sARB GlobalOpenGL().m_glVertexAttrib2sARB -#define glVertexAttrib2fARB GlobalOpenGL().m_glVertexAttrib2fARB -#define glVertexAttrib2dARB GlobalOpenGL().m_glVertexAttrib2dARB -#define glVertexAttrib3sARB GlobalOpenGL().m_glVertexAttrib3sARB -#define glVertexAttrib3fARB GlobalOpenGL().m_glVertexAttrib3fARB -#define glVertexAttrib3dARB GlobalOpenGL().m_glVertexAttrib3dARB -#define glVertexAttrib4sARB GlobalOpenGL().m_glVertexAttrib4sARB -#define glVertexAttrib4fARB GlobalOpenGL().m_glVertexAttrib4fARB -#define glVertexAttrib4dARB GlobalOpenGL().m_glVertexAttrib4dARB -#define glVertexAttrib4NubARB GlobalOpenGL().m_glVertexAttrib4NubARB -#define glVertexAttrib1svARB GlobalOpenGL().m_glVertexAttrib1svARB -#define glVertexAttrib1fvARB GlobalOpenGL().m_glVertexAttrib1fvARB -#define glVertexAttrib1dvARB GlobalOpenGL().m_glVertexAttrib1dvARB -#define glVertexAttrib2svARB GlobalOpenGL().m_glVertexAttrib2svARB -#define glVertexAttrib2fvARB GlobalOpenGL().m_glVertexAttrib2fvARB -#define glVertexAttrib2dvARB GlobalOpenGL().m_glVertexAttrib2dvARB -#define glVertexAttrib3svARB GlobalOpenGL().m_glVertexAttrib3svARB -#define glVertexAttrib3fvARB GlobalOpenGL().m_glVertexAttrib3fvARB -#define glVertexAttrib3dvARB GlobalOpenGL().m_glVertexAttrib3dvARB -#define glVertexAttrib4bvARB GlobalOpenGL().m_glVertexAttrib4bvARB -#define glVertexAttrib4svARB GlobalOpenGL().m_glVertexAttrib4svARB -#define glVertexAttrib4ivARB GlobalOpenGL().m_glVertexAttrib4ivARB -#define glVertexAttrib4ubvARB GlobalOpenGL().m_glVertexAttrib4ubvARB -#define glVertexAttrib4usvARB GlobalOpenGL().m_glVertexAttrib4usvARB -#define glVertexAttrib4uivARB GlobalOpenGL().m_glVertexAttrib4uivARB -#define glVertexAttrib4fvARB GlobalOpenGL().m_glVertexAttrib4fvARB -#define glVertexAttrib4dvARB GlobalOpenGL().m_glVertexAttrib4dvARB -#define glVertexAttrib4NbvARB GlobalOpenGL().m_glVertexAttrib4NbvARB -#define glVertexAttrib4NsvARB GlobalOpenGL().m_glVertexAttrib4NsvARB -#define glVertexAttrib4NivARB GlobalOpenGL().m_glVertexAttrib4NivARB -#define glVertexAttrib4NubvARB GlobalOpenGL().m_glVertexAttrib4NubvARB -#define glVertexAttrib4NusvARB GlobalOpenGL().m_glVertexAttrib4NusvARB -#define glVertexAttrib4NuivARB GlobalOpenGL().m_glVertexAttrib4NuivARB -#define glVertexAttribPointerARB GlobalOpenGL().m_glVertexAttribPointerARB -#define glEnableVertexAttribArrayARB GlobalOpenGL().m_glEnableVertexAttribArrayARB -#define glDisableVertexAttribArrayARB GlobalOpenGL().m_glDisableVertexAttribArrayARB -#define glProgramStringARB GlobalOpenGL().m_glProgramStringARB -#define glBindProgramARB GlobalOpenGL().m_glBindProgramARB -#define glDeleteProgramsARB GlobalOpenGL().m_glDeleteProgramsARB -#define glGenProgramsARB GlobalOpenGL().m_glGenProgramsARB -#define glProgramEnvParameter4dARB GlobalOpenGL().m_glProgramEnvParameter4dARB -#define glProgramEnvParameter4dvARB GlobalOpenGL().m_glProgramEnvParameter4dvARB -#define glProgramEnvParameter4fARB GlobalOpenGL().m_glProgramEnvParameter4fARB -#define glProgramEnvParameter4fvARB GlobalOpenGL().m_glProgramEnvParameter4fvARB -#define glProgramLocalParameter4dARB GlobalOpenGL().m_glProgramLocalParameter4dARB -#define glProgramLocalParameter4dvARB GlobalOpenGL().m_glProgramLocalParameter4dvARB -#define glProgramLocalParameter4fARB GlobalOpenGL().m_glProgramLocalParameter4fARB -#define glProgramLocalParameter4fvARB GlobalOpenGL().m_glProgramLocalParameter4fvARB -#define glGetProgramEnvParameterdvARB GlobalOpenGL().m_glGetProgramEnvParameterdvARB -#define glGetProgramEnvParameterfvARB GlobalOpenGL().m_glGetProgramEnvParameterfvARB -#define glGetProgramLocalParameterdvARB GlobalOpenGL().m_glGetProgramLocalParameterdvARB -#define glGetProgramLocalParameterfvARB GlobalOpenGL().m_glGetProgramLocalParameterfvARB -#define glGetProgramivARB GlobalOpenGL().m_glGetProgramivARB -#define glGetProgramStringARB GlobalOpenGL().m_glGetProgramStringARB -#define glGetVertexAttribdvARB GlobalOpenGL().m_glGetVertexAttribdvARB -#define glGetVertexAttribfvARB GlobalOpenGL().m_glGetVertexAttribfvARB -#define glGetVertexAttribivARB GlobalOpenGL().m_glGetVertexAttribivARB -#define glGetVertexAttribPointervARB GlobalOpenGL().m_glGetVertexAttribPointervARB -#define glIsProgramARB GlobalOpenGL().m_glIsProgramARB +#define glVertexAttrib1sARB GL.m_glVertexAttrib1sARB +#define glVertexAttrib1fARB GL.m_glVertexAttrib1fARB +#define glVertexAttrib1dARB GL.m_glVertexAttrib1dARB +#define glVertexAttrib2sARB GL.m_glVertexAttrib2sARB +#define glVertexAttrib2fARB GL.m_glVertexAttrib2fARB +#define glVertexAttrib2dARB GL.m_glVertexAttrib2dARB +#define glVertexAttrib3sARB GL.m_glVertexAttrib3sARB +#define glVertexAttrib3fARB GL.m_glVertexAttrib3fARB +#define glVertexAttrib3dARB GL.m_glVertexAttrib3dARB +#define glVertexAttrib4sARB GL.m_glVertexAttrib4sARB +#define glVertexAttrib4fARB GL.m_glVertexAttrib4fARB +#define glVertexAttrib4dARB GL.m_glVertexAttrib4dARB +#define glVertexAttrib4NubARB GL.m_glVertexAttrib4NubARB +#define glVertexAttrib1svARB GL.m_glVertexAttrib1svARB +#define glVertexAttrib1fvARB GL.m_glVertexAttrib1fvARB +#define glVertexAttrib1dvARB GL.m_glVertexAttrib1dvARB +#define glVertexAttrib2svARB GL.m_glVertexAttrib2svARB +#define glVertexAttrib2fvARB GL.m_glVertexAttrib2fvARB +#define glVertexAttrib2dvARB GL.m_glVertexAttrib2dvARB +#define glVertexAttrib3svARB GL.m_glVertexAttrib3svARB +#define glVertexAttrib3fvARB GL.m_glVertexAttrib3fvARB +#define glVertexAttrib3dvARB GL.m_glVertexAttrib3dvARB +#define glVertexAttrib4bvARB GL.m_glVertexAttrib4bvARB +#define glVertexAttrib4svARB GL.m_glVertexAttrib4svARB +#define glVertexAttrib4ivARB GL.m_glVertexAttrib4ivARB +#define glVertexAttrib4ubvARB GL.m_glVertexAttrib4ubvARB +#define glVertexAttrib4usvARB GL.m_glVertexAttrib4usvARB +#define glVertexAttrib4uivARB GL.m_glVertexAttrib4uivARB +#define glVertexAttrib4fvARB GL.m_glVertexAttrib4fvARB +#define glVertexAttrib4dvARB GL.m_glVertexAttrib4dvARB +#define glVertexAttrib4NbvARB GL.m_glVertexAttrib4NbvARB +#define glVertexAttrib4NsvARB GL.m_glVertexAttrib4NsvARB +#define glVertexAttrib4NivARB GL.m_glVertexAttrib4NivARB +#define glVertexAttrib4NubvARB GL.m_glVertexAttrib4NubvARB +#define glVertexAttrib4NusvARB GL.m_glVertexAttrib4NusvARB +#define glVertexAttrib4NuivARB GL.m_glVertexAttrib4NuivARB +#define glVertexAttribPointerARB GL.m_glVertexAttribPointerARB +#define glEnableVertexAttribArrayARB GL.m_glEnableVertexAttribArrayARB +#define glDisableVertexAttribArrayARB GL.m_glDisableVertexAttribArrayARB +#define glProgramStringARB GL.m_glProgramStringARB +#define glBindProgramARB GL.m_glBindProgramARB +#define glDeleteProgramsARB GL.m_glDeleteProgramsARB +#define glGenProgramsARB GL.m_glGenProgramsARB +#define glProgramEnvParameter4dARB GL.m_glProgramEnvParameter4dARB +#define glProgramEnvParameter4dvARB GL.m_glProgramEnvParameter4dvARB +#define glProgramEnvParameter4fARB GL.m_glProgramEnvParameter4fARB +#define glProgramEnvParameter4fvARB GL.m_glProgramEnvParameter4fvARB +#define glProgramLocalParameter4dARB GL.m_glProgramLocalParameter4dARB +#define glProgramLocalParameter4dvARB GL.m_glProgramLocalParameter4dvARB +#define glProgramLocalParameter4fARB GL.m_glProgramLocalParameter4fARB +#define glProgramLocalParameter4fvARB GL.m_glProgramLocalParameter4fvARB +#define glGetProgramEnvParameterdvARB GL.m_glGetProgramEnvParameterdvARB +#define glGetProgramEnvParameterfvARB GL.m_glGetProgramEnvParameterfvARB +#define glGetProgramLocalParameterdvARB GL.m_glGetProgramLocalParameterdvARB +#define glGetProgramLocalParameterfvARB GL.m_glGetProgramLocalParameterfvARB +#define glGetProgramivARB GL.m_glGetProgramivARB +#define glGetProgramStringARB GL.m_glGetProgramStringARB +#define glGetVertexAttribdvARB GL.m_glGetVertexAttribdvARB +#define glGetVertexAttribfvARB GL.m_glGetVertexAttribfvARB +#define glGetVertexAttribivARB GL.m_glGetVertexAttribivARB +#define glGetVertexAttribPointervARB GL.m_glGetVertexAttribPointervARB +#define glIsProgramARB GL.m_glIsProgramARB #endif @@ -1702,45 +1702,45 @@ typedef std::ptrdiff_t GLintptr; #define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 #define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 -#define glDeleteObjectARB GlobalOpenGL().m_glDeleteObjectARB -#define glGetHandleARB GlobalOpenGL().m_glGetHandleARB -#define glDetachObjectARB GlobalOpenGL().m_glDetachObjectARB -#define glCreateShaderObjectARB GlobalOpenGL().m_glCreateShaderObjectARB -#define glShaderSourceARB GlobalOpenGL().m_glShaderSourceARB -#define glCompileShaderARB GlobalOpenGL().m_glCompileShaderARB -#define glCreateProgramObjectARB GlobalOpenGL().m_glCreateProgramObjectARB -#define glAttachObjectARB GlobalOpenGL().m_glAttachObjectARB -#define glLinkProgramARB GlobalOpenGL().m_glLinkProgramARB -#define glUseProgramObjectARB GlobalOpenGL().m_glUseProgramObjectARB -#define glValidateProgramARB GlobalOpenGL().m_glValidateProgramARB -#define glUniform1fARB GlobalOpenGL().m_glUniform1fARB -#define glUniform2fARB GlobalOpenGL().m_glUniform2fARB -#define glUniform3fARB GlobalOpenGL().m_glUniform3fARB -#define glUniform4fARB GlobalOpenGL().m_glUniform4fARB -#define glUniform1iARB GlobalOpenGL().m_glUniform1iARB -#define glUniform2iARB GlobalOpenGL().m_glUniform2iARB -#define glUniform3iARB GlobalOpenGL().m_glUniform3iARB -#define glUniform4iARB GlobalOpenGL().m_glUniform4iARB -#define glUniform1fvARB GlobalOpenGL().m_glUniform1fvARB -#define glUniform2fvARB GlobalOpenGL().m_glUniform2fvARB -#define glUniform3fvARB GlobalOpenGL().m_glUniform3fvARB -#define glUniform4fvARB GlobalOpenGL().m_glUniform4fvARB -#define glUniform1ivARB GlobalOpenGL().m_glUniform1ivARB -#define glUniform2ivARB GlobalOpenGL().m_glUniform2ivARB -#define glUniform3ivARB GlobalOpenGL().m_glUniform3ivARB -#define glUniform4ivARB GlobalOpenGL().m_glUniform4ivARB -#define glUniformMatrix2fvARB GlobalOpenGL().m_glUniformMatrix2fvARB -#define glUniformMatrix3fvARB GlobalOpenGL().m_glUniformMatrix3fvARB -#define glUniformMatrix4fvARB GlobalOpenGL().m_glUniformMatrix4fvARB -#define glGetObjectParameterfvARB GlobalOpenGL().m_glGetObjectParameterfvARB -#define glGetObjectParameterivARB GlobalOpenGL().m_glGetObjectParameterivARB -#define glGetInfoLogARB GlobalOpenGL().m_glGetInfoLogARB -#define glGetAttachedObjectsARB GlobalOpenGL().m_glGetAttachedObjectsARB -#define glGetUniformLocationARB GlobalOpenGL().m_glGetUniformLocationARB -#define glGetActiveUniformARB GlobalOpenGL().m_glGetActiveUniformARB -#define glGetUniformfvARB GlobalOpenGL().m_glGetUniformfvARB -#define glGetUniformivARB GlobalOpenGL().m_glGetUniformivARB -#define glGetShaderSourceARB GlobalOpenGL().m_glGetShaderSourceARB +#define glDeleteObjectARB GL.m_glDeleteObjectARB +#define glGetHandleARB GL.m_glGetHandleARB +#define glDetachObjectARB GL.m_glDetachObjectARB +#define glCreateShaderObjectARB GL.m_glCreateShaderObjectARB +#define glShaderSourceARB GL.m_glShaderSourceARB +#define glCompileShaderARB GL.m_glCompileShaderARB +#define glCreateProgramObjectARB GL.m_glCreateProgramObjectARB +#define glAttachObjectARB GL.m_glAttachObjectARB +#define glLinkProgramARB GL.m_glLinkProgramARB +#define glUseProgramObjectARB GL.m_glUseProgramObjectARB +#define glValidateProgramARB GL.m_glValidateProgramARB +#define glUniform1fARB GL.m_glUniform1fARB +#define glUniform2fARB GL.m_glUniform2fARB +#define glUniform3fARB GL.m_glUniform3fARB +#define glUniform4fARB GL.m_glUniform4fARB +#define glUniform1iARB GL.m_glUniform1iARB +#define glUniform2iARB GL.m_glUniform2iARB +#define glUniform3iARB GL.m_glUniform3iARB +#define glUniform4iARB GL.m_glUniform4iARB +#define glUniform1fvARB GL.m_glUniform1fvARB +#define glUniform2fvARB GL.m_glUniform2fvARB +#define glUniform3fvARB GL.m_glUniform3fvARB +#define glUniform4fvARB GL.m_glUniform4fvARB +#define glUniform1ivARB GL.m_glUniform1ivARB +#define glUniform2ivARB GL.m_glUniform2ivARB +#define glUniform3ivARB GL.m_glUniform3ivARB +#define glUniform4ivARB GL.m_glUniform4ivARB +#define glUniformMatrix2fvARB GL.m_glUniformMatrix2fvARB +#define glUniformMatrix3fvARB GL.m_glUniformMatrix3fvARB +#define glUniformMatrix4fvARB GL.m_glUniformMatrix4fvARB +#define glGetObjectParameterfvARB GL.m_glGetObjectParameterfvARB +#define glGetObjectParameterivARB GL.m_glGetObjectParameterivARB +#define glGetInfoLogARB GL.m_glGetInfoLogARB +#define glGetAttachedObjectsARB GL.m_glGetAttachedObjectsARB +#define glGetUniformLocationARB GL.m_glGetUniformLocationARB +#define glGetActiveUniformARB GL.m_glGetActiveUniformARB +#define glGetUniformfvARB GL.m_glGetUniformfvARB +#define glGetUniformivARB GL.m_glGetUniformivARB +#define glGetShaderSourceARB GL.m_glGetShaderSourceARB typedef char GLcharARB; typedef unsigned int GLhandleARB; @@ -1760,54 +1760,54 @@ typedef unsigned int GLhandleARB; #define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A #if 0 -#define glVertexAttrib1fARB GlobalOpenGL().m_glVertexAttrib1fARB -#define glVertexAttrib1sARB GlobalOpenGL().m_glVertexAttrib1sARB -#define glVertexAttrib1dARB GlobalOpenGL().m_glVertexAttrib1dARB -#define glVertexAttrib2fARB GlobalOpenGL().m_glVertexAttrib2fARB -#define glVertexAttrib2sARB GlobalOpenGL().m_glVertexAttrib2sARB -#define glVertexAttrib2dARB GlobalOpenGL().m_glVertexAttrib2dARB -#define glVertexAttrib3fARB GlobalOpenGL().m_glVertexAttrib3fARB -#define glVertexAttrib3sARB GlobalOpenGL().m_glVertexAttrib3sARB -#define glVertexAttrib3dARB GlobalOpenGL().m_glVertexAttrib3dARB -#define glVertexAttrib4fARB GlobalOpenGL().m_glVertexAttrib4fARB -#define glVertexAttrib4sARB GlobalOpenGL().m_glVertexAttrib4sARB -#define glVertexAttrib4dARB GlobalOpenGL().m_glVertexAttrib4dARB -#define glVertexAttrib4NubARB GlobalOpenGL().m_glVertexAttrib4NubARB -#define glVertexAttrib1fvARB GlobalOpenGL().m_glVertexAttrib1fvARB -#define glVertexAttrib1svARB GlobalOpenGL().m_glVertexAttrib1svARB -#define glVertexAttrib1dvARB GlobalOpenGL().m_glVertexAttrib1dvARB -#define glVertexAttrib2fvARB GlobalOpenGL().m_glVertexAttrib2fvARB -#define glVertexAttrib2svARB GlobalOpenGL().m_glVertexAttrib2svARB -#define glVertexAttrib2dvARB GlobalOpenGL().m_glVertexAttrib2dvARB -#define glVertexAttrib3fvARB GlobalOpenGL().m_glVertexAttrib3fvARB -#define glVertexAttrib3svARB GlobalOpenGL().m_glVertexAttrib3svARB -#define glVertexAttrib3dvARB GlobalOpenGL().m_glVertexAttrib3dvARB -#define glVertexAttrib4fvARB GlobalOpenGL().m_glVertexAttrib4fvARB -#define glVertexAttrib4svARB GlobalOpenGL().m_glVertexAttrib4svARB -#define glVertexAttrib4dvARB GlobalOpenGL().m_glVertexAttrib4dvARB -#define glVertexAttrib4ivARB GlobalOpenGL().m_glVertexAttrib4ivARB -#define glVertexAttrib4bvARB GlobalOpenGL().m_glVertexAttrib4bvARB -#define glVertexAttrib4ubvARB GlobalOpenGL().m_glVertexAttrib4ubvARB -#define glVertexAttrib4usvARB GlobalOpenGL().m_glVertexAttrib4usvARB -#define glVertexAttrib4uivARB GlobalOpenGL().m_glVertexAttrib4uivARB -#define glVertexAttrib4NbvARB GlobalOpenGL().m_glVertexAttrib4NbvARB -#define glVertexAttrib4NsvARB GlobalOpenGL().m_glVertexAttrib4NsvARB -#define glVertexAttrib4NivARB GlobalOpenGL().m_glVertexAttrib4NivARB -#define glVertexAttrib4NubvARB GlobalOpenGL().m_glVertexAttrib4NubvARB -#define glVertexAttrib4NusvARB GlobalOpenGL().m_glVertexAttrib4NusvARB -#define glVertexAttrib4NuivARB GlobalOpenGL().m_glVertexAttrib4NuivARB -#define glVertexAttribPointerARB GlobalOpenGL().m_glVertexAttribPointerARB -#define glEnableVertexAttribArrayARB GlobalOpenGL().m_glEnableVertexAttribArrayARB -#define glDisableVertexAttribArrayARB GlobalOpenGL().m_glDisableVertexAttribArrayARB +#define glVertexAttrib1fARB GL.m_glVertexAttrib1fARB +#define glVertexAttrib1sARB GL.m_glVertexAttrib1sARB +#define glVertexAttrib1dARB GL.m_glVertexAttrib1dARB +#define glVertexAttrib2fARB GL.m_glVertexAttrib2fARB +#define glVertexAttrib2sARB GL.m_glVertexAttrib2sARB +#define glVertexAttrib2dARB GL.m_glVertexAttrib2dARB +#define glVertexAttrib3fARB GL.m_glVertexAttrib3fARB +#define glVertexAttrib3sARB GL.m_glVertexAttrib3sARB +#define glVertexAttrib3dARB GL.m_glVertexAttrib3dARB +#define glVertexAttrib4fARB GL.m_glVertexAttrib4fARB +#define glVertexAttrib4sARB GL.m_glVertexAttrib4sARB +#define glVertexAttrib4dARB GL.m_glVertexAttrib4dARB +#define glVertexAttrib4NubARB GL.m_glVertexAttrib4NubARB +#define glVertexAttrib1fvARB GL.m_glVertexAttrib1fvARB +#define glVertexAttrib1svARB GL.m_glVertexAttrib1svARB +#define glVertexAttrib1dvARB GL.m_glVertexAttrib1dvARB +#define glVertexAttrib2fvARB GL.m_glVertexAttrib2fvARB +#define glVertexAttrib2svARB GL.m_glVertexAttrib2svARB +#define glVertexAttrib2dvARB GL.m_glVertexAttrib2dvARB +#define glVertexAttrib3fvARB GL.m_glVertexAttrib3fvARB +#define glVertexAttrib3svARB GL.m_glVertexAttrib3svARB +#define glVertexAttrib3dvARB GL.m_glVertexAttrib3dvARB +#define glVertexAttrib4fvARB GL.m_glVertexAttrib4fvARB +#define glVertexAttrib4svARB GL.m_glVertexAttrib4svARB +#define glVertexAttrib4dvARB GL.m_glVertexAttrib4dvARB +#define glVertexAttrib4ivARB GL.m_glVertexAttrib4ivARB +#define glVertexAttrib4bvARB GL.m_glVertexAttrib4bvARB +#define glVertexAttrib4ubvARB GL.m_glVertexAttrib4ubvARB +#define glVertexAttrib4usvARB GL.m_glVertexAttrib4usvARB +#define glVertexAttrib4uivARB GL.m_glVertexAttrib4uivARB +#define glVertexAttrib4NbvARB GL.m_glVertexAttrib4NbvARB +#define glVertexAttrib4NsvARB GL.m_glVertexAttrib4NsvARB +#define glVertexAttrib4NivARB GL.m_glVertexAttrib4NivARB +#define glVertexAttrib4NubvARB GL.m_glVertexAttrib4NubvARB +#define glVertexAttrib4NusvARB GL.m_glVertexAttrib4NusvARB +#define glVertexAttrib4NuivARB GL.m_glVertexAttrib4NuivARB +#define glVertexAttribPointerARB GL.m_glVertexAttribPointerARB +#define glEnableVertexAttribArrayARB GL.m_glEnableVertexAttribArrayARB +#define glDisableVertexAttribArrayARB GL.m_glDisableVertexAttribArrayARB #endif -#define glBindAttribLocationARB GlobalOpenGL().m_glBindAttribLocationARB -#define glGetActiveAttribARB GlobalOpenGL().m_glGetActiveAttribARB -#define glGetAttribLocationARB GlobalOpenGL().m_glGetAttribLocationARB +#define glBindAttribLocationARB GL.m_glBindAttribLocationARB +#define glGetActiveAttribARB GL.m_glGetActiveAttribARB +#define glGetAttribLocationARB GL.m_glGetAttribLocationARB #if 0 -#define glGetVertexAttribdvARB GlobalOpenGL().m_glGetVertexAttribdvARB -#define glGetVertexAttribfvARB GlobalOpenGL().m_glGetVertexAttribfvARB -#define glGetVertexAttribivARB GlobalOpenGL().m_glGetVertexAttribivARB -#define glGetVertexAttribPointervARB GlobalOpenGL().m_glGetVertexAttribPointervARB +#define glGetVertexAttribdvARB GL.m_glGetVertexAttribdvARB +#define glGetVertexAttribfvARB GL.m_glGetVertexAttribfvARB +#define glGetVertexAttribivARB GL.m_glGetVertexAttribivARB +#define glGetVertexAttribPointervARB GL.m_glGetVertexAttribPointervARB #endif #endif @@ -1921,40 +1921,40 @@ typedef unsigned int GLhandleARB; #define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E #define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F -#define glAreProgramsResidentNV GlobalOpenGL().m_glAreProgramsResidentNV -#define glBindProgramNV GlobalOpenGL().m_glBindProgramNV -#define glDeleteProgramsNV GlobalOpenGL().m_glDeleteProgramsNV -#define glExecuteProgramNV GlobalOpenGL().m_glExecuteProgramNV -#define glGenProgramsNV GlobalOpenGL().m_glGenProgramsNV -#define glGetProgramParameterdvNV GlobalOpenGL().m_glGetProgramParameterdvNV -#define glGetProgramParameterfvNV GlobalOpenGL().m_glGetProgramParameterfvNV -#define glGetProgramivNV GlobalOpenGL().m_glGetProgramivNV -#define glGetProgramStringNV GlobalOpenGL().m_glGetProgramStringNV -#define glGetTrackMatrixivNV GlobalOpenGL().m_glGetTrackMatrixivNV -#define glGetVertexAttribdvNV GlobalOpenGL().m_glGetVertexAttribdvNV -#define glGetVertexAttribfvNV GlobalOpenGL().m_glGetVertexAttribfvNV -#define glGetVertexAttribivNV GlobalOpenGL().m_glGetVertexAttribivNV -#define glGetVertexAttribPointervNV GlobalOpenGL().m_glGetVertexAttribPointervNV -#define glIsProgramNV GlobalOpenGL().m_glIsProgramNV -#define glLoadProgramNV GlobalOpenGL().m_glLoadProgramNV -#define glProgramParameter4fNV GlobalOpenGL().m_glProgramParameter4fNV -#define glProgramParameter4fvNV GlobalOpenGL().m_glProgramParameter4fvNV -#define glProgramParameters4fvNV GlobalOpenGL().m_glProgramParameters4fvNV -#define glRequestResidentProgramsNV GlobalOpenGL().m_glRequestResidentProgramsNV -#define glTrackMatrixNV GlobalOpenGL().m_glTrackMatrixNV -#define glVertexAttribPointerNV GlobalOpenGL().m_glVertexAttribPointerNV -#define glVertexAttrib1fNV GlobalOpenGL().m_glVertexAttrib1fNV -#define glVertexAttrib1fvNV GlobalOpenGL().m_glVertexAttrib1fvNV -#define glVertexAttrib2fNV GlobalOpenGL().m_glVertexAttrib2fNV -#define glVertexAttrib2fvNV GlobalOpenGL().m_glVertexAttrib2fvNV -#define glVertexAttrib3fNV GlobalOpenGL().m_glVertexAttrib3fNV -#define glVertexAttrib3fvNV GlobalOpenGL().m_glVertexAttrib3fvNV -#define glVertexAttrib4fNV GlobalOpenGL().m_glVertexAttrib4fNV -#define glVertexAttrib4fvNV GlobalOpenGL().m_glVertexAttrib4fvNV -#define glVertexAttribs1fvNV GlobalOpenGL().m_glVertexAttribs1fvNV -#define glVertexAttribs2fvNV GlobalOpenGL().m_glVertexAttribs2fvNV -#define glVertexAttribs3fvNV GlobalOpenGL().m_glVertexAttribs3fvNV -#define glVertexAttribs4fvNV GlobalOpenGL().m_glVertexAttribs4fvNV +#define glAreProgramsResidentNV GL.m_glAreProgramsResidentNV +#define glBindProgramNV GL.m_glBindProgramNV +#define glDeleteProgramsNV GL.m_glDeleteProgramsNV +#define glExecuteProgramNV GL.m_glExecuteProgramNV +#define glGenProgramsNV GL.m_glGenProgramsNV +#define glGetProgramParameterdvNV GL.m_glGetProgramParameterdvNV +#define glGetProgramParameterfvNV GL.m_glGetProgramParameterfvNV +#define glGetProgramivNV GL.m_glGetProgramivNV +#define glGetProgramStringNV GL.m_glGetProgramStringNV +#define glGetTrackMatrixivNV GL.m_glGetTrackMatrixivNV +#define glGetVertexAttribdvNV GL.m_glGetVertexAttribdvNV +#define glGetVertexAttribfvNV GL.m_glGetVertexAttribfvNV +#define glGetVertexAttribivNV GL.m_glGetVertexAttribivNV +#define glGetVertexAttribPointervNV GL.m_glGetVertexAttribPointervNV +#define glIsProgramNV GL.m_glIsProgramNV +#define glLoadProgramNV GL.m_glLoadProgramNV +#define glProgramParameter4fNV GL.m_glProgramParameter4fNV +#define glProgramParameter4fvNV GL.m_glProgramParameter4fvNV +#define glProgramParameters4fvNV GL.m_glProgramParameters4fvNV +#define glRequestResidentProgramsNV GL.m_glRequestResidentProgramsNV +#define glTrackMatrixNV GL.m_glTrackMatrixNV +#define glVertexAttribPointerNV GL.m_glVertexAttribPointerNV +#define glVertexAttrib1fNV GL.m_glVertexAttrib1fNV +#define glVertexAttrib1fvNV GL.m_glVertexAttrib1fvNV +#define glVertexAttrib2fNV GL.m_glVertexAttrib2fNV +#define glVertexAttrib2fvNV GL.m_glVertexAttrib2fvNV +#define glVertexAttrib3fNV GL.m_glVertexAttrib3fNV +#define glVertexAttrib3fvNV GL.m_glVertexAttrib3fvNV +#define glVertexAttrib4fNV GL.m_glVertexAttrib4fNV +#define glVertexAttrib4fvNV GL.m_glVertexAttrib4fvNV +#define glVertexAttribs1fvNV GL.m_glVertexAttribs1fvNV +#define glVertexAttribs2fvNV GL.m_glVertexAttribs2fvNV +#define glVertexAttribs3fvNV GL.m_glVertexAttribs3fvNV +#define glVertexAttribs4fvNV GL.m_glVertexAttribs4fvNV #endif @@ -1971,9 +1971,9 @@ typedef unsigned int GLhandleARB; #define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 #define GL_PROGRAM_ERROR_STRING_NV 0x8874 -#define glProgramNamedParameter4fNV GlobalOpenGL().m_glProgramNamedParameter4fNV -#define glProgramNamedParameter4fvNV GlobalOpenGL().m_glProgramNamedParameter4fvNV -#define glGetProgramNamedParameterfvNV GlobalOpenGL().m_glGetProgramNamedParameterfvNV +#define glProgramNamedParameter4fNV GL.m_glProgramNamedParameter4fNV +#define glProgramNamedParameter4fvNV GL.m_glProgramNamedParameter4fvNV +#define glGetProgramNamedParameterfvNV GL.m_glGetProgramNamedParameterfvNV #endif @@ -1996,17 +1996,21 @@ struct OpenGLBinding } /// \brief Asserts that there no OpenGL errors have occurred since the last call to glGetError. - void ( *assertNoErrors )( const char *file, int line ); + void ( *assertNoErrors_ )( OpenGLBinding &GL, const char *file, int line ); + void assertNoErrors(const char *file, int line) + { + assertNoErrors_(*this, file, line); + } GLFont *m_font; // MUST be set! /// \brief Renders \p string at the current raster-position of the current context. - void drawString( const char* string ) const { - m_font->printString( string ); + void drawString( const char* string ) { + m_font->printString( *this, string ); } /// \brief Renders \p character at the current raster-position of the current context. - void drawChar( char character ) const { + void drawChar( char character ) { char s[2]; s[0] = character; s[1] = 0; @@ -2802,12 +2806,14 @@ template class GlobalModuleRef; typedef GlobalModuleRef GlobalOpenGLModuleRef; -inline OpenGLBinding& GlobalOpenGL(){ - return GlobalOpenGLModule::getTable(); +/// @deprecated +inline OpenGLBinding &GlobalOpenGL() +{ + return GlobalOpenGLModule::getTable(); } #if GDEF_DEBUG -#define GlobalOpenGL_debugAssertNoErrors() GlobalOpenGL().assertNoErrors( __FILE__, __LINE__ ) +#define GlobalOpenGL_debugAssertNoErrors() GL.assertNoErrors( __FILE__, __LINE__ ) #else #define GlobalOpenGL_debugAssertNoErrors() #endif diff --git a/include/iglrender.h b/include/iglrender.h index 04b4a807..636a934f 100644 --- a/include/iglrender.h +++ b/include/iglrender.h @@ -31,9 +31,9 @@ class Matrix4; class GLProgram { public: -virtual void enable() = 0; -virtual void disable() = 0; -virtual void setParameters( const Vector3& viewer, const Matrix4& localToWorld, const Vector3& origin, const Vector3& colour, const Matrix4& world2light ) = 0; +virtual void enable(OpenGLBinding &GL) = 0; +virtual void disable(OpenGLBinding &GL) = 0; +virtual void setParameters( OpenGLBinding &GL, const Vector3& viewer, const Matrix4& localToWorld, const Vector3& origin, const Vector3& colour, const Matrix4& world2light ) = 0; }; class OpenGLFogState diff --git a/include/igtkgl.h b/include/igtkgl.h index b4454564..a4a04be2 100644 --- a/include/igtkgl.h +++ b/include/igtkgl.h @@ -25,6 +25,8 @@ #include #include "generic/constant.h" +struct OpenGLBinding; + template using func = T *; @@ -32,7 +34,7 @@ struct _QERGtkGLTable { STRING_CONSTANT(Name, "gtkgl"); INTEGER_CONSTANT(Version, 1); - func glwidget_new; + func glwidget_new; func glwidget_swap_buffers; func glwidget_make_current; func glwidget_destroy_context; diff --git a/include/irender.h b/include/irender.h index 169d881a..6bdafcdd 100644 --- a/include/irender.h +++ b/include/irender.h @@ -104,11 +104,13 @@ const int c_attr_TexCoord0 = 1; const int c_attr_Tangent = 3; const int c_attr_Binormal = 4; +struct OpenGLBinding; + class OpenGLRenderable { public: virtual ~OpenGLRenderable() = default; -virtual void render( RenderStateFlags state ) const = 0; +virtual void render( OpenGLBinding &GL, RenderStateFlags state ) const = 0; }; class Matrix4; @@ -139,7 +141,7 @@ STRING_CONSTANT( Name, "renderstate" ); virtual Shader* capture( const char* name ) = 0; virtual void release( const char* name ) = 0; /*! Render all Shader objects. */ -virtual void render( RenderStateFlags globalstate, const Matrix4& modelview, const Matrix4& projection, const Vector3& viewer = Vector3( 0, 0, 0 ) ) = 0; +virtual void render( OpenGLBinding &GL, RenderStateFlags globalstate, const Matrix4& modelview, const Matrix4& projection, const Vector3& viewer = Vector3( 0, 0, 0 ) ) = 0; virtual void realise() = 0; virtual void unrealise() = 0; diff --git a/libs/entitylib.h b/libs/entitylib.h index 83f35f02..5c8dba8f 100644 --- a/libs/entitylib.h +++ b/libs/entitylib.h @@ -43,7 +43,7 @@ #include #include -inline void arrow_draw( const Vector3& origin, const Vector3& direction_forward, const Vector3& direction_left, const Vector3& direction_up ){ +inline void arrow_draw( OpenGLBinding &GL, const Vector3& origin, const Vector3& direction_forward, const Vector3& direction_left, const Vector3& direction_up ){ Vector3 endpoint( vector3_added( origin, vector3_scaled( direction_forward, 32.0 ) ) ); Vector3 tip1( vector3_added( vector3_added( endpoint, vector3_scaled( direction_forward, -8.0 ) ), vector3_scaled( direction_up, -4.0 ) ) ); @@ -100,7 +100,7 @@ inline void aabb_testselect( const AABB& aabb, SelectionTest& test, SelectionInt test.TestQuads( VertexPointer( reinterpret_cast( points ), sizeof( Vector3 ) ), IndexPointer( indices, 24 ), best ); } -inline void aabb_draw_wire( const Vector3 points[8] ){ +inline void aabb_draw_wire( OpenGLBinding &GL, const Vector3 points[8] ){ unsigned int indices[26] = { 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, @@ -121,7 +121,7 @@ inline void aabb_draw_wire( const Vector3 points[8] ){ #endif } -inline void aabb_draw_flatshade( const Vector3 points[8] ){ +inline void aabb_draw_flatshade( OpenGLBinding &GL, const Vector3 points[8] ){ glBegin( GL_QUADS ); glNormal3fv( vector3_to_array( aabb_normals[0] ) ); @@ -163,19 +163,19 @@ inline void aabb_draw_flatshade( const Vector3 points[8] ){ glEnd(); } -inline void aabb_draw_wire( const AABB& aabb ){ +inline void aabb_draw_wire( OpenGLBinding &GL, const AABB& aabb ){ Vector3 points[8]; aabb_corners( aabb, points ); - aabb_draw_wire( points ); + aabb_draw_wire( GL, points ); } -inline void aabb_draw_flatshade( const AABB& aabb ){ +inline void aabb_draw_flatshade( OpenGLBinding &GL, const AABB& aabb ){ Vector3 points[8]; aabb_corners( aabb, points ); - aabb_draw_flatshade( points ); + aabb_draw_flatshade( GL, points ); } -inline void aabb_draw_textured( const AABB& aabb ){ +inline void aabb_draw_textured( OpenGLBinding &GL, const AABB& aabb ){ Vector3 points[8]; aabb_corners( aabb, points ); @@ -244,23 +244,23 @@ inline void aabb_draw_textured( const AABB& aabb ){ glEnd(); } -inline void aabb_draw_solid( const AABB& aabb, RenderStateFlags state ){ +inline void aabb_draw_solid( OpenGLBinding &GL, const AABB& aabb, RenderStateFlags state ){ if ( state & RENDER_TEXTURE ) { - aabb_draw_textured( aabb ); + aabb_draw_textured( GL, aabb ); } else { - aabb_draw_flatshade( aabb ); + aabb_draw_flatshade( GL, aabb ); } } -inline void aabb_draw( const AABB& aabb, RenderStateFlags state ){ +inline void aabb_draw( OpenGLBinding &GL, const AABB& aabb, RenderStateFlags state ){ if ( state & RENDER_FILL ) { - aabb_draw_solid( aabb, state ); + aabb_draw_solid( GL, aabb, state ); } else { - aabb_draw_wire( aabb ); + aabb_draw_wire( GL, aabb ); } } @@ -270,8 +270,8 @@ const AABB& m_aabb; public: RenderableSolidAABB( const AABB& aabb ) : m_aabb( aabb ){ } -void render( RenderStateFlags state ) const { - aabb_draw_solid( m_aabb, state ); +void render( OpenGLBinding &GL, RenderStateFlags state ) const { + aabb_draw_solid( GL, m_aabb, state ); } }; @@ -281,8 +281,8 @@ const AABB& m_aabb; public: RenderableWireframeAABB( const AABB& aabb ) : m_aabb( aabb ){ } -void render( RenderStateFlags state ) const { - aabb_draw_wire( m_aabb ); +void render( OpenGLBinding &GL, RenderStateFlags state ) const { + aabb_draw_wire( GL, m_aabb ); } }; diff --git a/libs/generic/callback.h b/libs/generic/callback.h index 577dd9d9..7dc5d85b 100644 --- a/libs/generic/callback.h +++ b/libs/generic/callback.h @@ -346,4 +346,26 @@ inline Callback makeCallbackF(R(*func)(Ts...)) { return BindFirstOpaque>(pVoid); } +template +inline Callback> makeCallbackL(const Lambda &lambda) { + static_assert(sizeof(Lambda) == 1, "lambda must not capture"); + return makeCallbackF(+lambda); +} + +template +inline Callback>> makeCallbackL(get_argument env, const Lambda &lambda) { + static_assert(sizeof(Lambda) == 1, "lambda must not capture"); + using R = get_result_type; + using Env = get_argument; + struct Caller { + using func = R(Env); + static R call(Env env) { + (void) (func *) nullptr; + const Lambda &x = *(const Lambda *) nullptr; + x(env); + } + }; + return makeCallback(Caller(), env); +} + #endif diff --git a/libs/gtkutil/glfont.cpp b/libs/gtkutil/glfont.cpp index 8307f245..5abe8838 100644 --- a/libs/gtkutil/glfont.cpp +++ b/libs/gtkutil/glfont.cpp @@ -25,14 +25,18 @@ // generic string printing with call lists class GLFontCallList : public GLFont { + OpenGLBinding &GL; GLuint m_displayList; int m_pixelHeight; int m_pixelAscent; int m_pixelDescent; public: - GLFontCallList(GLuint displayList, int asc, int desc, int pixelHeight) : m_displayList(displayList), - m_pixelHeight(pixelHeight), - m_pixelAscent(asc), m_pixelDescent(desc) + GLFontCallList(OpenGLBinding &GL, GLuint displayList, int asc, int desc, int pixelHeight) + : GL(GL), + m_displayList(displayList), + m_pixelHeight(pixelHeight), + m_pixelAscent(asc), + m_pixelDescent(desc) { } @@ -43,8 +47,8 @@ public: void printString(const char *s) { - GlobalOpenGL().m_glListBase(m_displayList); - GlobalOpenGL().m_glCallLists(GLsizei(strlen(s)), GL_UNSIGNED_BYTE, reinterpret_cast( s )); + GL.m_glListBase(m_displayList); + GL.m_glCallLists(GLsizei(strlen(s)), GL_UNSIGNED_BYTE, reinterpret_cast( s )); } virtual int getPixelAscent() const @@ -264,7 +268,7 @@ public: // just a hair outside of the viewport (meaning the current raster position is invalid), // then no text will be rendered. The solution to this is a very hacky one. You can search // Google for "glDrawPixels clipping". - virtual void printString(const char *s) + virtual void printString(OpenGLBinding &GL, const char *s) { // The idea for this code initially came from the font-pangoft2.c example that comes with GtkGLExt. @@ -298,41 +302,41 @@ public: bitmap.pixel_mode = FT_PIXEL_MODE_GRAY; pango_ft2_render_layout_subpixel(&bitmap, layout, -log_rect.x, y_offset_bitmap_render_pango_units); - GlobalOpenGL().m_glGetFloatv(GL_CURRENT_COLOR, color); + GL.m_glGetFloatv(GL_CURRENT_COLOR, color); // Save state. I didn't see any OpenGL push/pop operations for these. // Question: Is saving/restoring this state necessary? Being safe. - GlobalOpenGL().m_glGetIntegerv(GL_UNPACK_ALIGNMENT, &previous_unpack_alignment); - previous_blend_enabled = GlobalOpenGL().m_glIsEnabled(GL_BLEND); - GlobalOpenGL().m_glGetIntegerv(GL_BLEND_SRC, &previous_blend_func_src); - GlobalOpenGL().m_glGetIntegerv(GL_BLEND_DST, &previous_blend_func_dst); - GlobalOpenGL().m_glGetFloatv(GL_RED_BIAS, &previous_red_bias); - GlobalOpenGL().m_glGetFloatv(GL_GREEN_BIAS, &previous_green_bias); - GlobalOpenGL().m_glGetFloatv(GL_BLUE_BIAS, &previous_blue_bias); - GlobalOpenGL().m_glGetFloatv(GL_ALPHA_SCALE, &previous_alpha_scale); - - GlobalOpenGL().m_glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - GlobalOpenGL().m_glEnable(GL_BLEND); - GlobalOpenGL().m_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - GlobalOpenGL().m_glPixelTransferf(GL_RED_BIAS, color[0]); - GlobalOpenGL().m_glPixelTransferf(GL_GREEN_BIAS, color[1]); - GlobalOpenGL().m_glPixelTransferf(GL_BLUE_BIAS, color[2]); - GlobalOpenGL().m_glPixelTransferf(GL_ALPHA_SCALE, color[3]); - - GlobalOpenGL().m_glDrawPixels(bitmap.width, bitmap.rows, + GL.m_glGetIntegerv(GL_UNPACK_ALIGNMENT, &previous_unpack_alignment); + previous_blend_enabled = GL.m_glIsEnabled(GL_BLEND); + GL.m_glGetIntegerv(GL_BLEND_SRC, &previous_blend_func_src); + GL.m_glGetIntegerv(GL_BLEND_DST, &previous_blend_func_dst); + GL.m_glGetFloatv(GL_RED_BIAS, &previous_red_bias); + GL.m_glGetFloatv(GL_GREEN_BIAS, &previous_green_bias); + GL.m_glGetFloatv(GL_BLUE_BIAS, &previous_blue_bias); + GL.m_glGetFloatv(GL_ALPHA_SCALE, &previous_alpha_scale); + + GL.m_glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + GL.m_glEnable(GL_BLEND); + GL.m_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + GL.m_glPixelTransferf(GL_RED_BIAS, color[0]); + GL.m_glPixelTransferf(GL_GREEN_BIAS, color[1]); + GL.m_glPixelTransferf(GL_BLUE_BIAS, color[2]); + GL.m_glPixelTransferf(GL_ALPHA_SCALE, color[3]); + + GL.m_glDrawPixels(bitmap.width, bitmap.rows, GL_ALPHA, GL_UNSIGNED_BYTE, begin_bitmap_buffer); g_free(begin_bitmap_buffer); // Restore state in reverse order of how we set it. - GlobalOpenGL().m_glPixelTransferf(GL_ALPHA_SCALE, previous_alpha_scale); - GlobalOpenGL().m_glPixelTransferf(GL_BLUE_BIAS, previous_blue_bias); - GlobalOpenGL().m_glPixelTransferf(GL_GREEN_BIAS, previous_green_bias); - GlobalOpenGL().m_glPixelTransferf(GL_RED_BIAS, previous_red_bias); - GlobalOpenGL().m_glBlendFunc(previous_blend_func_src, previous_blend_func_dst); + GL.m_glPixelTransferf(GL_ALPHA_SCALE, previous_alpha_scale); + GL.m_glPixelTransferf(GL_BLUE_BIAS, previous_blue_bias); + GL.m_glPixelTransferf(GL_GREEN_BIAS, previous_green_bias); + GL.m_glPixelTransferf(GL_RED_BIAS, previous_red_bias); + GL.m_glBlendFunc(previous_blend_func_src, previous_blend_func_dst); if (!previous_blend_enabled) { - GlobalOpenGL().m_glDisable(GL_BLEND); + GL.m_glDisable(GL_BLEND); } - GlobalOpenGL().m_glPixelStorei(GL_UNPACK_ALIGNMENT, previous_unpack_alignment); + GL.m_glPixelStorei(GL_UNPACK_ALIGNMENT, previous_unpack_alignment); } g_object_unref(G_OBJECT(layout)); diff --git a/libs/gtkutil/glfont.h b/libs/gtkutil/glfont.h index ca39a6a8..1dae47c2 100644 --- a/libs/gtkutil/glfont.h +++ b/libs/gtkutil/glfont.h @@ -24,6 +24,8 @@ typedef unsigned int GLuint; +struct OpenGLBinding; + class GLFont { public: virtual int getPixelHeight() const = 0; @@ -32,7 +34,7 @@ public: virtual int getPixelDescent() const = 0; - virtual void printString(const char *s) = 0; + virtual void printString(OpenGLBinding &GL, const char *s) = 0; virtual ~GLFont() { diff --git a/libs/gtkutil/glwidget.cpp b/libs/gtkutil/glwidget.cpp index 52cec49c..bed8631c 100644 --- a/libs/gtkutil/glwidget.cpp +++ b/libs/gtkutil/glwidget.cpp @@ -25,33 +25,33 @@ #include "igl.h" -void (*GLWidget_sharedContextCreated)() = 0; +void (*GLWidget_sharedContextCreated)(OpenGLBinding &GL) = 0; -void (*GLWidget_sharedContextDestroyed)() = 0; +void (*GLWidget_sharedContextDestroyed)(OpenGLBinding &GL) = 0; unsigned int g_context_count = 0; ui::GLArea g_shared{ui::null}; -void _glwidget_context_created(ui::GLArea self, void *data) +void _glwidget_context_created(OpenGLBinding &GL, ui::GLArea self) { if (++g_context_count == 1) { g_shared = self; g_object_ref(g_shared._handle); glwidget_make_current(g_shared); - GlobalOpenGL().contextValid = true; + GL.contextValid = true; - GLWidget_sharedContextCreated(); + GLWidget_sharedContextCreated(GL); } } -void _glwidget_context_destroyed(ui::GLArea self, void *data) +void _glwidget_context_destroyed(OpenGLBinding &GL, ui::GLArea self) { if (--g_context_count == 0) { - GlobalOpenGL().contextValid = false; + GL.contextValid = false; - GLWidget_sharedContextDestroyed(); + GLWidget_sharedContextDestroyed(GL); g_shared.unref(); g_shared = ui::GLArea(ui::null); @@ -92,7 +92,7 @@ bool glwidget_make_current(ui::GLArea self) // glwidget_context_created(self); // } gtk_gl_area_make_current(self); - auto valid = GlobalOpenGL().contextValid; + auto valid = GL.contextValid; return true; } @@ -243,15 +243,15 @@ GdkGLConfig *glconfig_new_with_depth() return gdk_gl_config_new_by_mode((GdkGLConfigMode) (GDK_GL_MODE_RGBA | GDK_GL_MODE_DOUBLE | GDK_GL_MODE_DEPTH)); } -int glwidget_context_created(ui::GLArea self, void *data) +int glwidget_context_created(ui::GLArea self, OpenGLBinding *data) { - _glwidget_context_created(self, data); + _glwidget_context_created(*data, self); return false; } -int glwidget_context_destroyed(ui::GLArea self, void *data) +int glwidget_context_destroyed(ui::GLArea self, OpenGLBinding *data) { - _glwidget_context_destroyed(self, data); + _glwidget_context_destroyed(*data, self); return false; } @@ -274,7 +274,7 @@ bool glwidget_enable_gl(ui::GLArea self, ui::Widget root, gpointer data) return false; } -ui::GLArea glwidget_new(bool zbuffer) +ui::GLArea glwidget_new(OpenGLBinding &GL, bool zbuffer) { auto self = ui::GLArea::from(gtk_drawing_area_new()); @@ -282,8 +282,8 @@ ui::GLArea glwidget_new(bool zbuffer) self.connect("hierarchy-changed", G_CALLBACK(glwidget_enable_gl), 0); - self.connect("realize", G_CALLBACK(glwidget_context_created), 0); - self.connect("unrealize", G_CALLBACK(glwidget_context_destroyed), 0); + self.connect("realize", G_CALLBACK(glwidget_context_created), &GL); + self.connect("unrealize", G_CALLBACK(glwidget_context_destroyed), &GL); return self; } diff --git a/libs/gtkutil/glwidget.h b/libs/gtkutil/glwidget.h index c0bbff4d..428fdec9 100644 --- a/libs/gtkutil/glwidget.h +++ b/libs/gtkutil/glwidget.h @@ -24,11 +24,13 @@ #if !defined( INCLUDED_GTKUTIL_GLWIDGET_H ) #define INCLUDED_GTKUTIL_GLWIDGET_H -extern void (*GLWidget_sharedContextCreated)(); +struct OpenGLBinding; -extern void (*GLWidget_sharedContextDestroyed)(); +extern void (*GLWidget_sharedContextCreated)(OpenGLBinding &GL); -ui::GLArea glwidget_new(bool zbuffer); +extern void (*GLWidget_sharedContextDestroyed)(OpenGLBinding &GL); + +ui::GLArea glwidget_new(OpenGLBinding &GL, bool zbuffer); void glwidget_create_context(ui::GLArea self); diff --git a/libs/pivot.h b/libs/pivot.h index 93cb3549..0a9eed96 100644 --- a/libs/pivot.h +++ b/libs/pivot.h @@ -253,7 +253,7 @@ RenderablePivot(){ m_vertices.push_back( PointVertex( Vertex3f( 0, 0, 16 ), g_colour_z ) ); } -void render( RenderStateFlags state ) const { +void render( OpenGLBinding &GL, RenderStateFlags state ) const { if ( m_vertices.size() == 0 ) { return; } diff --git a/libs/render.h b/libs/render.h index d568edb3..a62be32f 100644 --- a/libs/render.h +++ b/libs/render.h @@ -821,7 +821,7 @@ inline ArbitraryMeshVertex arbitrarymeshvertex_quantised( const ArbitraryMeshVer /// \brief Sets up the OpenGL colour and vertex arrays for \p array. -inline void pointvertex_gl_array( const PointVertex* array ){ +inline void pointvertex_gl_array( OpenGLBinding &GL, const PointVertex* array ){ glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof( PointVertex ), &array->colour ); glVertexPointer( 3, GL_FLOAT, sizeof( PointVertex ), &array->vertex ); } @@ -834,14 +834,14 @@ public: RenderablePointArray( const Array& array, GLenum mode ) : m_array( array ), m_mode( mode ){ } -void render( RenderStateFlags state ) const { +void render( OpenGLBinding &GL, RenderStateFlags state ) const { #define NV_DRIVER_BUG 1 #if NV_DRIVER_BUG glColorPointer( 4, GL_UNSIGNED_BYTE, 0, 0 ); glVertexPointer( 3, GL_FLOAT, 0, 0 ); glDrawArrays( GL_TRIANGLE_FAN, 0, 0 ); #endif - pointvertex_gl_array( m_array.data() ); + pointvertex_gl_array( GL, m_array.data() ); glDrawArrays( m_mode, 0, GLsizei( m_array.size() ) ); } }; @@ -855,8 +855,8 @@ RenderablePointVector( GLenum mode ) : m_mode( mode ){ } -void render( RenderStateFlags state ) const { - pointvertex_gl_array( &m_vector.front() ); +void render( OpenGLBinding &GL, RenderStateFlags state ) const { + pointvertex_gl_array( GL, &m_vector.front() ); glDrawArrays( m_mode, 0, GLsizei( m_vector.size() ) ); } @@ -887,8 +887,8 @@ RenderableVertexBuffer( GLenum mode, const VertexBuffer& vertices ) : m_mode( mode ), m_vertices( vertices ){ } -void render( RenderStateFlags state ) const { - pointvertex_gl_array( m_vertices.data() ); +void render( OpenGLBinding &GL, RenderStateFlags state ) const { + pointvertex_gl_array( GL, m_vertices.data() ); glDrawArrays( m_mode, 0, m_vertices.size() ); } }; @@ -903,9 +903,9 @@ RenderableIndexBuffer( GLenum mode, const IndexBuffer& indices, const VertexBuff : m_mode( mode ), m_indices( indices ), m_vertices( vertices ){ } -void render( RenderStateFlags state ) const { +void render( OpenGLBinding &GL, RenderStateFlags state ) const { #if 1 - pointvertex_gl_array( m_vertices.data() ); + pointvertex_gl_array( GL, m_vertices.data() ); glDrawElements( m_mode, GLsizei( m_indices.size() ), RenderIndexTypeID, m_indices.data() ); #else glBegin( m_mode ); diff --git a/libs/splines/splines.cpp b/libs/splines/splines.cpp index e35d82b7..bc996047 100644 --- a/libs/splines/splines.cpp +++ b/libs/splines/splines.cpp @@ -95,7 +95,7 @@ idCameraDef *g_splineList = &splineList; idVec3 idSplineList::zero( 0,0,0 ); -void glLabeledPoint( idVec3 &color, idVec3 &point, float size, const char *label ) { +void glLabeledPoint( OpenGLBinding &GL, idVec3 &color, idVec3 &point, float size, const char *label ) { glColor3fv( color ); glPointSize( size ); glBegin( GL_POINTS ); @@ -110,7 +110,7 @@ void glLabeledPoint( idVec3 &color, idVec3 &point, float size, const char *label } -void glBox( idVec3 &color, idVec3 &point, float size ) { +void glBox( OpenGLBinding &GL, idVec3 &color, idVec3 &point, float size ) { idVec3 mins( point ); idVec3 maxs( point ); mins[0] -= size; @@ -243,7 +243,7 @@ void idSplineList::buildSpline() { } -void idSplineList::draw( bool editMode ) { +void idSplineList::draw( OpenGLBinding &GL, bool editMode ) { int i; idVec4 yellow( 1, 1, 0, 1 ); @@ -267,7 +267,7 @@ void idSplineList::draw( bool editMode ) { if ( editMode ) { for ( i = 0; i < controlPoints.Num(); i++ ) { - glBox( activeColor, *controlPoints[i], 4 ); + glBox( GL, activeColor, *controlPoints[i], 4 ); } } @@ -292,8 +292,8 @@ void idSplineList::draw( bool editMode ) { if ( count > 0 ) { //assert(activeSegment >=0 && activeSegment < count); if ( activeSegment >= 0 && activeSegment < count ) { - glBox( activeColor, *splinePoints[activeSegment], 6 ); - glBox( yellow, *splinePoints[activeSegment], 8 ); + glBox( GL, activeColor, *splinePoints[activeSegment], 6 ); + glBox( GL, yellow, *splinePoints[activeSegment], 8 ); } } diff --git a/libs/splines/splines.h b/libs/splines/splines.h index 952d93e6..e68632f0 100644 --- a/libs/splines/splines.h +++ b/libs/splines/splines.h @@ -34,8 +34,8 @@ typedef int fileHandle_t; -extern void glBox( idVec3 &color, idVec3 &point, float size ); -extern void glLabeledPoint( idVec3 &color, idVec3 &point, float size, const char *label ); +extern void glBox( OpenGLBinding &GL, idVec3 &color, idVec3 &point, float size ); +extern void glLabeledPoint( OpenGLBinding &GL, idVec3 &color, idVec3 &point, float size, const char *label ); static idVec4 blue( 0, 0, 1, 1 ); static idVec4 red( 1, 0, 0, 1 ); @@ -148,10 +148,10 @@ virtual void updateSelection( const idVec3 &move ) { } } -void drawSelection() { +void drawSelection(OpenGLBinding &GL) { int count = selectedPoints.Num(); for ( int i = 0; i < count; i++ ) { - glBox( red, *getPoint( selectedPoints[i] ), 4 ); + glBox( GL, red, *getPoint( selectedPoints[i] ), 4 ); } } @@ -213,7 +213,7 @@ void initPosition( long startTime, long totalTime ); const idVec3 *getPosition( long time ); -void draw( bool editMode ); +void draw( OpenGLBinding &GL, bool editMode ); void addToRenderer(); void setSelectedPoint( idVec3 *p ); @@ -441,7 +441,7 @@ virtual const idVec3 *getPosition( long t ) { return NULL; } -virtual void draw( bool editMode ) {}; +virtual void draw( OpenGLBinding &GL, bool editMode ) {}; virtual void parse( const char *( *text ) ) {}; virtual void write( fileHandle_t file, const char *name ); @@ -533,8 +533,8 @@ virtual idVec3 *getPoint( int index ) { return &pos; } -virtual void draw( bool editMode ) { - glLabeledPoint( blue, pos, ( editMode ) ? 5 : 3, "Fixed point" ); +virtual void draw( OpenGLBinding &GL, bool editMode ) { + glLabeledPoint( GL, blue, pos, ( editMode ) ? 5 : 3, "Fixed point" ); } protected: @@ -603,9 +603,9 @@ virtual void addPoint( const idVec3 &v ) { } } -virtual void draw( bool editMode ) { - glLabeledPoint( blue, startPos, ( editMode ) ? 5 : 3, "Start interpolated" ); - glLabeledPoint( blue, endPos, ( editMode ) ? 5 : 3, "End interpolated" ); +virtual void draw( OpenGLBinding &GL, bool editMode ) { + glLabeledPoint( GL, blue, startPos, ( editMode ) ? 5 : 3, "Start interpolated" ); + glLabeledPoint( GL, blue, endPos, ( editMode ) ? 5 : 3, "End interpolated" ); glBegin( GL_LINES ); glVertex3fv( startPos ); glVertex3fv( endPos ); @@ -686,8 +686,8 @@ virtual void addPoint( const float x, const float y, const float z ) { target.addPoint( x, y, z ); } -virtual void draw( bool editMode ) { - target.draw( editMode ); +virtual void draw( OpenGLBinding &GL, bool editMode ) { + target.draw( GL, editMode ); } virtual void updateSelection( const idVec3 &move ) { @@ -1012,14 +1012,14 @@ bool getCameraInfo( long time, float *origin, float *direction, float *fv ) { return b; } -void draw( bool editMode ) { +void draw( OpenGLBinding &GL, bool editMode ) { // gcc doesn't allow casting away from bools // why? I've no idea... if ( cameraPosition ) { - cameraPosition->draw( (bool)( ( editMode || cameraRunning ) && cameraEdit ) ); + cameraPosition->draw( GL, (bool)( ( editMode || cameraRunning ) && cameraEdit ) ); int count = targetPositions.Num(); for ( int i = 0; i < count; i++ ) { - targetPositions[i]->draw( (bool)( ( editMode || cameraRunning ) && i == activeTarget && !cameraEdit ) ); + targetPositions[i]->draw( GL, (bool)( ( editMode || cameraRunning ) && i == activeTarget && !cameraEdit ) ); } } } diff --git a/plugins/entity/curve.h b/plugins/entity/curve.h index 43dc9b3b..077e8824 100644 --- a/plugins/entity/curve.h +++ b/plugins/entity/curve.h @@ -39,9 +39,9 @@ class RenderableCurve : public OpenGLRenderable { public: std::vector m_vertices; - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { - pointvertex_gl_array(&m_vertices.front()); + pointvertex_gl_array(GL, &m_vertices.front()); glDrawArrays(GL_LINE_STRIP, 0, GLsizei(m_vertices.size())); } }; diff --git a/plugins/entity/generic.cpp b/plugins/entity/generic.cpp index 8abaf008..c7b3035e 100644 --- a/plugins/entity/generic.cpp +++ b/plugins/entity/generic.cpp @@ -61,10 +61,10 @@ public: { } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { Matrix4 mat = matrix4_rotation_for_euler_xyz_degrees(m_angles); - arrow_draw(m_origin, matrix4_transformed_direction(mat, Vector3(1, 0, 0)), + arrow_draw(GL, m_origin, matrix4_transformed_direction(mat, Vector3(1, 0, 0)), matrix4_transformed_direction(mat, Vector3(0, 1, 0)), matrix4_transformed_direction(mat, Vector3(0, 0, 1))); } diff --git a/plugins/entity/light.cpp b/plugins/entity/light.cpp index 5b1a4055..02ead9ff 100644 --- a/plugins/entity/light.cpp +++ b/plugins/entity/light.cpp @@ -68,7 +68,7 @@ extern bool g_newLightDraw; -void sphere_draw_fill(const Vector3 &origin, float radius, int sides) +void sphere_draw_fill(OpenGLBinding &GL, const Vector3 &origin, float radius, int sides) { if (radius <= 0) { return; @@ -139,7 +139,7 @@ void sphere_draw_fill(const Vector3 &origin, float radius, int sides) glEnd(); } -void sphere_draw_wire(const Vector3 &origin, float radius, int sides) +void sphere_draw_wire(OpenGLBinding &GL, const Vector3 &origin, float radius, int sides) { { glBegin(GL_LINE_LOOP); @@ -193,7 +193,7 @@ void sphere_draw_wire(const Vector3 &origin, float radius, int sides) } } -void light_draw_box_lines(const Vector3 &origin, const Vector3 points[8]) +void light_draw_box_lines(OpenGLBinding &GL, const Vector3 &origin, const Vector3 points[8]) { //draw lines from the center of the bbox to the corners glBegin(GL_LINES); @@ -225,29 +225,29 @@ void light_draw_box_lines(const Vector3 &origin, const Vector3 points[8]) glEnd(); } -void light_draw_radius_wire(const Vector3 &origin, const float envelope[3]) +void light_draw_radius_wire(OpenGLBinding &GL, const Vector3 &origin, const float envelope[3]) { if (envelope[0] > 0) { - sphere_draw_wire(origin, envelope[0], 24); + sphere_draw_wire(GL, origin, envelope[0], 24); } if (envelope[1] > 0) { - sphere_draw_wire(origin, envelope[1], 24); + sphere_draw_wire(GL, origin, envelope[1], 24); } if (envelope[2] > 0) { - sphere_draw_wire(origin, envelope[2], 24); + sphere_draw_wire(GL, origin, envelope[2], 24); } } -void light_draw_radius_fill(const Vector3 &origin, const float envelope[3]) +void light_draw_radius_fill(OpenGLBinding &GL, const Vector3 &origin, const float envelope[3]) { if (envelope[0] > 0) { - sphere_draw_fill(origin, envelope[0], 16); + sphere_draw_fill(GL, origin, envelope[0], 16); } if (envelope[1] > 0) { - sphere_draw_fill(origin, envelope[1], 16); + sphere_draw_fill(GL, origin, envelope[1], 16); } if (envelope[2] > 0) { - sphere_draw_fill(origin, envelope[2], 16); + sphere_draw_fill(GL, origin, envelope[2], 16); } } @@ -266,7 +266,7 @@ void light_vertices(const AABB &aabb_light, Vector3 points[6]) points[5] = Vector3(min[0], mid[1], mid[2]); } -void light_draw(const AABB &aabb_light, RenderStateFlags state) +void light_draw(OpenGLBinding &GL, const AABB &aabb_light, RenderStateFlags state) { Vector3 points[6]; light_vertices(aabb_light, points); @@ -587,9 +587,9 @@ public: { } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { - light_draw_radius_wire(m_origin, m_radii.m_radii); + light_draw_radius_wire(GL, m_origin, m_radii.m_radii); } }; @@ -603,9 +603,9 @@ public: { } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { - light_draw_radius_fill(m_origin, m_radii.m_radii); + light_draw_radius_fill(GL, m_origin, m_radii.m_radii); } }; @@ -619,17 +619,17 @@ public: { } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { //draw the bounding box of light based on light_radius key if ((state & RENDER_FILL) != 0) { - aabb_draw_flatshade(m_points); + aabb_draw_flatshade(GL, m_points); } else { - aabb_draw_wire(m_points); + aabb_draw_wire(GL, m_points); } #if 1 //disable if you dont want lines going from the center of the light bbox to the corners - light_draw_box_lines(m_origin, m_points); + light_draw_box_lines(GL, m_origin, m_points); #endif } }; @@ -646,7 +646,7 @@ public: { } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { glBegin(GL_POINTS); glColor3fv(vector3_to_array(m_eclass.color)); @@ -665,7 +665,7 @@ public: { } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { Matrix4 unproject(matrix4_full_inverse(m_projection)); Vector3 points[8]; @@ -680,7 +680,7 @@ public: points[7] = vector4_projected(matrix4_transformed_vector4(unproject, Vector4(points[7], 1))); // Vector4 test1 = matrix4_transformed_vector4( unproject, Vector4( 0.5f, 0.5f, 0.5f, 1 ) ); // Vector3 test2 = vector4_projected( test1 ); - aabb_draw_wire(points); + aabb_draw_wire(GL, points); } }; @@ -1179,12 +1179,12 @@ public: m_traverseObservers.detach(*observer); } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { if (!g_newLightDraw) { - aabb_draw(m_aabb_light, state); + aabb_draw(GL, m_aabb_light, state); } else { - light_draw(m_aabb_light, state); + light_draw(GL, m_aabb_light, state); } } diff --git a/plugins/entity/namedentity.h b/plugins/entity/namedentity.h index 6d40380a..9fe024c9 100644 --- a/plugins/entity/namedentity.h +++ b/plugins/entity/namedentity.h @@ -100,10 +100,10 @@ public: { } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { glRasterPos3fv(vector3_to_array(m_position)); - GlobalOpenGL().drawString(m_named.name()); + GL.drawString(m_named.name()); } }; diff --git a/plugins/entity/targetable.h b/plugins/entity/targetable.h index dc0270f6..03fa86ea 100644 --- a/plugins/entity/targetable.h +++ b/plugins/entity/targetable.h @@ -52,7 +52,7 @@ public: Vector3 start; Vector3 end; - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { float s1[2], s2[2]; Vector3 dir(vector3_subtracted(end, start)); diff --git a/plugins/md3model/model.h b/plugins/md3model/model.h index ea4f0492..fdb660fe 100644 --- a/plugins/md3model/model.h +++ b/plugins/md3model/model.h @@ -168,7 +168,7 @@ public: } } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { #if 1 if ((state & RENDER_BUMP) != 0) { diff --git a/plugins/model/model.cpp b/plugins/model/model.cpp index 1234c7bd..75191eb0 100644 --- a/plugins/model/model.cpp +++ b/plugins/model/model.cpp @@ -101,7 +101,7 @@ public: ReleaseShader(); } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { if ((state & RENDER_BUMP) != 0) { if (GlobalShaderCache().useShaderLanguage()) { diff --git a/radiant/brush.h b/radiant/brush.h index 6114d59a..be36b775 100644 --- a/radiant/brush.h +++ b/radiant/brush.h @@ -110,13 +110,13 @@ inline bool texdef_sane(const texdef_t &texdef) && fabs(texdef.shift[1]) < (1 << 16); } -inline void Winding_DrawWireframe(const Winding &winding) +inline void Winding_DrawWireframe(OpenGLBinding &GL, const Winding &winding) { glVertexPointer(3, GL_FLOAT, sizeof(WindingVertex), &winding.points.data()->vertex); glDrawArrays(GL_LINE_LOOP, 0, GLsizei(winding.numpoints)); } -inline void Winding_Draw(const Winding &winding, const Vector3 &normal, RenderStateFlags state) +inline void Winding_Draw(OpenGLBinding &GL, const Winding &winding, const Vector3 &normal, RenderStateFlags state) { glVertexPointer(3, GL_FLOAT, sizeof(WindingVertex), &winding.points.data()->vertex); @@ -1070,9 +1070,9 @@ public: m_shader.instanceDetach(); } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { - Winding_Draw(m_winding, m_planeTransformed.plane3().normal(), state); + Winding_Draw(GL, m_winding, m_planeTransformed.plane3().normal(), state); } void updateFiltered() @@ -1468,7 +1468,7 @@ struct EdgeFaces { class RenderableWireframe : public OpenGLRenderable { public: - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { #if 1 glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(PointVertex), &m_vertices->colour); @@ -3128,12 +3128,12 @@ public: } } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { if ((state & RENDER_FILL) != 0) { - Winding_Draw(m_winding, m_plane.normal(), state); + Winding_Draw(GL, m_winding, m_plane.normal(), state); } else { - Winding_DrawWireframe(m_winding); + Winding_DrawWireframe(GL, m_winding); // also draw a line indicating the direction of the cut Vector3 lineverts[2]; diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index a3ead2fd..61784231 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -722,6 +722,7 @@ void Camera_motionDelta(int x, int y, unsigned int state, void *data) } class CamWnd { + OpenGLBinding &GL; View m_view; camera_t m_Camera; RadiantCameraView m_cameraview; @@ -756,7 +757,7 @@ public: guint m_sizeHandler; guint m_exposeHandler; - CamWnd(); + CamWnd(OpenGLBinding &GL); ~CamWnd(); @@ -815,9 +816,9 @@ typedef MemberCaller CamWndQueueDraw; Shader *CamWnd::m_state_select1 = 0; Shader *CamWnd::m_state_select2 = 0; -CamWnd *NewCamWnd() +CamWnd *NewCamWnd(OpenGLBinding &GL) { - return new CamWnd; + return new CamWnd(GL); } void DeleteCamWnd(CamWnd *camwnd) @@ -1293,11 +1294,12 @@ void CamWnd_Remove_Handlers_FreeMove(CamWnd &camwnd) g_signal_handler_disconnect(G_OBJECT(camwnd.m_gl_widget), camwnd.m_freelook_button_press_handler); } -CamWnd::CamWnd() : +CamWnd::CamWnd(OpenGLBinding &GL) : + GL(GL), m_view(true), m_Camera(&m_view, CamWndQueueDraw(*this)), m_cameraview(m_Camera, &m_view, ReferenceCaller(*this)), - m_gl_widget(glwidget_new(TRUE)), + m_gl_widget(glwidget_new(GL, TRUE)), m_window_observer(NewWindowObserver()), m_XORRectangle(m_gl_widget), m_deferredDraw(WidgetQueueDrawCaller(m_gl_widget)), @@ -1562,9 +1564,9 @@ public: m_state_stack.back().m_state->addRenderable(renderable, world, m_state_stack.back().m_lights); } - void render(const Matrix4 &modelview, const Matrix4 &projection) + void render(OpenGLBinding &GL, const Matrix4 &modelview, const Matrix4 &projection) { - GlobalShaderCache().render(m_globalstate, modelview, projection, m_viewer); + GlobalShaderCache().render(GL, m_globalstate, modelview, projection, m_viewer); } }; @@ -1689,7 +1691,7 @@ void CamWnd::Cam_Draw() Scene_Render(renderer, m_view); - renderer.render(m_Camera.modelview, m_Camera.projection); + renderer.render(GL, m_Camera.modelview, m_Camera.projection); } // prepare for 2d stuff @@ -1703,7 +1705,7 @@ void CamWnd::Cam_Draw() glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - if (GlobalOpenGL().GL_1_3()) { + if (GL.GL_1_3()) { glClientActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0); } @@ -1734,14 +1736,14 @@ void CamWnd::Cam_Draw() } if (g_camwindow_globals_private.m_showStats) { - glRasterPos3f(1.0f, static_cast( m_Camera.height ) - GlobalOpenGL().m_font->getPixelDescent(), 0.0f); + glRasterPos3f(1.0f, static_cast( m_Camera.height ) - GL.m_font->getPixelDescent(), 0.0f); extern const char *Renderer_GetStats(); - GlobalOpenGL().drawString(Renderer_GetStats()); + GL.drawString(Renderer_GetStats()); - glRasterPos3f(1.0f, static_cast( m_Camera.height ) - GlobalOpenGL().m_font->getPixelDescent() - - GlobalOpenGL().m_font->getPixelHeight(), 0.0f); + glRasterPos3f(1.0f, static_cast( m_Camera.height ) - GL.m_font->getPixelDescent() - + GL.m_font->getPixelHeight(), 0.0f); extern const char *Cull_GetStats(); - GlobalOpenGL().drawString(Cull_GetStats()); + GL.drawString(Cull_GetStats()); } // bind back to the default texture so that we don't have problems diff --git a/radiant/camwindow.h b/radiant/camwindow.h index 02f1b3bb..0a530493 100644 --- a/radiant/camwindow.h +++ b/radiant/camwindow.h @@ -28,7 +28,9 @@ class CamWnd; -CamWnd *NewCamWnd(); +struct OpenGLBinding; + +CamWnd *NewCamWnd(OpenGLBinding &GL); void DeleteCamWnd(CamWnd *camwnd); diff --git a/radiant/feedback.cpp b/radiant/feedback.cpp index 00b0023f..709d3b30 100644 --- a/radiant/feedback.cpp +++ b/radiant/feedback.cpp @@ -41,9 +41,9 @@ CDbgDlg g_DbgDlg; -void Feedback_draw2D(VIEWTYPE viewType) +void Feedback_draw2D(OpenGLBinding &GL, VIEWTYPE viewType) { - g_DbgDlg.draw2D(viewType); + g_DbgDlg.draw2D(GL, viewType); } void CSelectMsg::saxStartElement(message_info_t *ctx, const xmlChar *name, const xmlChar **attrs) @@ -127,7 +127,7 @@ void CPointMsg::DropHighlight() { } -void CPointMsg::Draw2D(VIEWTYPE vt) +void CPointMsg::Draw2D(OpenGLBinding &GL, VIEWTYPE vt) { int nDim1 = (vt == YZ) ? 1 : 0; int nDim2 = (vt == XY) ? 1 : 2; @@ -197,7 +197,7 @@ void CWindingMsg::DropHighlight() { } -void CWindingMsg::Draw2D(VIEWTYPE vt) +void CWindingMsg::Draw2D(OpenGLBinding &GL, VIEWTYPE vt) { int i; diff --git a/radiant/feedback.h b/radiant/feedback.h index cdb835a0..01b64512 100644 --- a/radiant/feedback.h +++ b/radiant/feedback.h @@ -34,6 +34,8 @@ #include "dialog.h" #include "xywindow.h" +struct OpenGLBinding; + // we use these classes to let plugins draw inside the Radiant windows // 2D window like YZ XZ XY class IGL2DWindow { @@ -46,7 +48,7 @@ public: // Decrement the reference count virtual void DecRef() = 0; - virtual void Draw2D(VIEWTYPE vt) = 0; + virtual void Draw2D(OpenGLBinding &GL, VIEWTYPE vt) = 0; }; // 3D window @@ -134,7 +136,7 @@ public: } } - void Draw2D(VIEWTYPE vt); + void Draw2D(OpenGLBinding &GL, VIEWTYPE vt); }; class CWindingMsg : public ISAXHandler, public IGL2DWindow { @@ -186,7 +188,7 @@ public: } } - void Draw2D(VIEWTYPE vt); + void Draw2D(OpenGLBinding &GL, VIEWTYPE vt); }; @@ -216,10 +218,10 @@ public: void DropHighlight(); - void draw2D(VIEWTYPE viewType) + void draw2D(OpenGLBinding &GL, VIEWTYPE viewType) { if (m_pDraw2D != 0) { - m_pDraw2D->Draw2D(viewType); + m_pDraw2D->Draw2D(GL, viewType); } } @@ -236,6 +238,6 @@ protected: extern CDbgDlg g_DbgDlg; -void Feedback_draw2D(VIEWTYPE viewType); +void Feedback_draw2D(OpenGLBinding &GL, VIEWTYPE viewType); #endif diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 286bb076..fa0b686e 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -430,7 +430,7 @@ void about_button_issues(ui::Widget widget, gpointer data) OpenURL(cred.c_str()); } -void DoAbout() +void DoAbout(OpenGLBinding &GL) { ModalDialog dialog; ModalDialogButton ok_button(dialog, eIDOK); diff --git a/radiant/gtkdlgs.h b/radiant/gtkdlgs.h index fa8ac889..9038b8c4 100644 --- a/radiant/gtkdlgs.h +++ b/radiant/gtkdlgs.h @@ -51,7 +51,8 @@ void DoFind(); void DoSides(int type, int axis); -void DoAbout(); +struct OpenGLBinding; +void DoAbout(OpenGLBinding &GL); #if GDEF_OS_WINDOWS diff --git a/radiant/main.cpp b/radiant/main.cpp index 006842a9..02898344 100644 --- a/radiant/main.cpp +++ b/radiant/main.cpp @@ -61,6 +61,7 @@ */ +#include #include "main.h" #include "globaldefs.h" @@ -650,8 +651,8 @@ int main(int argc, char *argv[]) user_shortcuts_init(); - g_pParentWnd = 0; - g_pParentWnd = new MainFrame(); + OpenGLBinding &GL = GlobalOpenGLModule::getTable(); + g_pParentWnd = new MainFrame(GL); hide_splash(); diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 36794f83..dda980b0 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2449,7 +2449,7 @@ ui::MenuItem create_patch_menu() return patch_menu_item; } -ui::MenuItem create_help_menu() +ui::MenuItem create_help_menu(OpenGLBinding &GL) { // Help menu auto help_menu_item = new_sub_menu_item_with_mnemonic("_Help"); @@ -2466,12 +2466,14 @@ ui::MenuItem create_help_menu() create_menu_item_with_mnemonic(menu, "Bug report", makeCallbackF(OpenBugReportURL)); create_menu_item_with_mnemonic(menu, "Shortcuts list", makeCallbackF(DoCommandListDlg)); - create_menu_item_with_mnemonic(menu, "_About", makeCallbackF(DoAbout)); + create_menu_item_with_mnemonic(menu, "_About", makeCallbackL(GL, [](OpenGLBinding &GL) { + DoAbout(GL); + })); return help_menu_item; } -ui::MenuBar create_main_menu(MainFrame::EViewStyle style) +ui::MenuBar create_main_menu(MainFrame::EViewStyle style, OpenGLBinding &GL) { auto menu_bar = ui::MenuBar::from(gtk_menu_bar_new()); menu_bar.show(); @@ -2487,7 +2489,7 @@ ui::MenuBar create_main_menu(MainFrame::EViewStyle style) menu_bar.add(create_brush_menu()); menu_bar.add(create_patch_menu()); menu_bar.add(create_plugins_menu()); - menu_bar.add(create_help_menu()); + menu_bar.add(create_help_menu(GL)); return menu_bar; } @@ -2846,7 +2848,7 @@ ui::Window MainFrame_getWindow() std::vector g_floating_windows; -MainFrame::MainFrame() : m_idleRedrawStatusText(RedrawStatusTextCaller(*this)) +MainFrame::MainFrame(OpenGLBinding &GL) : m_idleRedrawStatusText(RedrawStatusTextCaller(*this)) { m_pXYWnd = 0; m_pCamWnd = 0; @@ -2861,7 +2863,7 @@ MainFrame::MainFrame() : m_idleRedrawStatusText(RedrawStatusTextCaller(*this)) m_bSleeping = false; - Create(); + Create(GL); } MainFrame::~MainFrame() @@ -3048,7 +3050,7 @@ static gint mainframe_delete(ui::Widget widget, GdkEvent *event, gpointer data) return TRUE; } -void MainFrame::Create() +void MainFrame::Create(OpenGLBinding &GL) { ui::Window window = ui::Window(ui::window_type::TOP); @@ -3090,7 +3092,7 @@ void MainFrame::Create() register_shortcuts(); - auto main_menu = create_main_menu(CurrentStyle()); + auto main_menu = create_main_menu(CurrentStyle(), GL); vbox.pack_start(main_menu, FALSE, FALSE, 0); auto main_toolbar = create_main_toolbar(CurrentStyle()); @@ -3151,7 +3153,7 @@ void MainFrame::Create() gtk_paned_add1(GTK_PANED(vsplit), hsplit); // xy - m_pXYWnd = new XYWnd(); + m_pXYWnd = new XYWnd(GL); m_pXYWnd->SetViewType(XY); ui::Widget xy_window = ui::Widget(create_framed_widget(m_pXYWnd->GetWidget())); @@ -3170,7 +3172,7 @@ void MainFrame::Create() // camera - m_pCamWnd = NewCamWnd(); + m_pCamWnd = NewCamWnd(GL); GlobalCamera_setCamWnd(*m_pCamWnd); CamWnd_setParent(*m_pCamWnd, window); auto camera_window = create_framed_widget(CamWnd_getWidget(*m_pCamWnd)); @@ -3178,7 +3180,7 @@ void MainFrame::Create() gtk_paned_add1(GTK_PANED(vsplit2), camera_window); // textures - auto texture_window = create_framed_widget(TextureBrowser_constructWindow(window)); + auto texture_window = create_framed_widget(TextureBrowser_constructWindow(window, GL)); gtk_paned_add2(GTK_PANED(vsplit2), texture_window); } @@ -3202,7 +3204,7 @@ void MainFrame::Create() window.show(); - m_pCamWnd = NewCamWnd(); + m_pCamWnd = NewCamWnd(GL); GlobalCamera_setCamWnd(*m_pCamWnd); { @@ -3219,7 +3221,7 @@ void MainFrame::Create() global_accel_connect_window(window); g_posXYWnd.connect(window); - m_pXYWnd = new XYWnd(); + m_pXYWnd = new XYWnd(GL); m_pXYWnd->m_parent = window; m_pXYWnd->SetViewType(XY); @@ -3238,7 +3240,7 @@ void MainFrame::Create() global_accel_connect_window(window); g_posXZWnd.connect(window); - m_pXZWnd = new XYWnd(); + m_pXZWnd = new XYWnd(GL); m_pXZWnd->m_parent = window; m_pXZWnd->SetViewType(XZ); @@ -3257,7 +3259,7 @@ void MainFrame::Create() global_accel_connect_window(window); g_posYZWnd.connect(window); - m_pYZWnd = new XYWnd(); + m_pYZWnd = new XYWnd(GL); m_pYZWnd->m_parent = window; m_pYZWnd->SetViewType(YZ); @@ -3272,30 +3274,30 @@ void MainFrame::Create() } { - auto frame = create_framed_widget(TextureBrowser_constructWindow(GroupDialog_getWindow())); + auto frame = create_framed_widget(TextureBrowser_constructWindow(GroupDialog_getWindow(), GL)); g_page_textures = GroupDialog_addPage("Textures", frame, TextureBrowserExportTitleCaller()); } GroupDialog_show(); } else // 4 way { - m_pCamWnd = NewCamWnd(); + m_pCamWnd = NewCamWnd(GL); GlobalCamera_setCamWnd(*m_pCamWnd); CamWnd_setParent(*m_pCamWnd, window); ui::Widget camera = CamWnd_getWidget(*m_pCamWnd); - m_pYZWnd = new XYWnd(); + m_pYZWnd = new XYWnd(GL); m_pYZWnd->SetViewType(YZ); ui::Widget yz = m_pYZWnd->GetWidget(); - m_pXYWnd = new XYWnd(); + m_pXYWnd = new XYWnd(GL); m_pXYWnd->SetViewType(XY); ui::Widget xy = m_pXYWnd->GetWidget(); - m_pXZWnd = new XYWnd(); + m_pXZWnd = new XYWnd(GL); m_pXZWnd->SetViewType(XZ); ui::Widget xz = m_pXZWnd->GetWidget(); @@ -3304,7 +3306,7 @@ void MainFrame::Create() vbox.pack_start(split, TRUE, TRUE, 0); { - auto frame = create_framed_widget(TextureBrowser_constructWindow(window)); + auto frame = create_framed_widget(TextureBrowser_constructWindow(window, GL)); g_page_textures = GroupDialog_addPage("Textures", frame, TextureBrowserExportTitleCaller()); } } @@ -3440,7 +3442,7 @@ void GridStatus_onTextureLockEnabledChanged() } } -void GlobalGL_sharedContextCreated() +void GlobalGL_sharedContextCreated(OpenGLBinding &GL) { GLFont *g_font = NULL; @@ -3451,12 +3453,12 @@ void GlobalGL_sharedContextCreated() const auto extensions = reinterpret_cast( glGetString(GL_EXTENSIONS)); globalOutputStream() << "GL_EXTENSIONS: " << (extensions ? extensions : "") << "\n"; - QGL_sharedContextCreated(GlobalOpenGL()); + QGL_sharedContextCreated(GL); - ShaderCache_extensionsInitialised(); + ShaderCache_extensionsInitialised(GL); GlobalShaderCache().realise(); - Textures_Realise(); + Textures_Realise(GL); #if GDEF_OS_WINDOWS /* win32 is dodgy here, just use courier new then */ @@ -3468,15 +3470,15 @@ void GlobalGL_sharedContextCreated() g_font = glfont_create(fontname); #endif - GlobalOpenGL().m_font = g_font; + GL.m_font = g_font; } -void GlobalGL_sharedContextDestroyed() +void GlobalGL_sharedContextDestroyed(OpenGLBinding &GL) { - Textures_Unrealise(); + Textures_Unrealise(GL); GlobalShaderCache().unrealise(); - QGL_sharedContextDestroyed(GlobalOpenGL()); + QGL_sharedContextDestroyed(GL); } diff --git a/radiant/mainframe.h b/radiant/mainframe.h index 6ff808da..acfb054b 100644 --- a/radiant/mainframe.h +++ b/radiant/mainframe.h @@ -48,6 +48,8 @@ const int c_texture_status = 3; const int c_grid_status = 4; const int c_count_status = 5; +struct OpenGLBinding; + class MainFrame { public: enum EViewStyle { @@ -57,7 +59,7 @@ public: eRegularLeft = 3, }; - MainFrame(); + MainFrame(OpenGLBinding &GL); ~MainFrame(); @@ -70,7 +72,7 @@ public: CopiedString m_grid_status; private: - void Create(); + void Create(OpenGLBinding &GL); void SaveWindowInfo(); diff --git a/radiant/map.cpp b/radiant/map.cpp index adf69f46..7ef959b5 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -456,7 +456,8 @@ void RemoveRegionBrushes(void); */ void Map_Free() { - Pointfile_Clear(); + OpenGLBinding &GL = GlobalOpenGL(); + Pointfile_Clear(GL); g_map.m_resource->detach(g_map); GlobalReferenceCache().release(g_map.m_name.c_str()); @@ -1294,7 +1295,8 @@ void Map_Rename(const char *filename) bool Map_Save() { - Pointfile_Clear(); + OpenGLBinding &GL = GlobalOpenGL(); + Pointfile_Clear(GL); ScopeTimer timer("map save"); SaveReferences(); diff --git a/radiant/patch.cpp b/radiant/patch.cpp index c48cb44a..844a03c5 100644 --- a/radiant/patch.cpp +++ b/radiant/patch.cpp @@ -1432,7 +1432,7 @@ void Patch::ConstructPrefab(const AABB &aabb, EPatchPrefab eType, int axis, std: NaturalTexture(); } -void Patch::RenderDebug(RenderStateFlags state) const +void Patch::RenderDebug(OpenGLBinding &GL, RenderStateFlags state) const { for (std::size_t i = 0; i < m_tess.m_numStrips; i++) { glBegin(GL_QUAD_STRIP); @@ -1448,7 +1448,7 @@ void Patch::RenderDebug(RenderStateFlags state) const } } -void RenderablePatchSolid::RenderNormals() const +void RenderablePatchSolid::RenderNormals(OpenGLBinding &GL) const { const std::size_t width = m_tess.m_numStrips + 1; const std::size_t height = m_tess.m_lenStrips >> 1; diff --git a/radiant/patch.h b/radiant/patch.h index 3ab56d44..d97c4b4d 100644 --- a/radiant/patch.h +++ b/radiant/patch.h @@ -209,7 +209,7 @@ public: { } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { { #if NV_DRIVER_BUG @@ -265,7 +265,7 @@ public: { } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { glVertexPointer(3, GL_FLOAT, sizeof(ArbitraryMeshVertex), &m_tess.m_vertices.data()->vertex); const RenderIndex *strip_indices = m_tess.m_indices.data(); @@ -282,9 +282,9 @@ public: { } - void RenderNormals() const; + void RenderNormals(OpenGLBinding &GL) const; - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { #if 0 if ( ( state & RENDER_FILL ) == 0 ) { @@ -324,7 +324,7 @@ public: } #if GDEF_DEBUG - RenderNormals(); + RenderNormals(GL); #endif } }; @@ -762,7 +762,7 @@ public: } - void RenderDebug(RenderStateFlags state) const; + void RenderDebug(OpenGLBinding &GL, RenderStateFlags state) const; void RenderNormals(RenderStateFlags state) const; diff --git a/radiant/points.cpp b/radiant/points.cpp index 6e29109c..f47c02f3 100644 --- a/radiant/points.cpp +++ b/radiant/points.cpp @@ -76,7 +76,7 @@ public: void PushPoint(const Vector3 &v); - void GenerateDisplayList(); + void GenerateDisplayList(OpenGLBinding &GL); // SAX interface void Release() @@ -109,11 +109,11 @@ public: return m_displaylist != 0; } - void show(bool show) + void show(OpenGLBinding &GL, bool show) { if (show && !shown()) { Pointfile_Parse(*this); - GenerateDisplayList(); + GenerateDisplayList(GL); SceneChangeNotify(); } else if (!show && shown()) { glDeleteLists(m_displaylist, 1); @@ -122,7 +122,7 @@ public: } } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { glCallList(m_displaylist); } @@ -177,7 +177,7 @@ void CPointfile::PushPoint(const Vector3 &v) } // create the display list at the end -void CPointfile::GenerateDisplayList() +void CPointfile::GenerateDisplayList(OpenGLBinding &GL) { m_displaylist = glGenLists(1); @@ -342,14 +342,15 @@ void Pointfile_Parse(CPointfile &pointfile) g_free(text); } -void Pointfile_Clear() +void Pointfile_Clear(OpenGLBinding &GL) { - s_pointfile.show(false); + s_pointfile.show(GL, false); } void Pointfile_Toggle() { - s_pointfile.show(!s_pointfile.shown()); + OpenGLBinding &GL = GlobalOpenGL(); + s_pointfile.show(GL, !s_pointfile.shown()); s_check_point = s_pointfile.begin(); } @@ -391,7 +392,8 @@ void CPointfile::saxEndElement(message_info_t *ctx, const xmlChar *name) { if (string_equal(reinterpret_cast( name ), "polyline")) { // we are done - GenerateDisplayList(); + OpenGLBinding &GL = GlobalOpenGL(); + GenerateDisplayList(GL); SceneChangeNotify(); s_check_point = begin(); } else if (string_equal(reinterpret_cast( name ), "point")) { diff --git a/radiant/points.h b/radiant/points.h index 449af54f..83fd9796 100644 --- a/radiant/points.h +++ b/radiant/points.h @@ -28,7 +28,9 @@ #if !defined( INCLUDED_POINTS_H ) #define INCLUDED_POINTS_H -void Pointfile_Clear(); +struct OpenGLBinding; + +void Pointfile_Clear(OpenGLBinding &GL); void Pointfile_Delete(void); diff --git a/radiant/qgl.cpp b/radiant/qgl.cpp index 2a8297c9..229622c9 100644 --- a/radiant/qgl.cpp +++ b/radiant/qgl.cpp @@ -129,7 +129,7 @@ void glInvalidFunction() #define EXTENSIONS_ENABLED 1 -bool QGL_ExtensionSupported(const char *extension) +bool QGL_ExtensionSupported(OpenGLBinding &GL, const char *extension) { #if EXTENSIONS_ENABLED const GLubyte *extensions = 0; @@ -142,7 +142,7 @@ bool QGL_ExtensionSupported(const char *extension) return false; } - extensions = GlobalOpenGL().m_glGetString(GL_EXTENSIONS); + extensions = GL.m_glGetString(GL_EXTENSIONS); #if !GDEF_OS_MACOS if (!extensions) { return false; @@ -576,12 +576,12 @@ int g_qglMajorVersion = 0; int g_qglMinorVersion = 0; // requires a valid gl context -void QGL_InitVersion() +void QGL_InitVersion(OpenGLBinding &GL) { #if EXTENSIONS_ENABLED const std::size_t versionSize = 256; char version[versionSize]; - strncpy(version, reinterpret_cast( GlobalOpenGL().m_glGetString(GL_VERSION)), versionSize - 1); + strncpy(version, reinterpret_cast( GL.m_glGetString(GL_VERSION)), versionSize - 1); version[versionSize - 1] = '\0'; char *firstDot = strchr(version, '.'); ASSERT_NOTNULL(firstDot); @@ -613,7 +613,7 @@ float QGL_maxTextureAnisotropy() void QGL_sharedContextCreated(OpenGLBinding &table) { - QGL_InitVersion(); + QGL_InitVersion(table); table.major_version = g_qglMajorVersion; table.minor_version = g_qglMinorVersion; @@ -955,7 +955,7 @@ void QGL_sharedContextCreated(OpenGLBinding &table) table.m_glVertexPointer = glVertexPointer; table.m_glViewport = glViewport; - if (QGL_ExtensionSupported("GL_ARB_multitexture")) { + if (QGL_ExtensionSupported(table, "GL_ARB_multitexture")) { table.support_ARB_multitexture = QGL_constructExtensionFunc(table.m_glActiveTextureARB, "glActiveTextureARB") && QGL_constructExtensionFunc(table.m_glClientActiveTextureARB, "glClientActiveTextureARB") @@ -999,7 +999,7 @@ void QGL_sharedContextCreated(OpenGLBinding &table) table.support_ARB_multitexture = false; } - if (QGL_ExtensionSupported("GL_ARB_texture_compression")) { + if (QGL_ExtensionSupported(table, "GL_ARB_texture_compression")) { table.support_ARB_texture_compression = QGL_constructExtensionFunc(table.m_glCompressedTexImage3DARB, "glCompressedTexImage3DARB") && QGL_constructExtensionFunc(table.m_glCompressedTexImage2DARB, "glCompressedTexImage2DARB") @@ -1016,7 +1016,7 @@ void QGL_sharedContextCreated(OpenGLBinding &table) table.support_ARB_texture_compression = false; } - table.support_EXT_texture_compression_s3tc = QGL_ExtensionSupported("GL_EXT_texture_compression_s3tc"); + table.support_EXT_texture_compression_s3tc = QGL_ExtensionSupported(table, "GL_EXT_texture_compression_s3tc"); // GL 1.2 if (table.major_version > 1 || table.minor_version >= 2) { @@ -1177,7 +1177,7 @@ void QGL_sharedContextCreated(OpenGLBinding &table) } - if (QGL_ExtensionSupported("GL_ARB_vertex_program")) { + if (QGL_ExtensionSupported(table, "GL_ARB_vertex_program")) { table.support_ARB_vertex_program = QGL_constructExtensionFunc(table.m_glVertexAttrib1sARB, "glVertexAttrib1sARB") && QGL_constructExtensionFunc(table.m_glVertexAttrib1fARB, "glVertexAttrib1fARB") @@ -1252,9 +1252,9 @@ void QGL_sharedContextCreated(OpenGLBinding &table) } - table.support_ARB_fragment_program = QGL_ExtensionSupported("GL_ARB_fragment_program"); + table.support_ARB_fragment_program = QGL_ExtensionSupported(table, "GL_ARB_fragment_program"); - if (QGL_ExtensionSupported("GL_ARB_shader_objects")) { + if (QGL_ExtensionSupported(table, "GL_ARB_shader_objects")) { table.support_ARB_shader_objects = QGL_constructExtensionFunc(table.m_glDeleteObjectARB, "glDeleteObjectARB") && QGL_constructExtensionFunc(table.m_glGetHandleARB, "glGetHandleARB") @@ -1303,7 +1303,7 @@ void QGL_sharedContextCreated(OpenGLBinding &table) table.support_ARB_shader_objects = false; } - if (QGL_ExtensionSupported("GL_ARB_vertex_shader")) { + if (QGL_ExtensionSupported(table, "GL_ARB_vertex_shader")) { table.support_ARB_vertex_shader = QGL_constructExtensionFunc(table.m_glVertexAttrib1fARB, "glVertexAttrib1fARB") && QGL_constructExtensionFunc(table.m_glVertexAttrib1sARB, "glVertexAttrib1sARB") @@ -1359,7 +1359,7 @@ void QGL_sharedContextCreated(OpenGLBinding &table) table.support_ARB_vertex_shader = false; } - if (QGL_ExtensionSupported("GL_NV_vertex_program2")) { + if (QGL_ExtensionSupported(table, "GL_NV_vertex_program2")) { table.support_NV_vertex_program2 = QGL_constructExtensionFunc(table.m_glAreProgramsResidentNV, "glAreProgramsResidentNV") && QGL_constructExtensionFunc(table.m_glBindProgramNV, "glBindProgramNV") @@ -1437,7 +1437,7 @@ void QGL_sharedContextCreated(OpenGLBinding &table) QGL_invalidateExtensionFunc(table.m_glVertexAttribs4fvNV); } - if (QGL_ExtensionSupported("GL_NV_fragment_program")) { + if (QGL_ExtensionSupported(table, "GL_NV_fragment_program")) { table.support_NV_fragment_program = QGL_constructExtensionFunc(table.m_glProgramNamedParameter4fNV, "glProgramNamedParameter4fNV") && QGL_constructExtensionFunc(table.m_glProgramNamedParameter4fvNV, "glProgramNamedParameter4fvNV") @@ -1450,10 +1450,10 @@ void QGL_sharedContextCreated(OpenGLBinding &table) table.support_NV_fragment_program = false; } - table.support_ARB_fragment_shader = QGL_ExtensionSupported("GL_ARB_fragment_shader"); - table.support_ARB_shading_language_100 = QGL_ExtensionSupported("GL_ARB_shading_language_100"); + table.support_ARB_fragment_shader = QGL_ExtensionSupported(table, "GL_ARB_fragment_shader"); + table.support_ARB_shading_language_100 = QGL_ExtensionSupported(table, "GL_ARB_shading_language_100"); - if (QGL_ExtensionSupported("GL_EXT_texture_filter_anisotropic")) { + if (QGL_ExtensionSupported(table, "GL_EXT_texture_filter_anisotropic")) { glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &g_maxTextureAnisotropy); globalOutputStream() << "Anisotropic filtering possible (max " << g_maxTextureAnisotropy << "x)\n"; } else { @@ -1468,9 +1468,9 @@ void QGL_sharedContextDestroyed(OpenGLBinding &table) } -void QGL_assertNoErrors(const char *file, int line) +void QGL_assertNoErrors(OpenGLBinding &GL, const char *file, int line) { - GLenum error = GlobalOpenGL().m_glGetError(); + GLenum error = GL.m_glGetError(); while (error != GL_NO_ERROR) { const char *errorString = reinterpret_cast( qgluErrorString(error)); if (error == GL_OUT_OF_MEMORY) { @@ -1478,7 +1478,7 @@ void QGL_assertNoErrors(const char *file, int line) } else { ERROR_MESSAGE("OpenGL error at " << file << ":" << line << ": " << errorString); } - error = GlobalOpenGL().m_glGetError(); + error = GL.m_glGetError(); } } @@ -1494,7 +1494,7 @@ public: { QGL_Init(m_qgl); - m_qgl.assertNoErrors = &QGL_assertNoErrors; + m_qgl.assertNoErrors_ = &QGL_assertNoErrors; } ~QglAPI() diff --git a/radiant/qgl.h b/radiant/qgl.h index 9d808528..de11a8c6 100644 --- a/radiant/qgl.h +++ b/radiant/qgl.h @@ -28,7 +28,7 @@ void QGL_sharedContextCreated(OpenGLBinding &table); void QGL_sharedContextDestroyed(OpenGLBinding &table); -bool QGL_ExtensionSupported(const char *extension); +bool QGL_ExtensionSupported(OpenGLBinding &GL, const char *extension); float QGL_maxTextureAnisotropy(); diff --git a/radiant/renderstate.cpp b/radiant/renderstate.cpp index faa04502..ee681b5d 100644 --- a/radiant/renderstate.cpp +++ b/radiant/renderstate.cpp @@ -132,7 +132,7 @@ const char *Renderer_GetStats() } -void printShaderLog(GLhandleARB object) +void printShaderLog(OpenGLBinding &GL, GLhandleARB object) { GLint log_length = 0; glGetObjectParameterivARB(object, GL_OBJECT_INFO_LOG_LENGTH_ARB, &log_length); @@ -143,7 +143,7 @@ void printShaderLog(GLhandleARB object) globalErrorStream() << StringRange(log.begin(), log.begin() + log_length) << "\n"; } -void createShader(GLhandleARB program, const char *filename, GLenum type) +void createShader(OpenGLBinding &GL, GLhandleARB program, const char *filename, GLenum type) { GLhandleARB shader = glCreateShaderObjectARB(type); GlobalOpenGL_debugAssertNoErrors(); @@ -169,7 +169,7 @@ void createShader(GLhandleARB program, const char *filename, GLenum type) glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &compiled); if (!compiled) { - printShaderLog(shader); + printShaderLog(GL, shader); } ASSERT_MESSAGE(compiled, "shader compile failed: " << makeQuoted(filename)); @@ -183,7 +183,7 @@ void createShader(GLhandleARB program, const char *filename, GLenum type) GlobalOpenGL_debugAssertNoErrors(); } -void GLSLProgram_link(GLhandleARB program) +void GLSLProgram_link(OpenGLBinding &GL, GLhandleARB program) { glLinkProgramARB(program); @@ -191,13 +191,13 @@ void GLSLProgram_link(GLhandleARB program) glGetObjectParameterivARB(program, GL_OBJECT_LINK_STATUS_ARB, &linked); if (!linked) { - printShaderLog(program); + printShaderLog(GL, program); } ASSERT_MESSAGE(linked, "program link failed"); } -void GLSLProgram_validate(GLhandleARB program) +void GLSLProgram_validate(OpenGLBinding &GL, GLhandleARB program) { glValidateProgramARB(program); @@ -205,7 +205,7 @@ void GLSLProgram_validate(GLhandleARB program) glGetObjectParameterivARB(program, GL_OBJECT_VALIDATE_STATUS_ARB, &validated); if (!validated) { - printShaderLog(program); + printShaderLog(GL, program); } ASSERT_MESSAGE(validated, "program validation failed"); @@ -229,7 +229,7 @@ public: { } - void create() + void create(OpenGLBinding &GL) { // create program m_program = glCreateProgramObjectARB(); @@ -238,14 +238,14 @@ public: { StringOutputStream filename(256); filename << GlobalRadiant().getAppPath() << "gl/lighting_DBS_omni_vp.glsl"; - createShader(m_program, filename.c_str(), GL_VERTEX_SHADER_ARB); + createShader(GL, m_program, filename.c_str(), GL_VERTEX_SHADER_ARB); filename.clear(); filename << GlobalRadiant().getAppPath() << "gl/lighting_DBS_omni_fp.glsl"; - createShader(m_program, filename.c_str(), GL_FRAGMENT_SHADER_ARB); + createShader(GL, m_program, filename.c_str(), GL_FRAGMENT_SHADER_ARB); } - GLSLProgram_link(m_program); - GLSLProgram_validate(m_program); + GLSLProgram_link(GL, m_program); + GLSLProgram_validate(GL, m_program); glUseProgramObjectARB(m_program); @@ -270,13 +270,13 @@ public: GlobalOpenGL_debugAssertNoErrors(); } - void destroy() + void destroy(OpenGLBinding &GL) { glDeleteObjectARB(m_program); m_program = 0; } - void enable() + void enable(OpenGLBinding &GL) { glUseProgramObjectARB(m_program); @@ -290,7 +290,7 @@ public: g_bumpGLSLPass_enabled = true; } - void disable() + void disable(OpenGLBinding &GL) { glUseProgramObjectARB(0); @@ -304,7 +304,7 @@ public: g_bumpGLSLPass_enabled = false; } - void setParameters(const Vector3 &viewer, const Matrix4 &localToWorld, const Vector3 &origin, const Vector3 &colour, + void setParameters(OpenGLBinding &GL, const Vector3 &viewer, const Matrix4 &localToWorld, const Vector3 &origin, const Vector3 &colour, const Matrix4 &world2light) { Matrix4 world2local(localToWorld); @@ -343,7 +343,7 @@ class GLSLDepthFillProgram : public GLProgram { public: GLhandleARB m_program; - void create() + void create(OpenGLBinding &GL) { // create program m_program = glCreateProgramObjectARB(); @@ -352,25 +352,25 @@ public: { StringOutputStream filename(256); filename << GlobalRadiant().getAppPath() << "gl/zfill_vp.glsl"; - createShader(m_program, filename.c_str(), GL_VERTEX_SHADER_ARB); + createShader(GL, m_program, filename.c_str(), GL_VERTEX_SHADER_ARB); filename.clear(); filename << GlobalRadiant().getAppPath() << "gl/zfill_fp.glsl"; - createShader(m_program, filename.c_str(), GL_FRAGMENT_SHADER_ARB); + createShader(GL, m_program, filename.c_str(), GL_FRAGMENT_SHADER_ARB); } - GLSLProgram_link(m_program); - GLSLProgram_validate(m_program); + GLSLProgram_link(GL, m_program); + GLSLProgram_validate(GL, m_program); GlobalOpenGL_debugAssertNoErrors(); } - void destroy() + void destroy(OpenGLBinding &GL) { glDeleteObjectARB(m_program); m_program = 0; } - void enable() + void enable(OpenGLBinding &GL) { glUseProgramObjectARB(m_program); GlobalOpenGL_debugAssertNoErrors(); @@ -378,7 +378,7 @@ public: g_depthfillPass_enabled = true; } - void disable() + void disable(OpenGLBinding &GL) { glUseProgramObjectARB(0); GlobalOpenGL_debugAssertNoErrors(); @@ -386,7 +386,7 @@ public: g_depthfillPass_enabled = false; } - void setParameters(const Vector3 &viewer, const Matrix4 &localToWorld, const Vector3 &origin, const Vector3 &colour, + void setParameters(OpenGLBinding &GL, const Vector3 &viewer, const Matrix4 &localToWorld, const Vector3 &origin, const Vector3 &colour, const Matrix4 &world2light) { } @@ -397,7 +397,7 @@ GLSLDepthFillProgram g_depthFillGLSL; // ARB path -void createProgram(const char *filename, GLenum type) +void createProgram(OpenGLBinding &GL, const char *filename, GLenum type) { std::size_t size = file_size(filename); FileInputStream file(filename); @@ -424,7 +424,7 @@ public: GLuint m_vertex_program; GLuint m_fragment_program; - void create() + void create(OpenGLBinding &GL) { glEnable(GL_VERTEX_PROGRAM_ARB); glEnable(GL_FRAGMENT_PROGRAM_ARB); @@ -434,13 +434,13 @@ public: glBindProgramARB(GL_VERTEX_PROGRAM_ARB, m_vertex_program); StringOutputStream filename(256); filename << GlobalRadiant().getAppPath() << "gl/lighting_DBS_omni_vp.glp"; - createProgram(filename.c_str(), GL_VERTEX_PROGRAM_ARB); + createProgram(GL, filename.c_str(), GL_VERTEX_PROGRAM_ARB); glGenProgramsARB(1, &m_fragment_program); glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, m_fragment_program); filename.clear(); filename << GlobalRadiant().getAppPath() << "gl/lighting_DBS_omni_fp.glp"; - createProgram(filename.c_str(), GL_FRAGMENT_PROGRAM_ARB); + createProgram(GL, filename.c_str(), GL_FRAGMENT_PROGRAM_ARB); } glDisable(GL_VERTEX_PROGRAM_ARB); @@ -449,14 +449,14 @@ public: GlobalOpenGL_debugAssertNoErrors(); } - void destroy() + void destroy(OpenGLBinding &GL) { glDeleteProgramsARB(1, &m_vertex_program); glDeleteProgramsARB(1, &m_fragment_program); GlobalOpenGL_debugAssertNoErrors(); } - void enable() + void enable(OpenGLBinding &GL) { glEnable(GL_VERTEX_PROGRAM_ARB); glEnable(GL_FRAGMENT_PROGRAM_ARB); @@ -471,7 +471,7 @@ public: GlobalOpenGL_debugAssertNoErrors(); } - void disable() + void disable(OpenGLBinding &GL) { glDisable(GL_VERTEX_PROGRAM_ARB); glDisable(GL_FRAGMENT_PROGRAM_ARB); @@ -484,7 +484,7 @@ public: GlobalOpenGL_debugAssertNoErrors(); } - void setParameters(const Vector3 &viewer, const Matrix4 &localToWorld, const Vector3 &origin, const Vector3 &colour, + void setParameters(OpenGLBinding &GL, const Vector3 &viewer, const Matrix4 &localToWorld, const Vector3 &origin, const Vector3 &colour, const Matrix4 &world2light) { Matrix4 world2local(localToWorld); @@ -531,7 +531,7 @@ public: GLuint m_vertex_program; GLuint m_fragment_program; - void create() + void create(OpenGLBinding &GL) { glEnable(GL_VERTEX_PROGRAM_ARB); glEnable(GL_FRAGMENT_PROGRAM_ARB); @@ -541,13 +541,13 @@ public: glBindProgramARB(GL_VERTEX_PROGRAM_ARB, m_vertex_program); StringOutputStream filename(256); filename << GlobalRadiant().getAppPath() << "gl/zfill_vp.glp"; - createProgram(filename.c_str(), GL_VERTEX_PROGRAM_ARB); + createProgram(GL, filename.c_str(), GL_VERTEX_PROGRAM_ARB); glGenProgramsARB(1, &m_fragment_program); glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, m_fragment_program); filename.clear(); filename << GlobalRadiant().getAppPath() << "gl/zfill_fp.glp"; - createProgram(filename.c_str(), GL_FRAGMENT_PROGRAM_ARB); + createProgram(GL, filename.c_str(), GL_FRAGMENT_PROGRAM_ARB); } glDisable(GL_VERTEX_PROGRAM_ARB); @@ -556,14 +556,14 @@ public: GlobalOpenGL_debugAssertNoErrors(); } - void destroy() + void destroy(OpenGLBinding &GL) { glDeleteProgramsARB(1, &m_vertex_program); glDeleteProgramsARB(1, &m_fragment_program); GlobalOpenGL_debugAssertNoErrors(); } - void enable() + void enable(OpenGLBinding &GL) { glEnable(GL_VERTEX_PROGRAM_ARB); glEnable(GL_FRAGMENT_PROGRAM_ARB); @@ -573,7 +573,7 @@ public: GlobalOpenGL_debugAssertNoErrors(); } - void disable() + void disable(OpenGLBinding &GL) { glDisable(GL_VERTEX_PROGRAM_ARB); glDisable(GL_FRAGMENT_PROGRAM_ARB); @@ -581,7 +581,7 @@ public: GlobalOpenGL_debugAssertNoErrors(); } - void setParameters(const Vector3 &viewer, const Matrix4 &localToWorld, const Vector3 &origin, const Vector3 &colour, + void setParameters(OpenGLBinding &GL, const Vector3 &viewer, const Matrix4 &localToWorld, const Vector3 &origin, const Vector3 &colour, const Matrix4 &world2light) { } @@ -920,7 +920,7 @@ public: return m_state; } - void render(OpenGLState ¤t, unsigned int globalstate, const Vector3 &viewer); + void render(OpenGLBinding &GL, OpenGLState ¤t, unsigned int globalstate, const Vector3 &viewer); }; #define LIGHT_SHADER_DEBUG 0 @@ -1202,7 +1202,7 @@ public: } }; -inline void setFogState(const OpenGLFogState &state) +inline void setFogState(OpenGLBinding &GL, const OpenGLFogState &state) { glFogi(GL_FOG_MODE, state.mode); glFogf(GL_FOG_DENSITY, state.density); @@ -1291,7 +1291,7 @@ public: } void - render(RenderStateFlags globalstate, const Matrix4 &modelview, const Matrix4 &projection, const Vector3 &viewer) + render(OpenGLBinding &GL, RenderStateFlags globalstate, const Matrix4 &modelview, const Matrix4 &projection, const Vector3 &viewer) { glMatrixMode(GL_PROJECTION); glLoadMatrixf(reinterpret_cast( &projection )); @@ -1336,12 +1336,12 @@ public: g_vertexArray_enabled = true; glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); - if (GlobalOpenGL().GL_1_3()) { + if (GL.GL_1_3()) { glActiveTexture(GL_TEXTURE0); glClientActiveTexture(GL_TEXTURE0); } - if (GlobalOpenGL().ARB_shader_objects()) { + if (GL.ARB_shader_objects()) { glUseProgramObjectARB(0); glDisableVertexAttribArrayARB(c_attr_TexCoord0); glDisableVertexAttribArrayARB(c_attr_Tangent); @@ -1389,27 +1389,28 @@ public: glHint(GL_FOG_HINT, GL_NICEST); glDisable(GL_FOG); - setFogState(OpenGLFogState()); + setFogState(GL, OpenGLFogState()); GlobalOpenGL_debugAssertNoErrors(); debug_string("begin rendering"); for (OpenGLStates::iterator i = g_state_sorted.begin(); i != g_state_sorted.end(); ++i) { - (*i).second->render(current, globalstate, viewer); + (*i).second->render(GL, current, globalstate, viewer); } debug_string("end rendering"); } void realise() { + OpenGLBinding &GL = GlobalOpenGL(); if (--m_unrealised == 0) { if (lightingSupported() && lightingEnabled()) { if (useShaderLanguage()) { - g_bumpGLSL.create(); - g_depthFillGLSL.create(); + g_bumpGLSL.create(GL); + g_depthFillGLSL.create(GL); } else { - g_bumpARB.create(); - g_depthFillARB.create(); + g_bumpARB.create(GL); + g_depthFillARB.create(GL); } } @@ -1423,19 +1424,20 @@ public: void unrealise() { + OpenGLBinding &GL = GlobalOpenGL(); if (++m_unrealised == 1) { for (Shaders::iterator i = m_shaders.begin(); i != m_shaders.end(); ++i) { if (!(*i).value.empty()) { (*i).value->unrealise(); } } - if (GlobalOpenGL().contextValid && lightingSupported() && lightingEnabled()) { + if (GL.contextValid && lightingSupported() && lightingEnabled()) { if (useShaderLanguage()) { - g_bumpGLSL.destroy(); - g_depthFillGLSL.destroy(); + g_bumpGLSL.destroy(GL); + g_depthFillGLSL.destroy(GL); } else { - g_bumpARB.destroy(); - g_depthFillARB.destroy(); + g_bumpARB.destroy(GL); + g_depthFillARB.destroy(GL); } } } @@ -1479,39 +1481,39 @@ public: } } - void extensionsInitialised() + void extensionsInitialised(OpenGLBinding &GL) { - setLighting(GlobalOpenGL().GL_1_3() - && GlobalOpenGL().ARB_vertex_program() - && GlobalOpenGL().ARB_fragment_program() - && GlobalOpenGL().ARB_shader_objects() - && GlobalOpenGL().ARB_vertex_shader() - && GlobalOpenGL().ARB_fragment_shader() - && GlobalOpenGL().ARB_shading_language_100(), + setLighting(GL.GL_1_3() + && GL.ARB_vertex_program() + && GL.ARB_fragment_program() + && GL.ARB_shader_objects() + && GL.ARB_vertex_shader() + && GL.ARB_fragment_shader() + && GL.ARB_shading_language_100(), m_lightingEnabled ); if (!lightingSupported()) { globalOutputStream() << "Lighting mode requires OpenGL features not supported by your graphics drivers:\n"; - if (!GlobalOpenGL().GL_1_3()) { + if (!GL.GL_1_3()) { globalOutputStream() << " GL version 1.3 or better\n"; } - if (!GlobalOpenGL().ARB_vertex_program()) { + if (!GL.ARB_vertex_program()) { globalOutputStream() << " GL_ARB_vertex_program\n"; } - if (!GlobalOpenGL().ARB_fragment_program()) { + if (!GL.ARB_fragment_program()) { globalOutputStream() << " GL_ARB_fragment_program\n"; } - if (!GlobalOpenGL().ARB_shader_objects()) { + if (!GL.ARB_shader_objects()) { globalOutputStream() << " GL_ARB_shader_objects\n"; } - if (!GlobalOpenGL().ARB_vertex_shader()) { + if (!GL.ARB_vertex_shader()) { globalOutputStream() << " GL_ARB_vertex_shader\n"; } - if (!GlobalOpenGL().ARB_fragment_shader()) { + if (!GL.ARB_fragment_shader()) { globalOutputStream() << " GL_ARB_fragment_shader\n"; } - if (!GlobalOpenGL().ARB_shading_language_100()) { + if (!GL.ARB_shading_language_100()) { globalOutputStream() << " GL_ARB_shading_language_100\n"; } } @@ -1611,9 +1613,9 @@ public: static OpenGLShaderCache *g_ShaderCache; -void ShaderCache_extensionsInitialised() +void ShaderCache_extensionsInitialised(OpenGLBinding &GL) { - g_ShaderCache->extensionsInitialised(); + g_ShaderCache->extensionsInitialised(GL); } void ShaderCache_setBumpEnabled(bool enabled) @@ -1695,7 +1697,7 @@ ShaderCache *GetShaderCache() return g_ShaderCache; } -inline void setTextureState(GLint ¤t, const GLint &texture, GLenum textureUnit) +inline void setTextureState(OpenGLBinding &GL, GLint ¤t, const GLint &texture, GLenum textureUnit) { if (texture != current) { glActiveTexture(textureUnit); @@ -1706,7 +1708,7 @@ inline void setTextureState(GLint ¤t, const GLint &texture, GLenum texture } } -inline void setTextureState(GLint ¤t, const GLint &texture) +inline void setTextureState(OpenGLBinding &GL, GLint ¤t, const GLint &texture) { if (texture != current) { glBindTexture(GL_TEXTURE_2D, texture); @@ -1715,7 +1717,7 @@ inline void setTextureState(GLint ¤t, const GLint &texture) } } -inline void setState(unsigned int state, unsigned int delta, unsigned int flag, GLenum glflag) +inline void setState(OpenGLBinding &GL, unsigned int state, unsigned int delta, unsigned int flag, GLenum glflag) { if (delta & state & flag) { glEnable(glflag); @@ -1726,7 +1728,7 @@ inline void setState(unsigned int state, unsigned int delta, unsigned int flag, } } -void OpenGLState_apply(const OpenGLState &self, OpenGLState ¤t, unsigned int globalstate) +void OpenGLState_apply(const OpenGLState &self, OpenGLState ¤t, unsigned int globalstate, OpenGLBinding &GL) { debug_int("sort", int(self.m_sort)); debug_int("texture", self.m_texture); @@ -1748,7 +1750,7 @@ void OpenGLState_apply(const OpenGLState &self, OpenGLState ¤t, unsigned i if (program != current.m_program) { if (current.m_program != 0) { - current.m_program->disable(); + current.m_program->disable(GL); glColor4fv(vector4_to_array(current.m_colour)); debug_colour("cleaning program"); } @@ -1756,7 +1758,7 @@ void OpenGLState_apply(const OpenGLState &self, OpenGLState ¤t, unsigned i current.m_program = program; if (current.m_program != 0) { - current.m_program->enable(); + current.m_program->enable(GL); } } @@ -1770,7 +1772,7 @@ void OpenGLState_apply(const OpenGLState &self, OpenGLState ¤t, unsigned i GlobalOpenGL_debugAssertNoErrors(); } - setState(state, delta, RENDER_OFFSETLINE, GL_POLYGON_OFFSET_LINE); + setState(GL, state, delta, RENDER_OFFSETLINE, GL_POLYGON_OFFSET_LINE); if (delta & state & RENDER_LIGHTING) { glEnable(GL_LIGHTING); @@ -1791,7 +1793,7 @@ void OpenGLState_apply(const OpenGLState &self, OpenGLState ¤t, unsigned i if (delta & state & RENDER_TEXTURE) { GlobalOpenGL_debugAssertNoErrors(); - if (GlobalOpenGL().GL_1_3()) { + if (GL.GL_1_3()) { glActiveTexture(GL_TEXTURE0); glClientActiveTexture(GL_TEXTURE0); } @@ -1805,7 +1807,7 @@ void OpenGLState_apply(const OpenGLState &self, OpenGLState ¤t, unsigned i GlobalOpenGL_debugAssertNoErrors(); g_texcoordArray_enabled = true; } else if (delta & ~state & RENDER_TEXTURE) { - if (GlobalOpenGL().GL_1_3()) { + if (GL.GL_1_3()) { glActiveTexture(GL_TEXTURE0); glClientActiveTexture(GL_TEXTURE0); } @@ -1826,21 +1828,21 @@ void OpenGLState_apply(const OpenGLState &self, OpenGLState ¤t, unsigned i // this could get better if you can get glTexEnviv (GL_TEXTURE_ENV, to work .. patches are welcome glEnable(GL_BLEND); - if (GlobalOpenGL().GL_1_3()) { + if (GL.GL_1_3()) { glActiveTexture(GL_TEXTURE0); } glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); GlobalOpenGL_debugAssertNoErrors(); } else if (delta & ~state & RENDER_BLEND) { glDisable(GL_BLEND); - if (GlobalOpenGL().GL_1_3()) { + if (GL.GL_1_3()) { glActiveTexture(GL_TEXTURE0); } glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); GlobalOpenGL_debugAssertNoErrors(); } - setState(state, delta, RENDER_CULLFACE, GL_CULL_FACE); + setState(GL, state, delta, RENDER_CULLFACE, GL_CULL_FACE); if (delta & state & RENDER_SMOOTH) { glShadeModel(GL_SMOOTH); @@ -1850,9 +1852,9 @@ void OpenGLState_apply(const OpenGLState &self, OpenGLState ¤t, unsigned i GlobalOpenGL_debugAssertNoErrors(); } - setState(state, delta, RENDER_SCALED, GL_NORMALIZE); // not GL_RESCALE_NORMAL + setState(GL, state, delta, RENDER_SCALED, GL_NORMALIZE); // not GL_RESCALE_NORMAL - setState(state, delta, RENDER_DEPTHTEST, GL_DEPTH_TEST); + setState(GL, state, delta, RENDER_DEPTHTEST, GL_DEPTH_TEST); if (delta & state & RENDER_DEPTHWRITE) { glDepthMask(GL_TRUE); @@ -1886,7 +1888,7 @@ void OpenGLState_apply(const OpenGLState &self, OpenGLState ¤t, unsigned i GlobalOpenGL_debugAssertNoErrors(); } - setState(state, delta, RENDER_ALPHATEST, GL_ALPHA_TEST); + setState(GL, state, delta, RENDER_ALPHATEST, GL_ALPHA_TEST); if (delta & state & RENDER_COLOURARRAY) { glEnableClientState(GL_COLOR_ARRAY); @@ -1906,16 +1908,16 @@ void OpenGLState_apply(const OpenGLState &self, OpenGLState ¤t, unsigned i GlobalOpenGL_debugAssertNoErrors(); } - setState(state, delta, RENDER_LINESTIPPLE, GL_LINE_STIPPLE); - setState(state, delta, RENDER_LINESMOOTH, GL_LINE_SMOOTH); + setState(GL, state, delta, RENDER_LINESTIPPLE, GL_LINE_STIPPLE); + setState(GL, state, delta, RENDER_LINESMOOTH, GL_LINE_SMOOTH); - setState(state, delta, RENDER_POLYGONSTIPPLE, GL_POLYGON_STIPPLE); - setState(state, delta, RENDER_POLYGONSMOOTH, GL_POLYGON_SMOOTH); + setState(GL, state, delta, RENDER_POLYGONSTIPPLE, GL_POLYGON_STIPPLE); + setState(GL, state, delta, RENDER_POLYGONSMOOTH, GL_POLYGON_SMOOTH); - setState(state, delta, RENDER_FOG, GL_FOG); + setState(GL, state, delta, RENDER_FOG, GL_FOG); if ((state & RENDER_FOG) != 0) { - setFogState(self.m_fog); + setFogState(GL, self.m_fog); GlobalOpenGL_debugAssertNoErrors(); current.m_fog = self.m_fog; } @@ -1966,17 +1968,17 @@ void OpenGLState_apply(const OpenGLState &self, OpenGLState ¤t, unsigned i texture7 = self.m_texture7; } - if (GlobalOpenGL().GL_1_3()) { - setTextureState(current.m_texture, texture0, GL_TEXTURE0); - setTextureState(current.m_texture1, texture1, GL_TEXTURE1); - setTextureState(current.m_texture2, texture2, GL_TEXTURE2); - setTextureState(current.m_texture3, texture3, GL_TEXTURE3); - setTextureState(current.m_texture4, texture4, GL_TEXTURE4); - setTextureState(current.m_texture5, texture5, GL_TEXTURE5); - setTextureState(current.m_texture6, texture6, GL_TEXTURE6); - setTextureState(current.m_texture7, texture7, GL_TEXTURE7); + if (GL.GL_1_3()) { + setTextureState(GL, current.m_texture, texture0, GL_TEXTURE0); + setTextureState(GL, current.m_texture1, texture1, GL_TEXTURE1); + setTextureState(GL, current.m_texture2, texture2, GL_TEXTURE2); + setTextureState(GL, current.m_texture3, texture3, GL_TEXTURE3); + setTextureState(GL, current.m_texture4, texture4, GL_TEXTURE4); + setTextureState(GL, current.m_texture5, texture5, GL_TEXTURE5); + setTextureState(GL, current.m_texture6, texture6, GL_TEXTURE6); + setTextureState(GL, current.m_texture7, texture7, GL_TEXTURE7); } else { - setTextureState(current.m_texture, texture0); + setTextureState(GL, current.m_texture, texture0); } } @@ -2025,7 +2027,7 @@ void OpenGLState_apply(const OpenGLState &self, OpenGLState ¤t, unsigned i GlobalOpenGL_debugAssertNoErrors(); } -void Renderables_flush(OpenGLStateBucket::Renderables &renderables, OpenGLState ¤t, unsigned int globalstate, +void Renderables_flush(OpenGLBinding &GL, OpenGLStateBucket::Renderables &renderables, OpenGLState ¤t, unsigned int globalstate, const Vector3 &viewer) { const Matrix4 *transform = 0; @@ -2053,13 +2055,13 @@ void Renderables_flush(OpenGLStateBucket::Renderables &renderables, OpenGLState ? lightShader.lightFalloffImage()->texture_number : static_cast( g_defaultPointLight )->getShader().lightFalloffImage()->texture_number; - setTextureState(current.m_texture3, attenuation_xy, GL_TEXTURE3); + setTextureState(GL, current.m_texture3, attenuation_xy, GL_TEXTURE3); glActiveTexture(GL_TEXTURE3); glBindTexture(GL_TEXTURE_2D, attenuation_xy); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); - setTextureState(current.m_texture4, attenuation_z, GL_TEXTURE4); + setTextureState(GL, current.m_texture4, attenuation_z, GL_TEXTURE4); glActiveTexture(GL_TEXTURE4); glBindTexture(GL_TEXTURE_2D, attenuation_z); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); @@ -2085,22 +2087,22 @@ void Renderables_flush(OpenGLStateBucket::Renderables &renderables, OpenGLState matrix4_translate_by_vec3(world2light, vector3_negated(lightBounds.origin)); // world->lightBounds } - current.m_program->setParameters(viewer, *(*i).m_transform, lightBounds.origin + (*i).m_light->offset(), + current.m_program->setParameters(GL, viewer, *(*i).m_transform, lightBounds.origin + (*i).m_light->offset(), (*i).m_light->colour(), world2light); debug_string("set lightBounds parameters"); } } - (*i).m_renderable->render(current.m_state); + (*i).m_renderable->render(GL, current.m_state); } glPopMatrix(); renderables.clear(); } -void OpenGLStateBucket::render(OpenGLState ¤t, unsigned int globalstate, const Vector3 &viewer) +void OpenGLStateBucket::render(OpenGLBinding &GL, OpenGLState ¤t, unsigned int globalstate, const Vector3 &viewer) { if ((globalstate & m_state.m_state & RENDER_SCREEN) != 0) { - OpenGLState_apply(m_state, current, globalstate); + OpenGLState_apply(m_state, current, globalstate, GL); debug_colour("screen fill"); glMatrixMode(GL_PROJECTION); @@ -2124,8 +2126,8 @@ void OpenGLStateBucket::render(OpenGLState ¤t, unsigned int globalstate, c glMatrixMode(GL_MODELVIEW); glPopMatrix(); } else if (!m_renderables.empty()) { - OpenGLState_apply(m_state, current, globalstate); - Renderables_flush(m_renderables, current, globalstate, viewer); + OpenGLState_apply(m_state, current, globalstate, GL); + Renderables_flush(GL, m_renderables, current, globalstate, viewer); } } diff --git a/radiant/renderstate.h b/radiant/renderstate.h index f4ba496b..2ba6f4d5 100644 --- a/radiant/renderstate.h +++ b/radiant/renderstate.h @@ -22,8 +22,10 @@ #if !defined( INCLUDED_RENDERSTATE_H ) #define INCLUDED_RENDERSTATE_H +struct OpenGLBinding; + void ShaderCache_setBumpEnabled(bool enabled); -void ShaderCache_extensionsInitialised(); +void ShaderCache_extensionsInitialised(OpenGLBinding &GL); #endif diff --git a/radiant/selection.cpp b/radiant/selection.cpp index 9a409f27..738a68ae 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -455,7 +455,7 @@ class RenderableClippedPrimitive : public OpenGLRenderable { public: Matrix4 m_world; - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { for (std::size_t i = 0; i < m_primitives.size(); ++i) { glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(PointVertex), &m_primitives[i].m_points[0].colour); @@ -912,7 +912,7 @@ class RotateManipulator : public Manipulator { { } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(PointVertex), &m_vertices.data()->colour); glVertexPointer(3, GL_FLOAT, sizeof(PointVertex), &m_vertices.data()->vertex); @@ -934,7 +934,7 @@ class RotateManipulator : public Manipulator { { } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(PointVertex), &m_vertices.data()->colour); glVertexPointer(3, GL_FLOAT, sizeof(PointVertex), &m_vertices.data()->vertex); @@ -1321,7 +1321,7 @@ class TranslateManipulator : public Manipulator { { } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(PointVertex), &m_line[0].colour); glVertexPointer(3, GL_FLOAT, sizeof(PointVertex), &m_line[0].vertex); @@ -1343,7 +1343,7 @@ class TranslateManipulator : public Manipulator { { } - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(FlatShadedVertex), &m_vertices.data()->colour); glVertexPointer(3, GL_FLOAT, sizeof(FlatShadedVertex), &m_vertices.data()->vertex); @@ -1362,7 +1362,7 @@ class TranslateManipulator : public Manipulator { struct RenderableQuad : public OpenGLRenderable { PointVertex m_quad[4]; - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(PointVertex), &m_quad[0].colour); glVertexPointer(3, GL_FLOAT, sizeof(PointVertex), &m_quad[0].vertex); @@ -1582,7 +1582,7 @@ class ScaleManipulator : public Manipulator { struct RenderableArrow : public OpenGLRenderable { PointVertex m_line[2]; - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(PointVertex), &m_line[0].colour); glVertexPointer(3, GL_FLOAT, sizeof(PointVertex), &m_line[0].vertex); @@ -1599,7 +1599,7 @@ class ScaleManipulator : public Manipulator { struct RenderableQuad : public OpenGLRenderable { PointVertex m_quad[4]; - void render(RenderStateFlags state) const + void render(OpenGLBinding &GL, RenderStateFlags state) const { glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(PointVertex), &m_quad[0].colour); glVertexPointer(3, GL_FLOAT, sizeof(PointVertex), &m_quad[0].vertex); diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index b9926714..02e717a9 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -1404,14 +1404,13 @@ void TextureClipboard_textureSelected(const char *shader) class TextureBrowser; -extern TextureBrowser g_TextureBrowser; - void TextureBrowser_SetSelectedShader(TextureBrowser &textureBrowser, const char *shader); const char *TextureBrowser_GetSelectedShader(TextureBrowser &textureBrowser); void Scene_copyClosestTexture(SelectionTest &test) { + auto &g_TextureBrowser = GlobalTextureBrowser(); CopiedString shader; if (Scene_getClosestTexture(GlobalSceneGraph(), test, shader, g_faceTextureClipboard.m_projection, g_faceTextureClipboard.m_flags)) { @@ -1421,6 +1420,7 @@ void Scene_copyClosestTexture(SelectionTest &test) void Scene_applyClosestTexture(SelectionTest &test) { + auto &g_TextureBrowser = GlobalTextureBrowser(); UndoableCommand command("facePaintTexture"); Scene_setClosestTexture(GlobalSceneGraph(), test, TextureBrowser_GetSelectedShader(g_TextureBrowser), @@ -1437,12 +1437,14 @@ void SelectedFaces_copyTexture() face.GetTexdef(g_faceTextureClipboard.m_projection); g_faceTextureClipboard.m_flags = face.getShader().m_flags; + auto &g_TextureBrowser = GlobalTextureBrowser(); TextureBrowser_SetSelectedShader(g_TextureBrowser, face.getShader().getShader()); } } void FaceInstance_pasteTexture(FaceInstance &faceInstance) { + auto &g_TextureBrowser = GlobalTextureBrowser(); faceInstance.getFace().SetTexdef(g_faceTextureClipboard.m_projection); faceInstance.getFace().SetShader(TextureBrowser_GetSelectedShader(g_TextureBrowser)); faceInstance.getFace().SetFlags(g_faceTextureClipboard.m_flags); diff --git a/radiant/textures.cpp b/radiant/textures.cpp index a0e0b12b..179e92b3 100644 --- a/radiant/textures.cpp +++ b/radiant/textures.cpp @@ -85,7 +85,7 @@ struct texture_globals_t { texture_globals_t g_texture_globals(GL_RGBA); -void SetTexParameters(ETexturesMode mode) +void SetTexParameters(OpenGLBinding &GL, ETexturesMode mode) { float maxAniso = QGL_maxTextureAnisotropy(); if (maxAniso > 1) { @@ -164,7 +164,7 @@ LatchedValue g_Textures_textureQuality(3, "Texture Quality"); /// \brief This function does the actual processing of raw RGBA data into a GL texture. /// It will also resample to power-of-two dimensions, generate the mipmaps and adjust gamma. -void LoadTextureRGBA(qtexture_t *q, unsigned char *pPixels, int nWidth, int nHeight) +void LoadTextureRGBA(OpenGLBinding &GL, qtexture_t *q, unsigned char *pPixels, int nWidth, int nHeight) { static float fGamma = -1; float total[3]; @@ -198,7 +198,7 @@ void LoadTextureRGBA(qtexture_t *q, unsigned char *pPixels, int nWidth, int nHei glBindTexture(GL_TEXTURE_2D, q->texture_number); - SetTexParameters(g_texture_mode); + SetTexParameters(GL, g_texture_mode); int gl_width = 1; while (gl_width < nWidth) { @@ -326,13 +326,13 @@ const TestHashtable g_testhashtable; typedef std::pair TextureKey; -void qtexture_realise(qtexture_t &texture, const TextureKey &key) +void qtexture_realise(OpenGLBinding &GL, qtexture_t &texture, const TextureKey &key) { texture.texture_number = 0; if (!string_empty(key.second.c_str())) { Image *image = key.first.loadImage(key.second.c_str()); if (image != 0) { - LoadTextureRGBA(&texture, image->getRGBAPixels(), image->getWidth(), image->getHeight()); + LoadTextureRGBA(GL, &texture, image->getRGBAPixels(), image->getWidth(), image->getHeight()); texture.surfaceFlags = image->getSurfaceFlags(); texture.contentFlags = image->getContentFlags(); texture.value = image->getValue(); @@ -345,9 +345,9 @@ void qtexture_realise(qtexture_t &texture, const TextureKey &key) } } -void qtexture_unrealise(qtexture_t &texture) +void qtexture_unrealise(OpenGLBinding &GL, qtexture_t &texture) { - if (GlobalOpenGL().contextValid && texture.texture_number != 0) { + if (GL.contextValid && texture.texture_number != 0) { glDeleteTextures(1, &texture.texture_number); GlobalOpenGL_debugAssertNoErrors(); } @@ -384,17 +384,19 @@ class TexturesMap : public TexturesCache { qtexture_t *construct(const TextureKey &key) { + OpenGLBinding &GL = GlobalOpenGL(); qtexture_t *texture = new qtexture_t(key.first, key.second.c_str()); if (m_cache->realised()) { - qtexture_realise(*texture, key); + qtexture_realise(GL, *texture, key); } return texture; } void destroy(qtexture_t *texture) { + OpenGLBinding &GL = GlobalOpenGL(); if (m_cache->realised()) { - qtexture_unrealise(*texture); + qtexture_unrealise(GL, *texture); } delete texture; } @@ -467,17 +469,17 @@ public: m_observer = 0; } - void realise() + void realise(OpenGLBinding &GL) { if (--m_unrealised == 0) { g_texture_globals.bTextureCompressionSupported = false; - if (GlobalOpenGL().ARB_texture_compression()) { + if (GL.ARB_texture_compression()) { g_texture_globals.bTextureCompressionSupported = true; g_texture_globals.m_bOpenGLCompressionSupported = true; } - if (GlobalOpenGL().EXT_texture_compression_s3tc()) { + if (GL.EXT_texture_compression_s3tc()) { g_texture_globals.bTextureCompressionSupported = true; g_texture_globals.m_bS3CompressionSupported = true; } @@ -523,7 +525,7 @@ public: for (qtextures_t::iterator i = m_qtextures.begin(); i != m_qtextures.end(); ++i) { if (!(*i).value.empty()) { - qtexture_realise(*(*i).value, (*i).key); + qtexture_realise(GL, *(*i).value, (*i).key); } } if (m_observer != 0) { @@ -532,7 +534,7 @@ public: } } - void unrealise() + void unrealise(OpenGLBinding &GL) { if (++m_unrealised == 1) { if (m_observer != 0) { @@ -540,7 +542,7 @@ public: } for (qtextures_t::iterator i = m_qtextures.begin(); i != m_qtextures.end(); ++i) { if (!(*i).value.empty()) { - qtexture_unrealise(*(*i).value); + qtexture_unrealise(GL, *(*i).value); } } } @@ -560,14 +562,14 @@ TexturesCache &GetTexturesCache() } -void Textures_Realise() +void Textures_Realise(OpenGLBinding &GL) { - g_texturesmap->realise(); + g_texturesmap->realise(GL); } -void Textures_Unrealise() +void Textures_Unrealise(OpenGLBinding &GL) { - g_texturesmap->unrealise(); + g_texturesmap->unrealise(GL); } @@ -578,14 +580,14 @@ void Textures_setModeChangedNotify(const Callback ¬ify) g_texturesModeChangedNotify = notify; } -void Textures_ModeChanged() +void Textures_ModeChanged(OpenGLBinding &GL) { if (g_texturesmap->realised()) { - SetTexParameters(g_texture_mode); + SetTexParameters(GL, g_texture_mode); for (TexturesMap::iterator i = g_texturesmap->begin(); i != g_texturesmap->end(); ++i) { glBindTexture(GL_TEXTURE_2D, (*i).value->texture_number); - SetTexParameters(g_texture_mode); + SetTexParameters(GL, g_texture_mode); } glBindTexture(GL_TEXTURE_2D, 0); @@ -593,26 +595,27 @@ void Textures_ModeChanged() g_texturesModeChangedNotify(); } -void Textures_SetMode(ETexturesMode mode) +void Textures_SetMode(OpenGLBinding &GL, ETexturesMode mode) { if (g_texture_mode != mode) { g_texture_mode = mode; - Textures_ModeChanged(); + Textures_ModeChanged(GL); } } -void Textures_setTextureComponents(GLint texture_components) +void Textures_setTextureComponents(OpenGLBinding &GL, GLint texture_components) { if (g_texture_globals.texture_components != texture_components) { - Textures_Unrealise(); + Textures_Unrealise(GL); g_texture_globals.texture_components = texture_components; - Textures_Realise(); + Textures_Realise(GL); } } void Textures_UpdateTextureCompressionFormat() { + OpenGLBinding &GL = GlobalOpenGL(); GLint texture_components = GL_RGBA; switch (g_texture_globals.m_nTextureCompressionFormat) { @@ -638,7 +641,7 @@ void Textures_UpdateTextureCompressionFormat() } } - Textures_setTextureComponents(texture_components); + Textures_setTextureComponents(GL, texture_components); } struct TextureCompression { @@ -683,10 +686,11 @@ struct TextureGamma { static void Import(float &self, float value) { + OpenGLBinding &GL = GlobalOpenGL(); if (value != self) { - Textures_Unrealise(); + Textures_Unrealise(GL); self = value; - Textures_Realise(); + Textures_Realise(GL); } } }; @@ -723,27 +727,28 @@ struct TextureMode { static void Import(ETexturesMode &self, int value) { + OpenGLBinding &GL = GlobalOpenGL(); switch (value) { case 0: - Textures_SetMode(eTextures_NEAREST); + Textures_SetMode(GL, eTextures_NEAREST); break; case 1: - Textures_SetMode(eTextures_NEAREST_MIPMAP_NEAREST); + Textures_SetMode(GL, eTextures_NEAREST_MIPMAP_NEAREST); break; case 2: - Textures_SetMode(eTextures_LINEAR); + Textures_SetMode(GL, eTextures_LINEAR); break; case 3: - Textures_SetMode(eTextures_NEAREST_MIPMAP_LINEAR); + Textures_SetMode(GL, eTextures_NEAREST_MIPMAP_LINEAR); break; case 4: - Textures_SetMode(eTextures_LINEAR_MIPMAP_NEAREST); + Textures_SetMode(GL, eTextures_LINEAR_MIPMAP_NEAREST); break; case 5: - Textures_SetMode(eTextures_LINEAR_MIPMAP_LINEAR); + Textures_SetMode(GL, eTextures_LINEAR_MIPMAP_LINEAR); break; case 6: - Textures_SetMode(eTextures_MAX_ANISOTROPY); + Textures_SetMode(GL, eTextures_MAX_ANISOTROPY); } } }; @@ -820,7 +825,7 @@ struct TextureCompressionPreference { } }; -void Textures_Construct() +void Textures_Construct(OpenGLBinding &GL) { g_texturesmap = new TexturesMap; @@ -836,7 +841,7 @@ void Textures_Construct() Textures_registerPreferencesPage(); - Textures_ModeChanged(); + Textures_ModeChanged(GL); } void Textures_Destroy() @@ -875,7 +880,8 @@ public: TexturesAPI() { - Textures_Construct(); + OpenGLBinding &GL = GlobalOpenGL(); + Textures_Construct(GL); m_textures = &GetTexturesCache(); } diff --git a/radiant/textures.h b/radiant/textures.h index 35f22f38..e80c01b6 100644 --- a/radiant/textures.h +++ b/radiant/textures.h @@ -24,11 +24,11 @@ #include "generic/callback.h" -void Textures_Realise(); +struct OpenGLBinding; -void Textures_Unrealise(); +void Textures_Realise(OpenGLBinding &GL); -void Textures_sharedContextDestroyed(); +void Textures_Unrealise(OpenGLBinding &GL); void Textures_setModeChangedNotify(const Callback ¬ify); diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index e6afb71d..cd9520bb 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -279,6 +279,7 @@ typedef FreeCaller &), TextureBrowser_enableAlph class TextureBrowser { public: + OpenGLBinding &GL; int width, height; int originy; int m_nTotalHeight; @@ -375,7 +376,8 @@ public: return height; } - TextureBrowser() : + TextureBrowser(OpenGLBinding &GL) : + GL(GL), m_texture_scroll(ui::null), m_hideunused_item(TextureBrowserHideUnusedExport()), m_hidenotex_item(TextureBrowserFilterFallbackExport()), @@ -428,7 +430,8 @@ const char *TextureBrowser_getComonShadersDir() inline int TextureBrowser_fontHeight(TextureBrowser &textureBrowser) { - return GlobalOpenGL().m_font->getPixelHeight(); + OpenGLBinding &GL = textureBrowser.GL; + return GL.m_font->getPixelHeight(); } const char *TextureBrowser_GetSelectedShader(TextureBrowser &textureBrowser) @@ -1167,6 +1170,7 @@ void TextureBrowser_Selection_MouseDown(TextureBrowser &textureBrowser, guint32 */ void Texture_Draw(TextureBrowser &textureBrowser) { + OpenGLBinding &GL = textureBrowser.GL; int originy = TextureBrowser_getOriginY(textureBrowser); glClearColor(textureBrowser.color_textureback[0], @@ -1324,7 +1328,7 @@ void Texture_Draw(TextureBrowser &textureBrowser) name--; } - GlobalOpenGL().drawString(name); + GL.drawString(name); glEnable(GL_TEXTURE_2D); } @@ -1537,6 +1541,7 @@ gboolean TextureBrowser_size_allocate(ui::Widget widget, GtkAllocation *allocati gboolean TextureBrowser_expose(ui::Widget widget, GdkEventExpose *event, TextureBrowser *textureBrowser) { + OpenGLBinding &GL = textureBrowser->GL; if (glwidget_make_current(textureBrowser->m_gl_widget) != FALSE) { GlobalOpenGL_debugAssertNoErrors(); TextureBrowser_evaluateHeight(*textureBrowser); @@ -1548,24 +1553,24 @@ gboolean TextureBrowser_expose(ui::Widget widget, GdkEventExpose *event, Texture } -TextureBrowser g_TextureBrowser; TextureBrowser &GlobalTextureBrowser() { + static TextureBrowser g_TextureBrowser{GlobalOpenGL()}; return g_TextureBrowser; } bool TextureBrowser_hideUnused() { - return g_TextureBrowser.m_hideUnused; + return GlobalTextureBrowser().m_hideUnused; } void TextureBrowser_ToggleHideUnused() { - if (g_TextureBrowser.m_hideUnused) { - TextureBrowser_SetHideUnused(g_TextureBrowser, false); + if (GlobalTextureBrowser().m_hideUnused) { + TextureBrowser_SetHideUnused(GlobalTextureBrowser(), false); } else { - TextureBrowser_SetHideUnused(g_TextureBrowser, true); + TextureBrowser_SetHideUnused(GlobalTextureBrowser(), true); } } @@ -1626,7 +1631,7 @@ void TextureBrowser_constructTreeStore() auto store = ui::TreeStore::from(gtk_tree_store_new(1, G_TYPE_STRING)); TextureGroups_constructTreeModel(groups, store); - gtk_tree_view_set_model(g_TextureBrowser.m_treeViewTree, store); + gtk_tree_view_set_model(GlobalTextureBrowser().m_treeViewTree, store); g_object_unref(G_OBJECT(store)); } @@ -1635,9 +1640,9 @@ void TextureBrowser_constructTreeStoreTags() { TextureGroups groups; auto store = ui::TreeStore::from(gtk_tree_store_new(1, G_TYPE_STRING)); - auto model = g_TextureBrowser.m_all_tags_list; + auto model = GlobalTextureBrowser().m_all_tags_list; - gtk_tree_view_set_model(g_TextureBrowser.m_treeViewTags, model); + gtk_tree_view_set_model(GlobalTextureBrowser().m_treeViewTags, model); g_object_unref(G_OBJECT(store)); } @@ -1656,7 +1661,7 @@ void TreeView_onRowActivated(ui::TreeView treeview, ui::TreePath path, ui::TreeV strcpy(dirName, buffer); g_free(buffer); - g_TextureBrowser.m_searchedTags = false; + GlobalTextureBrowser().m_searchedTags = false; if (!TextureBrowser_showWads()) { strcat(dirName, "/"); @@ -1670,13 +1675,13 @@ void TreeView_onRowActivated(ui::TreeView treeview, ui::TreePath path, ui::TreeV void TextureBrowser_createTreeViewTree() { - gtk_tree_view_set_enable_search(g_TextureBrowser.m_treeViewTree, FALSE); + gtk_tree_view_set_enable_search(GlobalTextureBrowser().m_treeViewTree, FALSE); - gtk_tree_view_set_headers_visible(g_TextureBrowser.m_treeViewTree, FALSE); - g_TextureBrowser.m_treeViewTree.connect("row-activated", (GCallback) TreeView_onRowActivated, NULL); + gtk_tree_view_set_headers_visible(GlobalTextureBrowser().m_treeViewTree, FALSE); + GlobalTextureBrowser().m_treeViewTree.connect("row-activated", (GCallback) TreeView_onRowActivated, NULL); auto renderer = ui::CellRendererText(ui::New); - gtk_tree_view_insert_column_with_attributes(g_TextureBrowser.m_treeViewTree, -1, "", renderer, "text", 0, NULL); + gtk_tree_view_insert_column_with_attributes(GlobalTextureBrowser().m_treeViewTree, -1, "", renderer, "text", 0, NULL); TextureBrowser_constructTreeStore(); } @@ -1730,6 +1735,7 @@ gboolean TreeViewTags_onButtonPressed(ui::TreeView treeview, GdkEventButton *eve void TextureBrowser_createTreeViewTags() { + auto &g_TextureBrowser = GlobalTextureBrowser(); g_TextureBrowser.m_treeViewTags = ui::TreeView(ui::New); gtk_tree_view_set_enable_search(g_TextureBrowser.m_treeViewTags, FALSE); @@ -1763,6 +1769,8 @@ ui::MenuItem TextureBrowser_constructViewMenu(ui::Menu menu) create_menu_item_with_mnemonic(menu, "Show All", "ShowAllTextures"); + auto &g_TextureBrowser = GlobalTextureBrowser(); + // we always want to show shaders but don't want a "Show Shaders" menu for doom3 and .wad file games if (g_pGameDescription->mGameType == "doom3" || !string_empty(g_pGameDescription->getKeyValue("show_wads"))) { g_TextureBrowser.m_showShaders = true; @@ -1840,6 +1848,8 @@ void TextureBrowser_assignTags() GSList *node; gchar *tag_assigned; + auto &g_TextureBrowser = GlobalTextureBrowser(); + auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_available_tree); gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc) TextureBrowser_tagMoveHelper, @@ -1890,6 +1900,8 @@ void TextureBrowser_removeTags() GSList *node; gchar *tag; + auto &g_TextureBrowser = GlobalTextureBrowser(); + auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_assigned_tree); gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc) TextureBrowser_tagMoveHelper, @@ -1924,6 +1936,7 @@ void TextureBrowser_removeTags() void TextureBrowser_buildTagList() { + auto &g_TextureBrowser = GlobalTextureBrowser(); g_TextureBrowser.m_all_tags_list.clear(); std::set::iterator iter; @@ -1941,6 +1954,8 @@ void TextureBrowser_searchTags() char buffer[256]; char tags_searched[256]; + auto &g_TextureBrowser = GlobalTextureBrowser(); + auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags); gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc) TextureBrowser_tagMoveHelper, @@ -2007,6 +2022,7 @@ void TextureBrowser_searchTags() void TextureBrowser_toggleSearchButton() { + auto &g_TextureBrowser = GlobalTextureBrowser(); gint page = gtk_notebook_get_current_page(GTK_NOTEBOOK(g_TextureBrowser.m_tag_notebook)); if (page == 0) { // tag page @@ -2018,6 +2034,7 @@ void TextureBrowser_toggleSearchButton() void TextureBrowser_constructTagNotebook() { + auto &g_TextureBrowser = GlobalTextureBrowser(); g_TextureBrowser.m_tag_notebook = ui::Widget::from(gtk_notebook_new()); ui::Widget labelTags = ui::Label("Tags"); ui::Widget labelTextures = ui::Label("Textures"); @@ -2033,6 +2050,7 @@ void TextureBrowser_constructTagNotebook() void TextureBrowser_constructSearchButton() { + auto &g_TextureBrowser = GlobalTextureBrowser(); auto image = ui::Widget::from(gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR)); g_TextureBrowser.m_search_button = ui::Button(ui::New); g_TextureBrowser.m_search_button.connect("clicked", G_CALLBACK(TextureBrowser_searchTags), NULL); @@ -2042,6 +2060,7 @@ void TextureBrowser_constructSearchButton() void TextureBrowser_checkTagFile() { + auto &g_TextureBrowser = GlobalTextureBrowser(); const char SHADERTAG_FILE[] = "shadertags.xml"; CopiedString default_filename, rc_filename; StringOutputStream stream(256); @@ -2087,8 +2106,9 @@ void TextureBrowser_SetNotex() g_shadernotex = name.c_str(); } -ui::Widget TextureBrowser_constructWindow(ui::Window toplevel) +ui::Widget TextureBrowser_constructWindow(ui::Window toplevel, OpenGLBinding &GL) { + auto &g_TextureBrowser = GlobalTextureBrowser(); // The gl_widget and the tag assignment frame should be packed into a GtkVPaned with the slider // position stored in local.pref. gtk_paned_get_position() and gtk_paned_set_position() don't // seem to work in gtk 2.4 and the arrow buttons don't handle GTK_FILL, so here's another thing @@ -2152,7 +2172,7 @@ ui::Widget TextureBrowser_constructWindow(ui::Window toplevel) g_TextureBrowser.m_texture_scroll.visible(g_TextureBrowser.m_showTextureScrollbar); } { // gl_widget - g_TextureBrowser.m_gl_widget = glwidget_new(FALSE); + g_TextureBrowser.m_gl_widget = glwidget_new(GL, FALSE); g_object_ref(g_TextureBrowser.m_gl_widget._handle); gtk_widget_set_events(g_TextureBrowser.m_gl_widget, @@ -2336,6 +2356,7 @@ ui::Widget TextureBrowser_constructWindow(ui::Window toplevel) void TextureBrowser_destroyWindow() { + auto &g_TextureBrowser = GlobalTextureBrowser(); GlobalShaderSystem().setActiveShadersChangedNotify(Callback()); g_signal_handler_disconnect(G_OBJECT(g_TextureBrowser.m_gl_widget), g_TextureBrowser.m_sizeHandler); @@ -2366,6 +2387,7 @@ void TextureBrowser_selectionHelper(ui::TreeModel model, ui::TreePath path, GtkT void TextureBrowser_shaderInfo() { + auto &g_TextureBrowser = GlobalTextureBrowser(); const char *name = TextureBrowser_GetSelectedShader(g_TextureBrowser); IShader *shader = QERApp_Shader_ForName(name); @@ -2381,6 +2403,7 @@ void TextureBrowser_addTag() EMessageBoxReturn result = DoShaderTagDlg(&tag, "Add shader tag"); if (result == eIDOK && !tag.empty()) { + auto &g_TextureBrowser = GlobalTextureBrowser(); GtkTreeIter iter; g_TextureBrowser.m_all_tags.insert(tag.c_str()); gtk_list_store_append(g_TextureBrowser.m_available_store, &iter); @@ -2396,6 +2419,7 @@ void TextureBrowser_addTag() void TextureBrowser_renameTag() { + auto &g_TextureBrowser = GlobalTextureBrowser(); /* WORKAROUND: The tag treeview is set to GTK_SELECTION_MULTIPLE. Because gtk_tree_selection_get_selected() doesn't work with GTK_SELECTION_MULTIPLE, we need to count the number of selected rows first and use @@ -2446,6 +2470,7 @@ void TextureBrowser_renameTag() void TextureBrowser_deleteTag() { + auto &g_TextureBrowser = GlobalTextureBrowser(); GSList *selected = NULL; auto selection = gtk_tree_view_get_selection(g_TextureBrowser.m_treeViewTags); @@ -2489,12 +2514,14 @@ void TextureBrowser_deleteTag() void TextureBrowser_copyTag() { + auto &g_TextureBrowser = GlobalTextureBrowser(); g_TextureBrowser.m_copied_tags.clear(); TagBuilder.GetShaderTags(g_TextureBrowser.shader.c_str(), g_TextureBrowser.m_copied_tags); } void TextureBrowser_pasteTag() { + auto &g_TextureBrowser = GlobalTextureBrowser(); IShader *ishader = QERApp_Shader_ForName(g_TextureBrowser.shader.c_str()); CopiedString shader = g_TextureBrowser.shader.c_str(); @@ -2553,6 +2580,7 @@ void TextureBrowser_RefreshShaders() void TextureBrowser_ToggleShowShaders() { + auto &g_TextureBrowser = GlobalTextureBrowser(); g_TextureBrowser.m_showShaders ^= 1; g_TextureBrowser.m_showshaders_item.update(); TextureBrowser_queueDraw(g_TextureBrowser); @@ -2560,6 +2588,7 @@ void TextureBrowser_ToggleShowShaders() void TextureBrowser_ToggleShowShaderListOnly() { + auto &g_TextureBrowser = GlobalTextureBrowser(); g_TextureBrowser_shaderlistOnly ^= 1; g_TextureBrowser.m_showshaderlistonly_item.update(); @@ -2568,6 +2597,7 @@ void TextureBrowser_ToggleShowShaderListOnly() void TextureBrowser_showAll() { + auto &g_TextureBrowser = GlobalTextureBrowser(); g_TextureBrowser_currentDirectory = ""; g_TextureBrowser.m_searchedTags = false; TextureBrowser_heightChanged(g_TextureBrowser); @@ -2576,6 +2606,7 @@ void TextureBrowser_showAll() void TextureBrowser_showUntagged() { + auto &g_TextureBrowser = GlobalTextureBrowser(); auto result = ui::alert(g_TextureBrowser.m_parent, "WARNING! This function might need a lot of memory and time. Are you sure you want to use it?", "Show Untagged", ui::alert_type::YESNO, ui::alert_icon::Warning); @@ -2692,6 +2723,7 @@ struct TextureScale { struct UniformTextureSize { static void Export(const TextureBrowser &self, const Callback &returnz) { + auto &g_TextureBrowser = GlobalTextureBrowser(); returnz(g_TextureBrowser.m_uniformTextureSize); } @@ -2751,6 +2783,7 @@ void TextureClipboard_textureSelected(const char *shader); void TextureBrowser_Construct() { + auto &g_TextureBrowser = GlobalTextureBrowser(); GlobalCommands_insert("ShaderInfo", makeCallbackF(TextureBrowser_shaderInfo)); GlobalCommands_insert("ShowUntagged", makeCallbackF(TextureBrowser_showUntagged)); GlobalCommands_insert("AddTag", makeCallbackF(TextureBrowser_addTag)); diff --git a/radiant/texwindow.h b/radiant/texwindow.h index 5c5e5d8f..eae12747 100644 --- a/radiant/texwindow.h +++ b/radiant/texwindow.h @@ -33,7 +33,9 @@ class TextureBrowser; TextureBrowser &GlobalTextureBrowser(); -ui::Widget TextureBrowser_constructWindow(ui::Window toplevel); +struct OpenGLBinding; + +ui::Widget TextureBrowser_constructWindow(ui::Window toplevel, OpenGLBinding &GL); void TextureBrowser_destroyWindow(); diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 2bd7fe24..2d8b75fd 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -73,7 +73,7 @@ #include "grid.h" #include "windowobservers.h" -void LoadTextureRGBA(qtexture_t *q, unsigned char *pPixels, int nWidth, int nHeight); +void LoadTextureRGBA(OpenGLBinding &GL, qtexture_t *q, unsigned char *pPixels, int nWidth, int nHeight); // d1223m extern bool g_brush_always_caulk; @@ -111,10 +111,10 @@ public: }; /*! Draw clip/path point with rasterized number label */ - void Draw(int num, float scale); + void Draw(OpenGLBinding &GL, int num, float scale); /*! Draw clip/path point with rasterized string label */ - void Draw(const char *label, float scale); + void Draw(OpenGLBinding &GL, const char *label, float scale); }; VIEWTYPE g_clip_viewtype; @@ -126,14 +126,14 @@ ClipPoint g_Clip3; ClipPoint *g_pMovingClip = 0; /* Drawing clip points */ -void ClipPoint::Draw(int num, float scale) +void ClipPoint::Draw(OpenGLBinding &GL, int num, float scale) { StringOutputStream label(4); label << num; - Draw(label.c_str(), scale); + Draw(GL, label.c_str(), scale); } -void ClipPoint::Draw(const char *label, float scale) +void ClipPoint::Draw(OpenGLBinding &GL, const char *label, float scale) { // draw point glPointSize(4); @@ -194,17 +194,17 @@ inline ClipPoint *GlobalClipPoints_Find(const Vector3 &point, VIEWTYPE viewtype, return bestClip; } -inline void GlobalClipPoints_Draw(float scale) +inline void GlobalClipPoints_Draw(OpenGLBinding &GL, float scale) { // Draw clip points if (g_Clip1.Set()) { - g_Clip1.Draw(1, scale); + g_Clip1.Draw(GL, 1, scale); } if (g_Clip2.Set()) { - g_Clip2.Draw(2, scale); + g_Clip2.Draw(GL, 2, scale); } if (g_Clip3.Set()) { - g_Clip3.Draw(3, scale); + g_Clip3.Draw(GL, 3, scale); } } @@ -811,6 +811,7 @@ gboolean xywnd_size_allocate(ui::Widget widget, GtkAllocation *allocation, XYWnd gboolean xywnd_expose(ui::Widget widget, GdkEventExpose *event, XYWnd *xywnd) { + OpenGLBinding &GL = xywnd->GL; if (glwidget_make_current(xywnd->GetWidget()) != FALSE) { if (Map_Valid(g_map) && ScreenUpdates_Enabled()) { GlobalOpenGL_debugAssertNoErrors(); @@ -832,8 +833,9 @@ void XYWnd_CameraMoved(XYWnd &xywnd) } } -XYWnd::XYWnd() : - m_gl_widget(glwidget_new(FALSE)), +XYWnd::XYWnd(OpenGLBinding &GL) : + GL(GL), + m_gl_widget(glwidget_new(GL, FALSE)), m_deferredDraw(WidgetQueueDrawCaller(m_gl_widget)), m_deferred_motion(xywnd_motion, this), m_parent(ui::null), @@ -1526,7 +1528,7 @@ void XYWnd::XY_LoadBackgroundImage(const char *name) return; } g_pParentWnd->ActiveXY()->m_tex = (qtexture_t *) malloc(sizeof(qtexture_t)); - LoadTextureRGBA(g_pParentWnd->ActiveXY()->XYWnd::m_tex, image->getRGBAPixels(), image->getWidth(), + LoadTextureRGBA(GL, g_pParentWnd->ActiveXY()->XYWnd::m_tex, image->getRGBAPixels(), image->getWidth(), image->getHeight()); globalOutputStream() << "Loaded background texture " << relative << "\n"; g_pParentWnd->ActiveXY()->m_backgroundActivated = true; @@ -1630,14 +1632,14 @@ void XYWnd::XY_DrawAxis(void) // now print axis symbols glColor3fv(vector3_to_array(colourX)); glRasterPos2f(m_vOrigin[nDim1] - w + 55 / m_fScale, m_vOrigin[nDim2] + h - 55 / m_fScale); - GlobalOpenGL().drawChar(g_AxisName[nDim1]); + GL.drawChar(g_AxisName[nDim1]); glRasterPos2f(28 / m_fScale, -10 / m_fScale); - GlobalOpenGL().drawChar(g_AxisName[nDim1]); + GL.drawChar(g_AxisName[nDim1]); glColor3fv(vector3_to_array(colourY)); glRasterPos2f(m_vOrigin[nDim1] - w + 25 / m_fScale, m_vOrigin[nDim2] + h - 30 / m_fScale); - GlobalOpenGL().drawChar(g_AxisName[nDim2]); + GL.drawChar(g_AxisName[nDim2]); glRasterPos2f(-10 / m_fScale, 28 / m_fScale); - GlobalOpenGL().drawChar(g_AxisName[nDim2]); + GL.drawChar(g_AxisName[nDim2]); } } @@ -1800,17 +1802,17 @@ void XYWnd::XY_DrawGrid(void) // draw coordinate text if needed if (g_xywindow_globals_private.show_coordinates) { glColor4fv(vector4_to_array(Vector4(g_xywindow_globals.color_gridtext, 1.0f))); - float offx = m_vOrigin[nDim2] + h - (4 + GlobalOpenGL().m_font->getPixelAscent()) / m_fScale; + float offx = m_vOrigin[nDim2] + h - (4 + GL.m_font->getPixelAscent()) / m_fScale; float offy = m_vOrigin[nDim1] - w + 4 / m_fScale; for (x = xb - fmod(xb, stepx); x <= xe; x += stepx) { glRasterPos2f(x, offx); sprintf(text, "%g", x); - GlobalOpenGL().drawString(text); + GL.drawString(text); } for (y = yb - fmod(yb, stepy); y <= ye; y += stepy) { glRasterPos2f(offy, y); sprintf(text, "%g", y); - GlobalOpenGL().drawString(text); + GL.drawString(text); } if (Active()) { @@ -1821,7 +1823,7 @@ void XYWnd::XY_DrawGrid(void) if (!g_xywindow_globals_private.show_axis) { glRasterPos2f(m_vOrigin[nDim1] - w + 35 / m_fScale, m_vOrigin[nDim2] + h - 20 / m_fScale); - GlobalOpenGL().drawString(ViewType_getTitle(m_viewType)); + GL.drawString(ViewType_getTitle(m_viewType)); } } @@ -1935,7 +1937,7 @@ void XYWnd::XY_DrawBlockGrid() y + (g_xywindow_globals_private.blockSize / 2)); sprintf(text, "%i,%i", (int) floor(x / g_xywindow_globals_private.blockSize), (int) floor(y / g_xywindow_globals_private.blockSize)); - GlobalOpenGL().drawString(text); + GL.drawString(text); } } } @@ -2041,18 +2043,18 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, Vector3 &vMinBounds, Vector3 &vM glRasterPos3f(Betwixt(vMinBounds[nDim1], vMaxBounds[nDim1]), vMinBounds[nDim2] - 20.0f / m_fScale, 0.0f); dimensions << g_pDimStrings[nDim1] << vSize[nDim1]; - GlobalOpenGL().drawString(dimensions.c_str()); + GL.drawString(dimensions.c_str()); dimensions.clear(); glRasterPos3f(vMaxBounds[nDim1] + 16.0f / m_fScale, Betwixt(vMinBounds[nDim2], vMaxBounds[nDim2]), 0.0f); dimensions << g_pDimStrings[nDim2] << vSize[nDim2]; - GlobalOpenGL().drawString(dimensions.c_str()); + GL.drawString(dimensions.c_str()); dimensions.clear(); glRasterPos3f(vMinBounds[nDim1] + 4, vMaxBounds[nDim2] + 8 / m_fScale, 0.0f); dimensions << "(" << g_pOrgStrings[0][0] << vMinBounds[nDim1] << " " << g_pOrgStrings[0][1] << vMaxBounds[nDim2] << ")"; - GlobalOpenGL().drawString(dimensions.c_str()); + GL.drawString(dimensions.c_str()); } else if (m_viewType == XZ) { glBegin(GL_LINES); @@ -2079,18 +2081,18 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, Vector3 &vMinBounds, Vector3 &vM glRasterPos3f(Betwixt(vMinBounds[nDim1], vMaxBounds[nDim1]), 0, vMinBounds[nDim2] - 20.0f / m_fScale); dimensions << g_pDimStrings[nDim1] << vSize[nDim1]; - GlobalOpenGL().drawString(dimensions.c_str()); + GL.drawString(dimensions.c_str()); dimensions.clear(); glRasterPos3f(vMaxBounds[nDim1] + 16.0f / m_fScale, 0, Betwixt(vMinBounds[nDim2], vMaxBounds[nDim2])); dimensions << g_pDimStrings[nDim2] << vSize[nDim2]; - GlobalOpenGL().drawString(dimensions.c_str()); + GL.drawString(dimensions.c_str()); dimensions.clear(); glRasterPos3f(vMinBounds[nDim1] + 4, 0, vMaxBounds[nDim2] + 8 / m_fScale); dimensions << "(" << g_pOrgStrings[1][0] << vMinBounds[nDim1] << " " << g_pOrgStrings[1][1] << vMaxBounds[nDim2] << ")"; - GlobalOpenGL().drawString(dimensions.c_str()); + GL.drawString(dimensions.c_str()); } else { glBegin(GL_LINES); @@ -2117,18 +2119,18 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, Vector3 &vMinBounds, Vector3 &vM glRasterPos3f(0, Betwixt(vMinBounds[nDim1], vMaxBounds[nDim1]), vMinBounds[nDim2] - 20.0f / m_fScale); dimensions << g_pDimStrings[nDim1] << vSize[nDim1]; - GlobalOpenGL().drawString(dimensions.c_str()); + GL.drawString(dimensions.c_str()); dimensions.clear(); glRasterPos3f(0, vMaxBounds[nDim1] + 16.0f / m_fScale, Betwixt(vMinBounds[nDim2], vMaxBounds[nDim2])); dimensions << g_pDimStrings[nDim2] << vSize[nDim2]; - GlobalOpenGL().drawString(dimensions.c_str()); + GL.drawString(dimensions.c_str()); dimensions.clear(); glRasterPos3f(0, vMinBounds[nDim1] + 4.0f, vMaxBounds[nDim2] + 8 / m_fScale); dimensions << "(" << g_pOrgStrings[2][0] << vMinBounds[nDim1] << " " << g_pOrgStrings[2][1] << vMaxBounds[nDim2] << ")"; - GlobalOpenGL().drawString(dimensions.c_str()); + GL.drawString(dimensions.c_str()); } } @@ -2193,9 +2195,9 @@ public: } } - void render(const Matrix4 &modelview, const Matrix4 &projection) + void render(OpenGLBinding &GL, const Matrix4 &modelview, const Matrix4 &projection) { - GlobalShaderCache().render(m_globalstate, modelview, projection); + GlobalShaderCache().render(GL, m_globalstate, modelview, projection); } private: @@ -2357,7 +2359,7 @@ void XYWnd::XY_Draw() Scene_Render(renderer, m_view); GlobalOpenGL_debugAssertNoErrors(); - renderer.render(m_modelview, m_projection); + renderer.render(GL, m_modelview, m_projection); GlobalOpenGL_debugAssertNoErrors(); } @@ -2372,7 +2374,7 @@ void XYWnd::XY_Draw() GlobalOpenGL_debugAssertNoErrors(); glLineWidth(1); GlobalOpenGL_debugAssertNoErrors(); - if (GlobalOpenGL().GL_1_3()) { + if (GL.GL_1_3()) { glActiveTexture(GL_TEXTURE0); glClientActiveTexture(GL_TEXTURE0); } @@ -2422,7 +2424,7 @@ void XYWnd::XY_Draw() } if (ClipMode()) { - GlobalClipPoints_Draw(m_fScale); + GlobalClipPoints_Draw(GL, m_fScale); } GlobalOpenGL_debugAssertNoErrors(); @@ -2434,7 +2436,7 @@ void XYWnd::XY_Draw() DrawCameraIcon(Camera_getOrigin(*g_pParentWnd->GetCamWnd()), Camera_getAngles(*g_pParentWnd->GetCamWnd())); - Feedback_draw2D(m_viewType); + Feedback_draw2D(GL, m_viewType); if (g_xywindow_globals_private.show_outline) { if (Active()) { diff --git a/radiant/xywindow.h b/radiant/xywindow.h index aa6b5982..310654be 100644 --- a/radiant/xywindow.h +++ b/radiant/xywindow.h @@ -66,7 +66,12 @@ inline const char *ViewType_getTitle(VIEWTYPE viewtype) return ""; } +struct OpenGLBinding; + class XYWnd { +public: + OpenGLBinding &GL; +private: ui::GLArea m_gl_widget; guint m_sizeHandler; guint m_exposeHandler; @@ -76,7 +81,7 @@ class XYWnd { public: ui::Window m_parent; - XYWnd(); + XYWnd(OpenGLBinding &GL); ~XYWnd();