diff --git a/src/gl/data/gl_vertexbuffer.cpp b/src/gl/data/gl_vertexbuffer.cpp index 036224338..5c43c256c 100644 --- a/src/gl/data/gl_vertexbuffer.cpp +++ b/src/gl/data/gl_vertexbuffer.cpp @@ -366,9 +366,9 @@ void FFlatVertexBuffer::BindVBO() gl.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glVertexPointer(3,GL_FLOAT, sizeof(FFlatVertex), &VTO->x); glTexCoordPointer(2,GL_FLOAT, sizeof(FFlatVertex), &VTO->u); - gl.EnableClientState(GL_VERTEX_ARRAY); - gl.EnableClientState(GL_TEXTURE_COORD_ARRAY); - gl.DisableClientState(GL_INDEX_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_INDEX_ARRAY); } } diff --git a/src/gl/dynlights/gl_dynlight1.cpp b/src/gl/dynlights/gl_dynlight1.cpp index 4c9f929f4..386590f61 100644 --- a/src/gl/dynlights/gl_dynlight1.cpp +++ b/src/gl/dynlights/gl_dynlight1.cpp @@ -227,7 +227,7 @@ bool gl_SetupLight(Plane & p, ADynamicLight * light, Vector & nearPt, Vector & u g= (g*(32-desaturation)+ gray*desaturation)/32; b= (b*(32-desaturation)+ gray*desaturation)/32; } - gl.Color3f(r,g,b); + glColor3f(r,g,b); return true; } diff --git a/src/gl/dynlights/gl_lightbuffer.cpp b/src/gl/dynlights/gl_lightbuffer.cpp index d3a62a718..6280f650b 100644 --- a/src/gl/dynlights/gl_lightbuffer.cpp +++ b/src/gl/dynlights/gl_lightbuffer.cpp @@ -72,12 +72,12 @@ FLightBuffer::FLightBuffer() gl.GenBuffers(1, &mIDbuf_Position); gl.BindBuffer(GL_TEXTURE_BUFFER, mIDbuf_Position); - gl.GenTextures(1, &mIDtex_RGB); - gl.BindTexture(GL_TEXTURE_BUFFER, mIDtex_RGB); + glGenTextures(1, &mIDtex_RGB); + glBindTexture(GL_TEXTURE_BUFFER, mIDtex_RGB); gl.TexBufferARB(GL_TEXTURE_BUFFER, GL_RGBA8, mIDbuf_RGB); - gl.GenTextures(1, &mIDtex_Position); - gl.BindTexture(GL_TEXTURE_BUFFER, mIDtex_Position); + glGenTextures(1, &mIDtex_Position); + glBindTexture(GL_TEXTURE_BUFFER, mIDtex_Position); gl.TexBufferARB(GL_TEXTURE_BUFFER, GL_RGBA32F, mIDbuf_Position); } @@ -94,9 +94,9 @@ FLightBuffer::~FLightBuffer() gl.DeleteBuffers(1, &mIDbuf_RGB); gl.DeleteBuffers(1, &mIDbuf_Position); - gl.BindTexture(GL_TEXTURE_BUFFER, 0); - gl.DeleteTextures(1, &mIDtex_RGB); - gl.DeleteTextures(1, &mIDtex_Position); + glBindTexture(GL_TEXTURE_BUFFER, 0); + glDeleteTextures(1, &mIDtex_RGB); + glDeleteTextures(1, &mIDtex_Position); } @@ -109,9 +109,9 @@ FLightBuffer::~FLightBuffer() void FLightBuffer::BindTextures(int texunit1, int texunit2) { gl.ActiveTexture(texunit1); - gl.BindTexture(GL_TEXTURE_BUFFER, mIDtex_RGB); + glBindTexture(GL_TEXTURE_BUFFER, mIDtex_RGB); gl.ActiveTexture(texunit2); - gl.BindTexture(GL_TEXTURE_BUFFER, mIDtex_Position); + glBindTexture(GL_TEXTURE_BUFFER, mIDtex_Position); gl.ActiveTexture(GL_TEXTURE0); } @@ -176,8 +176,8 @@ FLightIndexBuffer::FLightIndexBuffer() gl.GenBuffers(1, &mIDBuffer); gl.BindBuffer(GL_TEXTURE_BUFFER, mIDBuffer); - gl.GenTextures(1, &mIDTexture); - gl.BindTexture(GL_TEXTURE_BUFFER, mIDTexture); + glGenTextures(1, &mIDTexture); + glBindTexture(GL_TEXTURE_BUFFER, mIDTexture); gl.TexBufferARB(GL_TEXTURE_BUFFER, GL_R16UI, mIDBuffer); } @@ -192,8 +192,8 @@ FLightIndexBuffer::~FLightIndexBuffer() gl.BindBuffer(GL_TEXTURE_BUFFER, 0); gl.DeleteBuffers(1, &mIDBuffer); - gl.BindTexture(GL_TEXTURE_BUFFER, 0); - gl.DeleteTextures(1, &mIDTexture); + glBindTexture(GL_TEXTURE_BUFFER, 0); + glDeleteTextures(1, &mIDTexture); } @@ -234,7 +234,7 @@ void FLightIndexBuffer::SendBuffer() void FLightIndexBuffer::BindTexture(int texunit1) { gl.ActiveTexture(texunit1); - gl.BindTexture(GL_TEXTURE_BUFFER, mIDTexture); + glBindTexture(GL_TEXTURE_BUFFER, mIDTexture); gl.ActiveTexture(GL_TEXTURE0); } diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index 9f13bee7d..3a89bcbbc 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -696,7 +696,7 @@ void gl_RenderModel(GLSprite * spr, int cm) // Setup transformation. - gl.DepthFunc(GL_LEQUAL); + glDepthFunc(GL_LEQUAL); gl_RenderState.SetTextureMode(TM_MODULATE); gl_RenderState.EnableTexture(true); // [BB] In case the model should be rendered translucent, do back face culling. @@ -704,7 +704,7 @@ void gl_RenderModel(GLSprite * spr, int cm) // TO-DO: Implement proper depth sorting. if (!( spr->actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] )) { - gl.Enable(GL_CULL_FACE); + glEnable(GL_CULL_FACE); glFrontFace(GL_CW); } @@ -754,45 +754,45 @@ void gl_RenderModel(GLSprite * spr, int cm) if (gl.shadermodel < 4) { - gl.MatrixMode(GL_MODELVIEW); - gl.PushMatrix(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); } else { gl.ActiveTexture(GL_TEXTURE7); // Hijack the otherwise unused seventh texture matrix for the model to world transformation. - gl.MatrixMode(GL_TEXTURE); - gl.LoadIdentity(); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); } // Model space => World space - gl.Translatef(spr->x, spr->z, spr->y ); + glTranslatef(spr->x, spr->z, spr->y ); // Applying model transformations: // 1) Applying actor angle, pitch and roll to the model - gl.Rotatef(-angle, 0, 1, 0); - gl.Rotatef(pitch, 0, 0, 1); - gl.Rotatef(-roll, 1, 0, 0); + glRotatef(-angle, 0, 1, 0); + glRotatef(pitch, 0, 0, 1); + glRotatef(-roll, 1, 0, 0); // 2) Applying Doomsday like rotation of the weapon pickup models // The rotation angle is based on the elapsed time. if( smf->flags & MDL_ROTATING ) { - gl.Translatef(smf->rotationCenterX, smf->rotationCenterY, smf->rotationCenterZ); - gl.Rotatef(rotateOffset, smf->xrotate, smf->yrotate, smf->zrotate); - gl.Translatef(-smf->rotationCenterX, -smf->rotationCenterY, -smf->rotationCenterZ); + glTranslatef(smf->rotationCenterX, smf->rotationCenterY, smf->rotationCenterZ); + glRotatef(rotateOffset, smf->xrotate, smf->yrotate, smf->zrotate); + glTranslatef(-smf->rotationCenterX, -smf->rotationCenterY, -smf->rotationCenterZ); } // 3) Scaling model. - gl.Scalef(scaleFactorX, scaleFactorZ, scaleFactorY); + glScalef(scaleFactorX, scaleFactorZ, scaleFactorY); // 4) Aplying model offsets (model offsets do not depend on model scalings). - gl.Translatef(smf->xoffset / smf->xscale, smf->zoffset / smf->zscale, smf->yoffset / smf->yscale); + glTranslatef(smf->xoffset / smf->xscale, smf->zoffset / smf->zscale, smf->yoffset / smf->yscale); // 5) Applying model rotations. - gl.Rotatef(-ANGLE_TO_FLOAT(smf->angleoffset), 0, 1, 0); - gl.Rotatef(smf->pitchoffset, 0, 0, 1); - gl.Rotatef(-smf->rolloffset, 1, 0, 0); + glRotatef(-ANGLE_TO_FLOAT(smf->angleoffset), 0, 1, 0); + glRotatef(smf->pitchoffset, 0, 0, 1); + glRotatef(-smf->rolloffset, 1, 0, 0); if (gl.shadermodel >= 4) gl.ActiveTexture(GL_TEXTURE0); @@ -815,21 +815,21 @@ void gl_RenderModel(GLSprite * spr, int cm) if (gl.shadermodel < 4) { - gl.MatrixMode(GL_MODELVIEW); - gl.PopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); } else { gl.ActiveTexture(GL_TEXTURE7); - gl.MatrixMode(GL_TEXTURE); - gl.LoadIdentity(); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); gl.ActiveTexture(GL_TEXTURE0); - gl.MatrixMode(GL_MODELVIEW); + glMatrixMode(GL_MODELVIEW); } - gl.DepthFunc(GL_LESS); + glDepthFunc(GL_LESS); if (!( spr->actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] )) - gl.Disable(GL_CULL_FACE); + glDisable(GL_CULL_FACE); } @@ -850,45 +850,45 @@ void gl_RenderHUDModel(pspdef_t *psp, fixed_t ofsx, fixed_t ofsy, int cm) // [BB] The model has to be drawn independtly from the position of the player, // so we have to reset the GL_MODELVIEW matrix. - gl.MatrixMode(GL_MODELVIEW); - gl.PushMatrix(); - gl.LoadIdentity(); - gl.DepthFunc(GL_LEQUAL); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + glDepthFunc(GL_LEQUAL); // [BB] In case the model should be rendered translucent, do back face culling. // This solves a few of the problems caused by the lack of depth sorting. // TO-DO: Implement proper depth sorting. if (!( playermo->RenderStyle == LegacyRenderStyles[STYLE_Normal] )) { - gl.Enable(GL_CULL_FACE); + glEnable(GL_CULL_FACE); glFrontFace(GL_CCW); } // Scaling model (y scale for a sprite means height, i.e. z in the world!). - gl.Scalef(smf->xscale, smf->zscale, smf->yscale); + glScalef(smf->xscale, smf->zscale, smf->yscale); // Aplying model offsets (model offsets do not depend on model scalings). - gl.Translatef(smf->xoffset / smf->xscale, smf->zoffset / smf->zscale, smf->yoffset / smf->yscale); + glTranslatef(smf->xoffset / smf->xscale, smf->zoffset / smf->zscale, smf->yoffset / smf->yscale); // [BB] Weapon bob, very similar to the normal Doom weapon bob. - gl.Rotatef(FIXED2FLOAT(ofsx)/4, 0, 1, 0); - gl.Rotatef(-FIXED2FLOAT(ofsy-WEAPONTOP)/4, 1, 0, 0); + glRotatef(FIXED2FLOAT(ofsx)/4, 0, 1, 0); + glRotatef(-FIXED2FLOAT(ofsy-WEAPONTOP)/4, 1, 0, 0); // [BB] For some reason the jDoom models need to be rotated. - gl.Rotatef(90., 0, 1, 0); + glRotatef(90., 0, 1, 0); // Applying angleoffset, pitchoffset, rolloffset. - gl.Rotatef(-ANGLE_TO_FLOAT(smf->angleoffset), 0, 1, 0); - gl.Rotatef(smf->pitchoffset, 0, 0, 1); - gl.Rotatef(-smf->rolloffset, 1, 0, 0); + glRotatef(-ANGLE_TO_FLOAT(smf->angleoffset), 0, 1, 0); + glRotatef(smf->pitchoffset, 0, 0, 1); + glRotatef(-smf->rolloffset, 1, 0, 0); gl_RenderFrameModels( smf, psp->state, psp->tics, playermo->player->ReadyWeapon->GetClass(), cm, NULL, 0 ); - gl.MatrixMode(GL_MODELVIEW); - gl.PopMatrix(); - gl.DepthFunc(GL_LESS); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + glDepthFunc(GL_LESS); if (!( playermo->RenderStyle == LegacyRenderStyles[STYLE_Normal] )) - gl.Disable(GL_CULL_FACE); + glDisable(GL_CULL_FACE); } //=========================================================================== diff --git a/src/gl/models/gl_models_md2.cpp b/src/gl/models/gl_models_md2.cpp index 1ff98629d..f5ac5d2bf 100644 --- a/src/gl/models/gl_models_md2.cpp +++ b/src/gl/models/gl_models_md2.cpp @@ -279,7 +279,7 @@ void FDMDModel::RenderGLCommands(void *glCommands, unsigned int numVertices,FMod pos += 4; // The type of primitive depends on the sign. - gl.Begin(count > 0 ? GL_TRIANGLE_STRIP : GL_TRIANGLE_FAN); + glBegin(count > 0 ? GL_TRIANGLE_STRIP : GL_TRIANGLE_FAN); count = abs(count); while(count--) @@ -287,11 +287,11 @@ void FDMDModel::RenderGLCommands(void *glCommands, unsigned int numVertices,FMod v = (FGLCommandVertex *) pos; pos += sizeof(FGLCommandVertex); - gl.TexCoord2fv(&v->s); - gl.Vertex3fv((float*)&vertices[v->index]); + glTexCoord2fv(&v->s); + glVertex3fv((float*)&vertices[v->index]); } - gl.End(); + glEnd(); } } diff --git a/src/gl/models/gl_models_md3.cpp b/src/gl/models/gl_models_md3.cpp index 72bf6d655..12509b769 100644 --- a/src/gl/models/gl_models_md3.cpp +++ b/src/gl/models/gl_models_md3.cpp @@ -218,18 +218,18 @@ int FMD3Model::FindFrame(const char * name) void FMD3Model::RenderTriangles(MD3Surface * surf, MD3Vertex * vert) { gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLES); + glBegin(GL_TRIANGLES); for(int i=0; inumTriangles;i++) { for(int j=0;j<3;j++) { int x = surf->tris[i].VertIndex[j]; - gl.TexCoord2fv(&surf->texcoords[x].s); - gl.Vertex3f(vert[x].x, vert[x].z, vert[x].y); + glTexCoord2fv(&surf->texcoords[x].s); + glVertex3f(vert[x].x, vert[x].z, vert[x].y); } } - gl.End(); + glEnd(); } void FMD3Model::RenderFrame(FTexture * skin, int frameno, int cm, int translation) @@ -239,8 +239,8 @@ void FMD3Model::RenderFrame(FTexture * skin, int frameno, int cm, int translatio MD3Frame * frame = &frames[frameno]; // I can't confirm correctness of this because no model I have tested uses this information - // gl.MatrixMode(GL_MODELVIEW); - // gl.Translatef(frame->origin[0], frame->origin[1], frame->origin[2]); + // glMatrixMode(GL_MODELVIEW); + // glTranslatef(frame->origin[0], frame->origin[1], frame->origin[2]); for(int i=0;ix); glTexCoordPointer(2,GL_FLOAT, sizeof(FVoxelVertex), &VVO->u); - gl.EnableClientState(GL_VERTEX_ARRAY); - gl.EnableClientState(GL_TEXTURE_COORD_ARRAY); - gl.EnableClientState(GL_INDEX_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glEnableClientState(GL_INDEX_ARRAY); } @@ -481,14 +481,14 @@ void FVoxelModel::RenderFrame(FTexture * skin, int frame, int cm, int translatio } } - gl.Begin(GL_QUADS); + glBegin(GL_QUADS); for(unsigned i=0;i < mIndices.Size(); i++) { FVoxelVertex *vert = &mVertices[mIndices[i]]; - gl.TexCoord2fv(&vert->u); - gl.Vertex3fv(&vert->x); + glTexCoord2fv(&vert->u); + glVertex3fv(&vert->x); } - gl.End(); + glEnd(); } //=========================================================================== diff --git a/src/gl/renderer/gl_lightdata.cpp b/src/gl/renderer/gl_lightdata.cpp index 9c77803fc..5be90d3cf 100644 --- a/src/gl/renderer/gl_lightdata.cpp +++ b/src/gl/renderer/gl_lightdata.cpp @@ -331,11 +331,11 @@ void gl_SetColor(int light, int rellight, const FColormap * cm, float alpha, Pal if (glset.lightmode != 8) { - gl.Color4f(r * ThingColor.r/255.0f, g * ThingColor.g/255.0f, b * ThingColor.b/255.0f, alpha); + glColor4f(r * ThingColor.r/255.0f, g * ThingColor.g/255.0f, b * ThingColor.b/255.0f, alpha); } else { - gl.Color4f(r, g, b, alpha); + glColor4f(r, g, b, alpha); if (gl_fixedcolormap) { diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index e398a04c2..b1ef3244f 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -267,33 +267,33 @@ void FGLRenderer::ClearBorders() int borderHeight = (trueHeight - height) / 2; - gl.Viewport(0, 0, width, trueHeight); - gl.MatrixMode(GL_PROJECTION); - gl.LoadIdentity(); - gl.Ortho(0.0, width * 1.0, 0.0, trueHeight, -1.0, 1.0); - gl.MatrixMode(GL_MODELVIEW); - gl.Color3f(0.f, 0.f, 0.f); + glViewport(0, 0, width, trueHeight); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0.0, width * 1.0, 0.0, trueHeight, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glColor3f(0.f, 0.f, 0.f); gl_RenderState.Set2DMode(true); gl_RenderState.EnableTexture(false); gl_RenderState.Apply(true); - gl.Begin(GL_QUADS); + glBegin(GL_QUADS); // upper quad - gl.Vertex2i(0, borderHeight); - gl.Vertex2i(0, 0); - gl.Vertex2i(width, 0); - gl.Vertex2i(width, borderHeight); + glVertex2i(0, borderHeight); + glVertex2i(0, 0); + glVertex2i(width, 0); + glVertex2i(width, borderHeight); // lower quad - gl.Vertex2i(0, trueHeight); - gl.Vertex2i(0, trueHeight - borderHeight); - gl.Vertex2i(width, trueHeight - borderHeight); - gl.Vertex2i(width, trueHeight); - gl.End(); + glVertex2i(0, trueHeight); + glVertex2i(0, trueHeight - borderHeight); + glVertex2i(width, trueHeight - borderHeight); + glVertex2i(width, trueHeight); + glEnd(); gl_RenderState.EnableTexture(true); - gl.Viewport(0, (trueHeight - height) / 2, width, height); + glViewport(0, (trueHeight - height) / 2, width, height); } //========================================================================== @@ -386,9 +386,9 @@ void FGLRenderer::DrawTexture(FTexture *img, DCanvas::DrawParms &parms) int btm = (SCREENHEIGHT - screen->GetHeight()) / 2; btm = SCREENHEIGHT - btm; - gl.Enable(GL_SCISSOR_TEST); + glEnable(GL_SCISSOR_TEST); int space = (static_cast(screen)->GetTrueHeight()-screen->GetHeight())/2; - gl.Scissor(parms.lclip, btm - parms.dclip + space, parms.rclip - parms.lclip, parms.dclip - parms.uclip); + glScissor(parms.lclip, btm - parms.dclip + space, parms.rclip - parms.lclip, parms.dclip - parms.uclip); gl_SetRenderStyle(parms.style, !parms.masked, false); if (img->bHasCanvas) @@ -396,20 +396,20 @@ void FGLRenderer::DrawTexture(FTexture *img, DCanvas::DrawParms &parms) gl_RenderState.SetTextureMode(TM_OPAQUE); } - gl.Color4f(r, g, b, FIXED2FLOAT(parms.alpha)); + glColor4f(r, g, b, FIXED2FLOAT(parms.alpha)); gl_RenderState.EnableAlphaTest(false); gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_STRIP); - gl.TexCoord2f(u1, v1); + glBegin(GL_TRIANGLE_STRIP); + glTexCoord2f(u1, v1); glVertex2d(x, y); - gl.TexCoord2f(u1, v2); + glTexCoord2f(u1, v2); glVertex2d(x, y + h); - gl.TexCoord2f(u2, v1); + glTexCoord2f(u2, v1); glVertex2d(x + w, y); - gl.TexCoord2f(u2, v2); + glTexCoord2f(u2, v2); glVertex2d(x + w, y + h); - gl.End(); + glEnd(); if (parms.colorOverlay) { @@ -417,23 +417,23 @@ void FGLRenderer::DrawTexture(FTexture *img, DCanvas::DrawParms &parms) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); gl_RenderState.BlendEquation(GL_FUNC_ADD); gl_RenderState.Apply(); - gl.Color4ub(RPART(parms.colorOverlay),GPART(parms.colorOverlay),BPART(parms.colorOverlay),APART(parms.colorOverlay)); - gl.Begin(GL_TRIANGLE_STRIP); - gl.TexCoord2f(u1, v1); + glColor4ub(RPART(parms.colorOverlay),GPART(parms.colorOverlay),BPART(parms.colorOverlay),APART(parms.colorOverlay)); + glBegin(GL_TRIANGLE_STRIP); + glTexCoord2f(u1, v1); glVertex2d(x, y); - gl.TexCoord2f(u1, v2); + glTexCoord2f(u1, v2); glVertex2d(x, y + h); - gl.TexCoord2f(u2, v1); + glTexCoord2f(u2, v1); glVertex2d(x + w, y); - gl.TexCoord2f(u2, v2); + glTexCoord2f(u2, v2); glVertex2d(x + w, y + h); - gl.End(); + glEnd(); } gl_RenderState.EnableAlphaTest(true); - gl.Scissor(0, 0, screen->GetWidth(), screen->GetHeight()); - gl.Disable(GL_SCISSOR_TEST); + glScissor(0, 0, screen->GetWidth(), screen->GetHeight()); + glDisable(GL_SCISSOR_TEST); gl_RenderState.SetTextureMode(TM_MODULATE); gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); gl_RenderState.BlendEquation(GL_FUNC_ADD); @@ -449,11 +449,11 @@ void FGLRenderer::DrawLine(int x1, int y1, int x2, int y2, int palcolor, uint32 PalEntry p = color? (PalEntry)color : GPalette.BaseColors[palcolor]; gl_RenderState.EnableTexture(false); gl_RenderState.Apply(true); - gl.Color3ub(p.r, p.g, p.b); - gl.Begin(GL_LINES); - gl.Vertex2i(x1, y1); - gl.Vertex2i(x2, y2); - gl.End(); + glColor3ub(p.r, p.g, p.b); + glBegin(GL_LINES); + glVertex2i(x1, y1); + glVertex2i(x2, y2); + glEnd(); gl_RenderState.EnableTexture(true); } @@ -467,10 +467,10 @@ void FGLRenderer::DrawPixel(int x1, int y1, int palcolor, uint32 color) PalEntry p = color? (PalEntry)color : GPalette.BaseColors[palcolor]; gl_RenderState.EnableTexture(false); gl_RenderState.Apply(true); - gl.Color3ub(p.r, p.g, p.b); - gl.Begin(GL_POINTS); - gl.Vertex2i(x1, y1); - gl.End(); + glColor3ub(p.r, p.g, p.b); + glBegin(GL_POINTS); + glVertex2i(x1, y1); + glEnd(); gl_RenderState.EnableTexture(true); } @@ -493,13 +493,13 @@ void FGLRenderer::Dim(PalEntry color, float damount, int x1, int y1, int w, int g = color.g/255.0f; b = color.b/255.0f; - gl.Begin(GL_TRIANGLE_FAN); - gl.Color4f(r, g, b, damount); - gl.Vertex2i(x1, y1); - gl.Vertex2i(x1, y1 + h); - gl.Vertex2i(x1 + w, y1 + h); - gl.Vertex2i(x1 + w, y1); - gl.End(); + glBegin(GL_TRIANGLE_FAN); + glColor4f(r, g, b, damount); + glVertex2i(x1, y1); + glVertex2i(x1, y1 + h); + glVertex2i(x1 + w, y1 + h); + glVertex2i(x1 + w, y1); + glEnd(); gl_RenderState.EnableTexture(true); } @@ -535,13 +535,13 @@ void FGLRenderer::FlatFill (int left, int top, int right, int bottom, FTexture * fV2 = float(bottom-top) / src->GetHeight(); } gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_STRIP); - gl.Color4f(1, 1, 1, 1); - gl.TexCoord2f(fU1, fV1); gl.Vertex2f(left, top); - gl.TexCoord2f(fU1, fV2); gl.Vertex2f(left, bottom); - gl.TexCoord2f(fU2, fV1); gl.Vertex2f(right, top); - gl.TexCoord2f(fU2, fV2); gl.Vertex2f(right, bottom); - gl.End(); + glBegin(GL_TRIANGLE_STRIP); + glColor4f(1, 1, 1, 1); + glTexCoord2f(fU1, fV1); glVertex2f(left, top); + glTexCoord2f(fU1, fV2); glVertex2f(left, bottom); + glTexCoord2f(fU2, fV1); glVertex2f(right, top); + glTexCoord2f(fU2, fV2); glVertex2f(right, bottom); + glEnd(); } //========================================================================== @@ -570,14 +570,14 @@ void FGLRenderer::Clear(int left, int top, int right, int bottom, int palcolor, } */ - gl.Enable(GL_SCISSOR_TEST); - gl.Scissor(left, rt - height, width, height); + glEnable(GL_SCISSOR_TEST); + glScissor(left, rt - height, width, height); - gl.ClearColor(p.r/255.0f, p.g/255.0f, p.b/255.0f, 0.f); - gl.Clear(GL_COLOR_BUFFER_BIT); - gl.ClearColor(0.f, 0.f, 0.f, 0.f); + glClearColor(p.r/255.0f, p.g/255.0f, p.b/255.0f, 0.f); + glClear(GL_COLOR_BUFFER_BIT); + glClearColor(0.f, 0.f, 0.f, 0.f); - gl.Disable(GL_SCISSOR_TEST); + glDisable(GL_SCISSOR_TEST); } //========================================================================== @@ -609,7 +609,7 @@ void FGLRenderer::FillSimplePoly(FTexture *texture, FVector2 *points, int npoint lightlevel = gl_CalcLightLevel(lightlevel, 0, true); PalEntry pe = gl_CalcLightColor(lightlevel, cm.LightColor, cm.blendfactor, true); - gl.Color3ub(pe.r, pe.g, pe.b); + glColor3ub(pe.r, pe.g, pe.b); gltexture->Bind(cm.colormap); @@ -631,7 +631,7 @@ void FGLRenderer::FillSimplePoly(FTexture *texture, FVector2 *points, int npoint float oy = float(originy); gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_FAN); + glBegin(GL_TRIANGLE_FAN); for (i = 0; i < npoints; ++i) { float u = points[i].X - 0.5f - ox; @@ -642,9 +642,9 @@ void FGLRenderer::FillSimplePoly(FTexture *texture, FVector2 *points, int npoint u = t * cosrot - v * sinrot; v = v * cosrot + t * sinrot; } - gl.TexCoord2f(u * uscale, v * vscale); - gl.Vertex3f(points[i].X, points[i].Y /* + yoffs */, 0); + glTexCoord2f(u * uscale, v * vscale); + glVertex3f(points[i].X, points[i].Y /* + yoffs */, 0); } - gl.End(); + glEnd(); } diff --git a/src/gl/renderer/gl_renderstate.cpp b/src/gl/renderer/gl_renderstate.cpp index f986d7afc..7f7a2df67 100644 --- a/src/gl/renderer/gl_renderstate.cpp +++ b/src/gl/renderer/gl_renderstate.cpp @@ -297,16 +297,16 @@ void FRenderState::Apply(bool forcenoshader) } if (mTextureEnabled != ffTextureEnabled) { - if ((ffTextureEnabled = mTextureEnabled)) gl.Enable(GL_TEXTURE_2D); - else gl.Disable(GL_TEXTURE_2D); + if ((ffTextureEnabled = mTextureEnabled)) glEnable(GL_TEXTURE_2D); + else glDisable(GL_TEXTURE_2D); } if (mFogEnabled != ffFogEnabled) { if ((ffFogEnabled = mFogEnabled)) { - gl.Enable(GL_FOG); + glEnable(GL_FOG); } - else gl.Disable(GL_FOG); + else glDisable(GL_FOG); } if (mFogEnabled) { @@ -314,11 +314,11 @@ void FRenderState::Apply(bool forcenoshader) { ffFogColor = mFogColor; GLfloat FogColor[4]={mFogColor.r/255.0f,mFogColor.g/255.0f,mFogColor.b/255.0f,0.0f}; - gl.Fogfv(GL_FOG_COLOR, FogColor); + glFogfv(GL_FOG_COLOR, FogColor); } if (ffFogDensity != mFogDensity) { - gl.Fogf(GL_FOG_DENSITY, mFogDensity/64000.f); + glFogf(GL_FOG_DENSITY, mFogDensity/64000.f); ffFogDensity=mFogDensity; } } @@ -327,8 +327,8 @@ void FRenderState::Apply(bool forcenoshader) switch (ffSpecialEffect) { case EFF_SPHEREMAP: - gl.Disable(GL_TEXTURE_GEN_T); - gl.Disable(GL_TEXTURE_GEN_S); + glDisable(GL_TEXTURE_GEN_T); + glDisable(GL_TEXTURE_GEN_S); default: break; @@ -337,10 +337,10 @@ void FRenderState::Apply(bool forcenoshader) { case EFF_SPHEREMAP: // Use sphere mapping for this - gl.Enable(GL_TEXTURE_GEN_T); - gl.Enable(GL_TEXTURE_GEN_S); - gl.TexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP); - gl.TexGeni(GL_T,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP); + glEnable(GL_TEXTURE_GEN_T); + glEnable(GL_TEXTURE_GEN_S); + glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP); + glTexGeni(GL_T,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP); break; default: diff --git a/src/gl/scene/gl_decal.cpp b/src/gl/scene/gl_decal.cpp index b6478dd22..6bb109fa4 100644 --- a/src/gl/scene/gl_decal.cpp +++ b/src/gl/scene/gl_decal.cpp @@ -363,7 +363,7 @@ void GLWall::DrawDecal(DBaseDecal *decal) if (loadAlpha) { - gl.Color4f(red, green, blue, a); + glColor4f(red, green, blue, a); if (glset.lightmode == 8) { @@ -399,13 +399,13 @@ void GLWall::DrawDecal(DBaseDecal *decal) else gl_RenderState.AlphaFunc(GL_GREATER, 0.f); gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_FAN); + glBegin(GL_TRIANGLE_FAN); for(i=0;i<4;i++) { - gl.TexCoord2f(dv[i].u,dv[i].v); - gl.Vertex3f(dv[i].x,dv[i].z,dv[i].y); + glTexCoord2f(dv[i].u,dv[i].v); + glVertex3f(dv[i].x,dv[i].z,dv[i].y); } - gl.End(); + glEnd(); rendered_decals++; gl_RenderState.SetFog(fc,-1); gl_RenderState.SetDynLight(0,0,0); diff --git a/src/gl/scene/gl_drawinfo.cpp b/src/gl/scene/gl_drawinfo.cpp index a03cb01e2..62e604aca 100644 --- a/src/gl/scene/gl_drawinfo.cpp +++ b/src/gl/scene/gl_drawinfo.cpp @@ -981,55 +981,55 @@ void FDrawInfo::SetupFloodStencil(wallseg * ws) int recursion = GLPortal::GetRecursion(); // Create stencil - gl.StencilFunc(GL_EQUAL,recursion,~0); // create stencil - gl.StencilOp(GL_KEEP,GL_KEEP,GL_INCR); // increment stencil of valid pixels - gl.ColorMask(0,0,0,0); // don't write to the graphics buffer + glStencilFunc(GL_EQUAL,recursion,~0); // create stencil + glStencilOp(GL_KEEP,GL_KEEP,GL_INCR); // increment stencil of valid pixels + glColorMask(0,0,0,0); // don't write to the graphics buffer gl_RenderState.EnableTexture(false); - gl.Color3f(1,1,1); - gl.Enable(GL_DEPTH_TEST); - gl.DepthMask(true); + glColor3f(1,1,1); + glEnable(GL_DEPTH_TEST); + glDepthMask(true); gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_FAN); - gl.Vertex3f(ws->x1, ws->z1, ws->y1); - gl.Vertex3f(ws->x1, ws->z2, ws->y1); - gl.Vertex3f(ws->x2, ws->z2, ws->y2); - gl.Vertex3f(ws->x2, ws->z1, ws->y2); - gl.End(); + glBegin(GL_TRIANGLE_FAN); + glVertex3f(ws->x1, ws->z1, ws->y1); + glVertex3f(ws->x1, ws->z2, ws->y1); + glVertex3f(ws->x2, ws->z2, ws->y2); + glVertex3f(ws->x2, ws->z1, ws->y2); + glEnd(); - gl.StencilFunc(GL_EQUAL,recursion+1,~0); // draw sky into stencil - gl.StencilOp(GL_KEEP,GL_KEEP,GL_KEEP); // this stage doesn't modify the stencil + glStencilFunc(GL_EQUAL,recursion+1,~0); // draw sky into stencil + glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP); // this stage doesn't modify the stencil - gl.ColorMask(1,1,1,1); // don't write to the graphics buffer + glColorMask(1,1,1,1); // don't write to the graphics buffer gl_RenderState.EnableTexture(true); - gl.Disable(GL_DEPTH_TEST); - gl.DepthMask(false); + glDisable(GL_DEPTH_TEST); + glDepthMask(false); } void FDrawInfo::ClearFloodStencil(wallseg * ws) { int recursion = GLPortal::GetRecursion(); - gl.StencilOp(GL_KEEP,GL_KEEP,GL_DECR); + glStencilOp(GL_KEEP,GL_KEEP,GL_DECR); gl_RenderState.EnableTexture(false); - gl.ColorMask(0,0,0,0); // don't write to the graphics buffer - gl.Color3f(1,1,1); + glColorMask(0,0,0,0); // don't write to the graphics buffer + glColor3f(1,1,1); gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_FAN); - gl.Vertex3f(ws->x1, ws->z1, ws->y1); - gl.Vertex3f(ws->x1, ws->z2, ws->y1); - gl.Vertex3f(ws->x2, ws->z2, ws->y2); - gl.Vertex3f(ws->x2, ws->z1, ws->y2); - gl.End(); + glBegin(GL_TRIANGLE_FAN); + glVertex3f(ws->x1, ws->z1, ws->y1); + glVertex3f(ws->x1, ws->z2, ws->y1); + glVertex3f(ws->x2, ws->z2, ws->y2); + glVertex3f(ws->x2, ws->z1, ws->y2); + glEnd(); // restore old stencil op. - gl.StencilOp(GL_KEEP,GL_KEEP,GL_KEEP); - gl.StencilFunc(GL_EQUAL,recursion,~0); + glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP); + glStencilFunc(GL_EQUAL,recursion,~0); gl_RenderState.EnableTexture(true); - gl.ColorMask(1,1,1,1); - gl.Enable(GL_DEPTH_TEST); - gl.DepthMask(true); + glColorMask(1,1,1,1); + glEnable(GL_DEPTH_TEST); + glDepthMask(true); } //========================================================================== @@ -1078,7 +1078,7 @@ void FDrawInfo::DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, boo bool pushed = gl_SetPlaneTextureRotation(&plane, gltexture); - gl.Begin(GL_TRIANGLE_FAN); + glBegin(GL_TRIANGLE_FAN); float prj_fac1 = (planez-fviewz)/(ws->z1-fviewz); float prj_fac2 = (planez-fviewz)/(ws->z2-fviewz); @@ -1094,24 +1094,24 @@ void FDrawInfo::DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, boo float px4 = fviewx + prj_fac1 * (ws->x2-fviewx); float py4 = fviewy + prj_fac1 * (ws->y2-fviewy); - gl.TexCoord2f(px1 / 64, -py1 / 64); - gl.Vertex3f(px1, planez, py1); + glTexCoord2f(px1 / 64, -py1 / 64); + glVertex3f(px1, planez, py1); - gl.TexCoord2f(px2 / 64, -py2 / 64); - gl.Vertex3f(px2, planez, py2); + glTexCoord2f(px2 / 64, -py2 / 64); + glVertex3f(px2, planez, py2); - gl.TexCoord2f(px3 / 64, -py3 / 64); - gl.Vertex3f(px3, planez, py3); + glTexCoord2f(px3 / 64, -py3 / 64); + glVertex3f(px3, planez, py3); - gl.TexCoord2f(px4 / 64, -py4 / 64); - gl.Vertex3f(px4, planez, py4); + glTexCoord2f(px4 / 64, -py4 / 64); + glVertex3f(px4, planez, py4); - gl.End(); + glEnd(); if (pushed) { - gl.PopMatrix(); - gl.MatrixMode(GL_MODELVIEW); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); } } diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 71f2bb6c9..309d5cdfb 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -93,12 +93,12 @@ bool gl_SetPlaneTextureRotation(const GLSectorPlane * secplane, FMaterial * glte float xscale2=64.f/gltexture->TextureWidth(GLUSE_TEXTURE); float yscale2=64.f/gltexture->TextureHeight(GLUSE_TEXTURE); - gl.MatrixMode(GL_TEXTURE); - gl.PushMatrix(); - gl.Scalef(xscale1 ,yscale1,1.0f); - gl.Translatef(uoffs,voffs,0.0f); - gl.Scalef(xscale2 ,yscale2,1.0f); - gl.Rotatef(angle,0.0f,0.0f,1.0f); + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glScalef(xscale1 ,yscale1,1.0f); + glTranslatef(uoffs,voffs,0.0f); + glScalef(xscale2 ,yscale2,1.0f); + glRotatef(angle,0.0f,0.0f,1.0f); return true; } return false; @@ -150,7 +150,7 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass) draw_dlightf++; // Render the light - gl.Begin(GL_TRIANGLE_FAN); + glBegin(GL_TRIANGLE_FAN); for(k = 0, v = sub->firstline; k < sub->numlines; k++, v++) { vertex_t *vt = v->v1; @@ -158,12 +158,12 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass) t1.Set(vt->fx, zc, vt->fy); Vector nearToVert = t1 - nearPt; - gl.TexCoord2f( (nearToVert.Dot(right) * scale) + 0.5f, (nearToVert.Dot(up) * scale) + 0.5f); + glTexCoord2f( (nearToVert.Dot(right) * scale) + 0.5f, (nearToVert.Dot(up) * scale) + 0.5f); - gl.Vertex3f(vt->fx, zc, vt->fy); + glVertex3f(vt->fx, zc, vt->fy); } - gl.End(); + glEnd(); node = node->nextLight; } } @@ -237,16 +237,16 @@ bool GLFlat::SetupSubsectorLights(bool lightsapplied, subsector_t * sub) void GLFlat::DrawSubsector(subsector_t * sub) { - gl.Begin(GL_TRIANGLE_FAN); + glBegin(GL_TRIANGLE_FAN); for(unsigned int k=0; knumlines; k++) { vertex_t *vt = sub->firstline[k].v1; - gl.TexCoord2f(vt->fx/64.f, -vt->fy/64.f); + glTexCoord2f(vt->fx/64.f, -vt->fy/64.f); float zc = plane.plane.ZatPoint(vt->fx, vt->fy) + dz; - gl.Vertex3f(vt->fx, zc, vt->fy); + glVertex3f(vt->fx, zc, vt->fy); } - gl.End(); + glEnd(); flatvertices += sub->numlines; flatprimitives++; @@ -273,7 +273,7 @@ void GLFlat::DrawSubsectors(int pass, bool istrans) { if (vboindex >= 0) { - //gl.Color3f( 1.f,.5f,.5f); + //glColor3f( 1.f,.5f,.5f); int index = vboindex; for (int i=0; isubsectorcount; i++) { @@ -282,7 +282,7 @@ void GLFlat::DrawSubsectors(int pass, bool istrans) if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans) { if (pass == GLPASS_ALL) lightsapplied = SetupSubsectorLights(lightsapplied, sub); - gl.DrawArrays(GL_TRIANGLE_FAN, index, sub->numlines); + glDrawArrays(GL_TRIANGLE_FAN, index, sub->numlines); flatvertices += sub->numlines; flatprimitives++; } @@ -291,7 +291,7 @@ void GLFlat::DrawSubsectors(int pass, bool istrans) } else { - //gl.Color3f( .5f,1.f,.5f); // these are for testing the VBO stuff. + //glColor3f( .5f,1.f,.5f); // these are for testing the VBO stuff. // Draw the subsectors belonging to this sector for (int i=0; isubsectorcount; i++) { @@ -362,8 +362,8 @@ void GLFlat::Draw(int pass) DrawSubsectors(pass, false); if (pushed) { - gl.PopMatrix(); - gl.MatrixMode(GL_MODELVIEW); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); } break; } @@ -427,8 +427,8 @@ void GLFlat::Draw(int pass) gl_RenderState.EnableBrightmap(true); if (pushed) { - gl.PopMatrix(); - gl.MatrixMode(GL_MODELVIEW); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); } } if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index 3d9c8627d..b0ee96d88 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -112,19 +112,19 @@ void GLPortal::BeginScene() //========================================================================== void GLPortal::ClearScreen() { - bool multi = !!gl.IsEnabled(GL_MULTISAMPLE); - gl.MatrixMode(GL_MODELVIEW); - gl.PushMatrix(); - gl.MatrixMode(GL_PROJECTION); - gl.PushMatrix(); + bool multi = !!glIsEnabled(GL_MULTISAMPLE); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); screen->Begin2D(false); screen->Dim(0, 1.f, 0, 0, SCREENWIDTH, SCREENHEIGHT); - gl.Enable(GL_DEPTH_TEST); - gl.MatrixMode(GL_PROJECTION); - gl.PopMatrix(); - gl.MatrixMode(GL_MODELVIEW); - gl.PopMatrix(); - if (multi) gl.Enable(GL_MULTISAMPLE); + glEnable(GL_DEPTH_TEST); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + if (multi) glEnable(GL_MULTISAMPLE); gl_RenderState.Set2DMode(false); } @@ -146,18 +146,18 @@ void GLPortal::DrawPortalStencil() { // Cap the stencil at the top and bottom // (cheap ass version) - gl.Begin(GL_TRIANGLE_FAN); - gl.Vertex3f(-32767.0f,32767.0f,-32767.0f); - gl.Vertex3f(-32767.0f,32767.0f, 32767.0f); - gl.Vertex3f( 32767.0f,32767.0f, 32767.0f); - gl.Vertex3f( 32767.0f,32767.0f,-32767.0f); - gl.End(); - gl.Begin(GL_TRIANGLE_FAN); - gl.Vertex3f(-32767.0f,-32767.0f,-32767.0f); - gl.Vertex3f(-32767.0f,-32767.0f, 32767.0f); - gl.Vertex3f( 32767.0f,-32767.0f, 32767.0f); - gl.Vertex3f( 32767.0f,-32767.0f,-32767.0f); - gl.End(); + glBegin(GL_TRIANGLE_FAN); + glVertex3f(-32767.0f,32767.0f,-32767.0f); + glVertex3f(-32767.0f,32767.0f, 32767.0f); + glVertex3f( 32767.0f,32767.0f, 32767.0f); + glVertex3f( 32767.0f,32767.0f,-32767.0f); + glEnd(); + glBegin(GL_TRIANGLE_FAN); + glVertex3f(-32767.0f,-32767.0f,-32767.0f); + glVertex3f(-32767.0f,-32767.0f, 32767.0f); + glVertex3f( 32767.0f,-32767.0f, 32767.0f); + glVertex3f( 32767.0f,-32767.0f,-32767.0f); + glEnd(); } } @@ -182,17 +182,17 @@ bool GLPortal::Start(bool usestencil, bool doquery) } // Create stencil - gl.StencilFunc(GL_EQUAL,recursion,~0); // create stencil - gl.StencilOp(GL_KEEP,GL_KEEP,GL_INCR); // increment stencil of valid pixels - gl.ColorMask(0,0,0,0); // don't write to the graphics buffer + glStencilFunc(GL_EQUAL,recursion,~0); // create stencil + glStencilOp(GL_KEEP,GL_KEEP,GL_INCR); // increment stencil of valid pixels + glColorMask(0,0,0,0); // don't write to the graphics buffer gl_RenderState.EnableTexture(false); - gl.Color3f(1,1,1); - gl.DepthFunc(GL_LESS); + glColor3f(1,1,1); + glDepthFunc(GL_LESS); gl_RenderState.Apply(); if (NeedDepthBuffer()) { - gl.DepthMask(false); // don't write to Z-buffer! + glDepthMask(false); // don't write to Z-buffer! if (!NeedDepthBuffer()) doquery = false; // too much overhead and nothing to gain. else if (gl_noquery) doquery = false; @@ -216,18 +216,18 @@ bool GLPortal::Start(bool usestencil, bool doquery) } // Clear Z-buffer - gl.StencilFunc(GL_EQUAL,recursion+1,~0); // draw sky into stencil - gl.StencilOp(GL_KEEP,GL_KEEP,GL_KEEP); // this stage doesn't modify the stencil - gl.DepthMask(true); // enable z-buffer again - gl.DepthRange(1,1); - gl.DepthFunc(GL_ALWAYS); + glStencilFunc(GL_EQUAL,recursion+1,~0); // draw sky into stencil + glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP); // this stage doesn't modify the stencil + glDepthMask(true); // enable z-buffer again + glDepthRange(1,1); + glDepthFunc(GL_ALWAYS); DrawPortalStencil(); // set normal drawing mode gl_RenderState.EnableTexture(true); - gl.DepthFunc(GL_LESS); - gl.ColorMask(1,1,1,1); - gl.DepthRange(0,1); + glDepthFunc(GL_LESS); + glColorMask(1,1,1,1); + glDepthRange(0,1); if (doquery && gl.flags&RFL_OCCLUSION_QUERY) { @@ -238,8 +238,8 @@ bool GLPortal::Start(bool usestencil, bool doquery) if (sampleCount==0) // not visible { // restore default stencil op. - gl.StencilOp(GL_KEEP,GL_KEEP,GL_KEEP); - gl.StencilFunc(GL_EQUAL,recursion,~0); // draw sky into stencil + glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP); + glStencilFunc(GL_EQUAL,recursion,~0); // draw sky into stencil PortalAll.Unclock(); return false; } @@ -253,14 +253,14 @@ bool GLPortal::Start(bool usestencil, bool doquery) // than the benefit. // Note: We must draw the stencil with z-write enabled here because there is no second pass! - gl.DepthMask(true); + glDepthMask(true); DrawPortalStencil(); - gl.StencilFunc(GL_EQUAL,recursion+1,~0); // draw sky into stencil - gl.StencilOp(GL_KEEP,GL_KEEP,GL_KEEP); // this stage doesn't modify the stencil + glStencilFunc(GL_EQUAL,recursion+1,~0); // draw sky into stencil + glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP); // this stage doesn't modify the stencil gl_RenderState.EnableTexture(true); - gl.ColorMask(1,1,1,1); - gl.Disable(GL_DEPTH_TEST); - gl.DepthMask(false); // don't write to Z-buffer! + glColorMask(1,1,1,1); + glDisable(GL_DEPTH_TEST); + glDepthMask(false); // don't write to Z-buffer! } recursion++; @@ -274,13 +274,13 @@ bool GLPortal::Start(bool usestencil, bool doquery) } else { - gl.DepthMask(false); - gl.Disable(GL_DEPTH_TEST); + glDepthMask(false); + glDisable(GL_DEPTH_TEST); } } // The clip plane from the previous portal must be deactivated for this one. - clipsave = gl.IsEnabled(GL_CLIP_PLANE0+renderdepth-1); - if (clipsave) gl.Disable(GL_CLIP_PLANE0+renderdepth-1); + clipsave = glIsEnabled(GL_CLIP_PLANE0+renderdepth-1); + if (clipsave) glDisable(GL_CLIP_PLANE0+renderdepth-1); // save viewpoint savedviewx=viewx; @@ -340,7 +340,7 @@ void GLPortal::End(bool usestencil) PortalAll.Clock(); GLRenderer->mCurrentPortal = NextPortal; - if (clipsave) gl.Enable (GL_CLIP_PLANE0+renderdepth-1); + if (clipsave) glEnable (GL_CLIP_PLANE0+renderdepth-1); if (usestencil) { if (needdepth) FDrawInfo::EndDrawInfo(); @@ -354,52 +354,52 @@ void GLPortal::End(bool usestencil) in_area=savedviewarea; GLRenderer->SetupView(viewx, viewy, viewz, viewangle, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1)); - gl.Color4f(1,1,1,1); - gl.ColorMask(0,0,0,0); // no graphics - gl.Color3f(1,1,1); + glColor4f(1,1,1,1); + glColorMask(0,0,0,0); // no graphics + glColor3f(1,1,1); gl_RenderState.EnableTexture(false); gl_RenderState.Apply(); if (needdepth) { // first step: reset the depth buffer to max. depth - gl.DepthRange(1,1); // always - gl.DepthFunc(GL_ALWAYS); // write the farthest depth value + glDepthRange(1,1); // always + glDepthFunc(GL_ALWAYS); // write the farthest depth value DrawPortalStencil(); } else { - gl.Enable(GL_DEPTH_TEST); + glEnable(GL_DEPTH_TEST); } // second step: restore the depth buffer to the previous values and reset the stencil - gl.DepthFunc(GL_LEQUAL); - gl.DepthRange(0,1); - gl.StencilOp(GL_KEEP,GL_KEEP,GL_DECR); - gl.StencilFunc(GL_EQUAL,recursion,~0); // draw sky into stencil + glDepthFunc(GL_LEQUAL); + glDepthRange(0,1); + glStencilOp(GL_KEEP,GL_KEEP,GL_DECR); + glStencilFunc(GL_EQUAL,recursion,~0); // draw sky into stencil DrawPortalStencil(); - gl.DepthFunc(GL_LESS); + glDepthFunc(GL_LESS); gl_RenderState.EnableTexture(true); - gl.ColorMask(1,1,1,1); + glColorMask(1,1,1,1); recursion--; // restore old stencil op. - gl.StencilOp(GL_KEEP,GL_KEEP,GL_KEEP); - gl.StencilFunc(GL_EQUAL,recursion,~0); // draw sky into stencil + glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP); + glStencilFunc(GL_EQUAL,recursion,~0); // draw sky into stencil } else { if (needdepth) { FDrawInfo::EndDrawInfo(); - gl.Clear(GL_DEPTH_BUFFER_BIT); + glClear(GL_DEPTH_BUFFER_BIT); } else { - gl.Enable(GL_DEPTH_TEST); - gl.DepthMask(true); + glEnable(GL_DEPTH_TEST); + glDepthMask(true); } // Restore the old view viewx=savedviewx; @@ -413,15 +413,15 @@ void GLPortal::End(bool usestencil) // This draws a valid z-buffer into the stencil's contents to ensure it // doesn't get overwritten by the level's geometry. - gl.Color4f(1,1,1,1); - gl.DepthFunc(GL_LEQUAL); - gl.DepthRange(0,1); - gl.ColorMask(0,0,0,0); // no graphics + glColor4f(1,1,1,1); + glDepthFunc(GL_LEQUAL); + glDepthRange(0,1); + glColorMask(0,0,0,0); // no graphics gl_RenderState.EnableTexture(false); DrawPortalStencil(); gl_RenderState.EnableTexture(true); - gl.ColorMask(1,1,1,1); - gl.DepthFunc(GL_LESS); + glColorMask(1,1,1,1); + glDepthFunc(GL_LESS); } PortalAll.Unclock(); } @@ -613,7 +613,7 @@ void GLSkyboxPortal::DrawContents() PlaneMirrorMode=0; - gl.Disable(GL_DEPTH_CLAMP_NV); + glDisable(GL_DEPTH_CLAMP_NV); viewx = origin->PrevX + FixedMul(r_TicFrac, origin->x - origin->PrevX); viewy = origin->PrevY + FixedMul(r_TicFrac, origin->y - origin->PrevY); @@ -643,7 +643,7 @@ void GLSkyboxPortal::DrawContents() GLRenderer->DrawScene(); origin->flags&=~MF_JUSTHIT; inskybox=false; - gl.Enable(GL_DEPTH_CLAMP_NV); + glEnable(GL_DEPTH_CLAMP_NV); skyboxrecursion--; PlaneMirrorMode=old_pm; @@ -778,14 +778,14 @@ void GLPlaneMirrorPortal::DrawContents() GLRenderer->SetupView(viewx, viewy, viewz, viewangle, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1)); ClearClipper(); - gl.Enable(GL_CLIP_PLANE0+renderdepth); + glEnable(GL_CLIP_PLANE0+renderdepth); // This only works properly for non-sloped planes so don't bother with the math. //double d[4]={origin->a/65536., origin->c/65536., origin->b/65536., FIXED2FLOAT(origin->d)}; double d[4]={0, static_cast(PlaneMirrorMode), 0, FIXED2FLOAT(origin->d)}; - gl.ClipPlane(GL_CLIP_PLANE0+renderdepth, d); + glClipPlane(GL_CLIP_PLANE0+renderdepth, d); GLRenderer->DrawScene(); - gl.Disable(GL_CLIP_PLANE0+renderdepth); + glDisable(GL_CLIP_PLANE0+renderdepth); PlaneMirrorFlag--; PlaneMirrorMode=old_pm; } @@ -999,21 +999,21 @@ void GLHorizonPortal::DrawContents() { for(float y=-32768+vy; y<32768+vy;y+=4096) { - gl.Begin(GL_TRIANGLE_FAN); + glBegin(GL_TRIANGLE_FAN); - gl.TexCoord2f(x/64, -y/64); - gl.Vertex3f(x, z, y); + glTexCoord2f(x/64, -y/64); + glVertex3f(x, z, y); - gl.TexCoord2f(x/64 + 64, -y/64); - gl.Vertex3f(x + 4096, z, y); + glTexCoord2f(x/64 + 64, -y/64); + glVertex3f(x + 4096, z, y); - gl.TexCoord2f(x/64 + 64, -y/64 - 64); - gl.Vertex3f(x + 4096, z, y + 4096); + glTexCoord2f(x/64 + 64, -y/64 - 64); + glVertex3f(x + 4096, z, y + 4096); - gl.TexCoord2f(x/64, -y/64 - 64); - gl.Vertex3f(x, z, y + 4096); + glTexCoord2f(x/64, -y/64 - 64); + glVertex3f(x, z, y + 4096); - gl.End(); + glEnd(); } } @@ -1025,39 +1025,39 @@ void GLHorizonPortal::DrawContents() // Since I can't draw into infinity there can always be a // small gap - gl.Begin(GL_TRIANGLE_STRIP); + glBegin(GL_TRIANGLE_STRIP); - gl.TexCoord2f(512.f, 0); - gl.Vertex3f(-32768+vx, z, -32768+vy); - gl.TexCoord2f(512.f, tz); - gl.Vertex3f(-32768+vx, vz, -32768+vy); + glTexCoord2f(512.f, 0); + glVertex3f(-32768+vx, z, -32768+vy); + glTexCoord2f(512.f, tz); + glVertex3f(-32768+vx, vz, -32768+vy); - gl.TexCoord2f(-512.f, 0); - gl.Vertex3f(-32768+vx, z, 32768+vy); - gl.TexCoord2f(-512.f, tz); - gl.Vertex3f(-32768+vx, vz, 32768+vy); + glTexCoord2f(-512.f, 0); + glVertex3f(-32768+vx, z, 32768+vy); + glTexCoord2f(-512.f, tz); + glVertex3f(-32768+vx, vz, 32768+vy); - gl.TexCoord2f(512.f, 0); - gl.Vertex3f( 32768+vx, z, 32768+vy); - gl.TexCoord2f(512.f, tz); - gl.Vertex3f( 32768+vx, vz, 32768+vy); + glTexCoord2f(512.f, 0); + glVertex3f( 32768+vx, z, 32768+vy); + glTexCoord2f(512.f, tz); + glVertex3f( 32768+vx, vz, 32768+vy); - gl.TexCoord2f(-512.f, 0); - gl.Vertex3f( 32768+vx, z, -32768+vy); - gl.TexCoord2f(-512.f, tz); - gl.Vertex3f( 32768+vx, vz, -32768+vy); + glTexCoord2f(-512.f, 0); + glVertex3f( 32768+vx, z, -32768+vy); + glTexCoord2f(-512.f, tz); + glVertex3f( 32768+vx, vz, -32768+vy); - gl.TexCoord2f(512.f, 0); - gl.Vertex3f(-32768+vx, z, -32768+vy); - gl.TexCoord2f(512.f, tz); - gl.Vertex3f(-32768+vx, vz, -32768+vy); + glTexCoord2f(512.f, 0); + glVertex3f(-32768+vx, z, -32768+vy); + glTexCoord2f(512.f, tz); + glVertex3f(-32768+vx, vz, -32768+vy); - gl.End(); + glEnd(); if (pushed) { - gl.PopMatrix(); - gl.MatrixMode(GL_MODELVIEW); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); } PortalAll.Unclock(); diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 51454ed1a..93c8dbbf8 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -164,7 +164,7 @@ void FGLRenderer::SetViewArea() void FGLRenderer::ResetViewport() { int trueheight = static_cast(screen)->GetTrueHeight(); // ugh... - gl.Viewport(0, (trueheight-screen->GetHeight())/2, screen->GetWidth(), screen->GetHeight()); + glViewport(0, (trueheight-screen->GetHeight())/2, screen->GetWidth(), screen->GetHeight()); } //----------------------------------------------------------------------------- @@ -197,28 +197,28 @@ void FGLRenderer::SetViewport(GL_IRECT *bounds) int vw = viewwidth; int vh = viewheight; - gl.Viewport(viewwindowx, trueheight-bars-(height+viewwindowy-((height-vh)/2)), vw, height); - gl.Scissor(viewwindowx, trueheight-bars-(vh+viewwindowy), vw, vh); + glViewport(viewwindowx, trueheight-bars-(height+viewwindowy-((height-vh)/2)), vw, height); + glScissor(viewwindowx, trueheight-bars-(vh+viewwindowy), vw, vh); } else { - gl.Viewport(bounds->left, bounds->top, bounds->width, bounds->height); - gl.Scissor(bounds->left, bounds->top, bounds->width, bounds->height); + glViewport(bounds->left, bounds->top, bounds->width, bounds->height); + glScissor(bounds->left, bounds->top, bounds->width, bounds->height); } - gl.Enable(GL_SCISSOR_TEST); + glEnable(GL_SCISSOR_TEST); #ifdef _DEBUG - gl.ClearColor(0.0f, 0.0f, 0.0f, 0.0f); - gl.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); #else - gl.Clear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); #endif - gl.Enable(GL_MULTISAMPLE); - gl.Enable(GL_DEPTH_TEST); - gl.Enable(GL_STENCIL_TEST); - gl.StencilFunc(GL_ALWAYS,0,~0); // default stencil - gl.StencilOp(GL_KEEP,GL_KEEP,GL_REPLACE); + glEnable(GL_MULTISAMPLE); + glEnable(GL_DEPTH_TEST); + glEnable(GL_STENCIL_TEST); + glStencilFunc(GL_ALWAYS,0,~0); // default stencil + glStencilOp(GL_KEEP,GL_KEEP,GL_REPLACE); } //----------------------------------------------------------------------------- @@ -248,8 +248,8 @@ void FGLRenderer::SetCameraPos(fixed_t viewx, fixed_t viewy, fixed_t viewz, angl void FGLRenderer::SetProjection(float fov, float ratio, float fovratio) { - gl.MatrixMode(GL_PROJECTION); - gl.LoadIdentity(); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); float fovy = 2 * RAD2DEG(atan(tan(DEG2RAD(fov) / 2) / fovratio)); gluPerspective(fovy, ratio, 5.f, 65536.f); @@ -267,24 +267,24 @@ void FGLRenderer::SetViewMatrix(bool mirror, bool planemirror) if (gl.shadermodel >= 4) { gl.ActiveTexture(GL_TEXTURE7); - gl.MatrixMode(GL_TEXTURE); - gl.LoadIdentity(); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); } gl.ActiveTexture(GL_TEXTURE0); - gl.MatrixMode(GL_TEXTURE); - gl.LoadIdentity(); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); - gl.MatrixMode(GL_MODELVIEW); - gl.LoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); float mult = mirror? -1:1; float planemult = planemirror? -1:1; - gl.Rotatef(GLRenderer->mAngles.Roll, 0.0f, 0.0f, 1.0f); - gl.Rotatef(GLRenderer->mAngles.Pitch, 1.0f, 0.0f, 0.0f); - gl.Rotatef(GLRenderer->mAngles.Yaw, 0.0f, mult, 0.0f); - gl.Translatef( GLRenderer->mCameraPos.X * mult, -GLRenderer->mCameraPos.Z*planemult, -GLRenderer->mCameraPos.Y); - gl.Scalef(-mult, planemult, 1); + glRotatef(GLRenderer->mAngles.Roll, 0.0f, 0.0f, 1.0f); + glRotatef(GLRenderer->mAngles.Pitch, 1.0f, 0.0f, 0.0f); + glRotatef(GLRenderer->mAngles.Yaw, 0.0f, mult, 0.0f); + glTranslatef( GLRenderer->mCameraPos.X * mult, -GLRenderer->mCameraPos.Z*planemult, -GLRenderer->mCameraPos.Y); + glScalef(-mult, planemult, 1); } @@ -346,7 +346,7 @@ void FGLRenderer::RenderScene(int recursion) { RenderAll.Clock(); - gl.DepthMask(true); + glDepthMask(true); if (!gl_no_skyclear) GLPortal::RenderFirstSkyPortal(recursion); gl_RenderState.SetCameraPos(FIXED2FLOAT(viewx), FIXED2FLOAT(viewy), FIXED2FLOAT(viewz)); @@ -357,12 +357,12 @@ void FGLRenderer::RenderScene(int recursion) // First draw all single-pass stuff // Part 1: solid geometry. This is set up so that there are no transparent parts - gl.DepthFunc(GL_LESS); + glDepthFunc(GL_LESS); gl_RenderState.EnableAlphaTest(false); - gl.Disable(GL_POLYGON_OFFSET_FILL); // just in case + glDisable(GL_POLYGON_OFFSET_FILL); // just in case int pass; @@ -434,13 +434,13 @@ void FGLRenderer::RenderScene(int recursion) // second pass: draw lights (on fogged surfaces they are added to the textures!) - gl.DepthMask(false); + glDepthMask(false); if (mLightCount && !gl_fixedcolormap) { if (gl_SetupLightTexture()) { gl_RenderState.BlendFunc(GL_ONE, GL_ONE); - gl.DepthFunc(GL_EQUAL); + glDepthFunc(GL_EQUAL); if (glset.lightmode == 8) gl.VertexAttrib1f(VATTR_LIGHTLEVEL, 1.0f); // Korshun. for(int i=GLDL_FIRSTLIGHT; i<=GLDL_LASTLIGHT; i++) { @@ -452,10 +452,10 @@ void FGLRenderer::RenderScene(int recursion) } // third pass: modulated texture - gl.Color3f(1.0f, 1.0f, 1.0f); + glColor3f(1.0f, 1.0f, 1.0f); gl_RenderState.BlendFunc(GL_DST_COLOR, GL_ZERO); gl_RenderState.EnableFog(false); - gl.DepthFunc(GL_LEQUAL); + glDepthFunc(GL_LEQUAL); if (gl_texture) { gl_RenderState.EnableAlphaTest(false); @@ -473,7 +473,7 @@ void FGLRenderer::RenderScene(int recursion) if (gl_lights && mLightCount && !gl_fixedcolormap) { gl_RenderState.BlendFunc(GL_ONE, GL_ONE); - gl.DepthFunc(GL_EQUAL); + glDepthFunc(GL_EQUAL); if (gl_SetupLightTexture()) { for(int i=0; iDrawUnhandledMissingTextures(); gl_RenderState.EnableAlphaTest(true); - gl.DepthMask(true); + glDepthMask(true); - gl.PolygonOffset(0.0f, 0.0f); - gl.Disable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(0.0f, 0.0f); + glDisable(GL_POLYGON_OFFSET_FILL); RenderAll.Unclock(); } @@ -537,7 +537,7 @@ void FGLRenderer::RenderTranslucent() { RenderAll.Clock(); - gl.DepthMask(false); + glDepthMask(false); gl_RenderState.SetCameraPos(FIXED2FLOAT(viewx), FIXED2FLOAT(viewy), FIXED2FLOAT(viewz)); // final pass: translucent stuff @@ -550,7 +550,7 @@ void FGLRenderer::RenderTranslucent() gl_drawinfo->drawlists[GLDL_TRANSLUCENT].DrawSorted(); gl_RenderState.EnableBrightmap(false); - gl.DepthMask(true); + glDepthMask(true); gl_RenderState.AlphaFunc(GL_GEQUAL,0.5f); RenderAll.Unclock(); @@ -683,14 +683,14 @@ void FGLRenderer::DrawBlend(sector_t * viewsector) gl_RenderState.EnableAlphaTest(false); gl_RenderState.EnableTexture(false); gl_RenderState.BlendFunc(GL_DST_COLOR,GL_ZERO); - gl.Color4f(extra_red, extra_green, extra_blue, 1.0f); + glColor4f(extra_red, extra_green, extra_blue, 1.0f); gl_RenderState.Apply(true); - gl.Begin(GL_TRIANGLE_STRIP); - gl.Vertex2f( 0.0f, 0.0f); - gl.Vertex2f( 0.0f, (float)SCREENHEIGHT); - gl.Vertex2f( (float)SCREENWIDTH, 0.0f); - gl.Vertex2f( (float)SCREENWIDTH, (float)SCREENHEIGHT); - gl.End(); + glBegin(GL_TRIANGLE_STRIP); + glVertex2f( 0.0f, 0.0f); + glVertex2f( 0.0f, (float)SCREENHEIGHT); + glVertex2f( (float)SCREENWIDTH, 0.0f); + glVertex2f( (float)SCREENWIDTH, (float)SCREENHEIGHT); + glEnd(); } } else if (blendv.a) @@ -720,14 +720,14 @@ void FGLRenderer::DrawBlend(sector_t * viewsector) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); gl_RenderState.EnableAlphaTest(false); gl_RenderState.EnableTexture(false); - gl.Color4fv(blend); + glColor4fv(blend); gl_RenderState.Apply(true); - gl.Begin(GL_TRIANGLE_STRIP); - gl.Vertex2f( 0.0f, 0.0f); - gl.Vertex2f( 0.0f, (float)SCREENHEIGHT); - gl.Vertex2f( (float)SCREENWIDTH, 0.0f); - gl.Vertex2f( (float)SCREENWIDTH, (float)SCREENHEIGHT); - gl.End(); + glBegin(GL_TRIANGLE_STRIP); + glVertex2f( 0.0f, 0.0f); + glVertex2f( 0.0f, (float)SCREENHEIGHT); + glVertex2f( (float)SCREENWIDTH, 0.0f); + glVertex2f( (float)SCREENWIDTH, (float)SCREENHEIGHT); + glEnd(); } } @@ -748,12 +748,12 @@ void FGLRenderer::EndDrawScene(sector_t * viewsector) if ( renderHUDModel ) { // [BB] The HUD model should be drawn over everything else already drawn. - gl.Clear(GL_DEPTH_BUFFER_BIT); + glClear(GL_DEPTH_BUFFER_BIT); DrawPlayerSprites (viewsector, true); } - gl.Disable(GL_STENCIL_TEST); - gl.Disable(GL_POLYGON_SMOOTH); + glDisable(GL_STENCIL_TEST); + glDisable(GL_POLYGON_SMOOTH); gl_RenderState.EnableFog(false); framebuffer->Begin2D(false); @@ -769,10 +769,10 @@ void FGLRenderer::EndDrawScene(sector_t * viewsector) // Restore standard rendering state gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - gl.Color3f(1.0f,1.0f,1.0f); + glColor3f(1.0f,1.0f,1.0f); gl_RenderState.EnableTexture(true); gl_RenderState.EnableAlphaTest(true); - gl.Disable(GL_SCISSOR_TEST); + glDisable(GL_SCISSOR_TEST); } @@ -966,7 +966,7 @@ void FGLRenderer::WriteSavePic (player_t *player, FILE *file, int width, int hei bounds.top=0; bounds.width=width; bounds.height=height; - gl.Flush(); + glFlush(); SetFixedColormap(player); // Check if there's some lights. If not some code can be skipped. @@ -975,13 +975,13 @@ void FGLRenderer::WriteSavePic (player_t *player, FILE *file, int width, int hei sector_t *viewsector = RenderViewpoint(players[consoleplayer].camera, &bounds, FieldOfView * 360.0f / FINEANGLES, 1.6f, 1.6f, true, false); - gl.Disable(GL_STENCIL_TEST); + glDisable(GL_STENCIL_TEST); screen->Begin2D(false); DrawBlend(viewsector); - gl.Flush(); + glFlush(); byte * scr = (byte *)M_Malloc(width * height * 3); - gl.ReadPixels(0,0,width, height,GL_RGB,GL_UNSIGNED_BYTE,scr); + glReadPixels(0,0,width, height,GL_RGB,GL_UNSIGNED_BYTE,scr); M_CreatePNG (file, scr + ((height-1) * width * 3), NULL, SS_RGB, width, height, -width*3); M_Free(scr); } @@ -1098,8 +1098,8 @@ int FGLInterface::GetMaxViewPitch(bool down) void FGLInterface::ClearBuffer(int color) { PalEntry pe = GPalette.BaseColors[color]; - gl.ClearColor(pe.r/255.f, pe.g/255.f, pe.b/255.f, 1.f); - gl.Clear(GL_COLOR_BUFFER_BIT); + glClearColor(pe.r/255.f, pe.g/255.f, pe.b/255.f, 1.f); + glClear(GL_COLOR_BUFFER_BIT); } //=========================================================================== @@ -1163,7 +1163,7 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in if (!usefb) { - gl.Flush(); + glFlush(); } else { @@ -1180,7 +1180,7 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in usefb = false; gl_usefb = false; GLRenderer->EndOffscreen(); - gl.Flush(); + glFlush(); } #endif } @@ -1194,9 +1194,9 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in if (!usefb) { - gl.Flush(); + glFlush(); gltex->Bind(CM_DEFAULT, 0, 0); - gl.CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, bounds.width, bounds.height); + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, bounds.width, bounds.height); } else { @@ -1204,7 +1204,7 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in } gltex->Bind(CM_DEFAULT, 0, 0); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[gl_texture_filter].magfilter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[gl_texture_filter].magfilter); tex->SetUpdated(); } diff --git a/src/gl/scene/gl_skydome.cpp b/src/gl/scene/gl_skydome.cpp index 8bed575b3..41182cfb4 100644 --- a/src/gl/scene/gl_skydome.cpp +++ b/src/gl/scene/gl_skydome.cpp @@ -125,14 +125,14 @@ static void SkyVertex(int r, int c) } - gl.TexCoord2f(skymirror? -u:u, v); + glTexCoord2f(skymirror? -u:u, v); } if (r != 4) y+=FRACUNIT*300; // And finally the vertex. fx =-FIXED2FLOAT(x); // Doom mirrors the sky vertically! fy = FIXED2FLOAT(y); fz = FIXED2FLOAT(z); - gl.Vertex3f(fx, fy - 1.f, fz); + glVertex3f(fx, fy - 1.f, fz); } @@ -181,13 +181,13 @@ static void RenderSkyHemisphere(int hemi, bool mirror) if (!secondlayer) { - gl.Color3f(R, G ,B); - gl.Begin(GL_TRIANGLE_FAN); + glColor3f(R, G ,B); + glBegin(GL_TRIANGLE_FAN); for(c = 0; c < columns; c++) { SkyVertex(1, c); } - gl.End(); + glEnd(); } gl_RenderState.EnableTexture(true); @@ -198,12 +198,12 @@ static void RenderSkyHemisphere(int hemi, bool mirror) { gl_RenderState.Apply(true); columns=4; // no need to do more! - gl.Begin(GL_TRIANGLE_FAN); + glBegin(GL_TRIANGLE_FAN); for(c = 0; c < columns; c++) { SkyVertex(0, c); } - gl.End(); + glEnd(); } // The total number of triangles per hemisphere can be calculated @@ -212,7 +212,7 @@ static void RenderSkyHemisphere(int hemi, bool mirror) { if (yflip) { - gl.Begin(GL_TRIANGLE_STRIP); + glBegin(GL_TRIANGLE_STRIP); SkyVertex(r + 1, 0); SkyVertex(r, 0); for(c = 1; c <= columns; c++) @@ -220,11 +220,11 @@ static void RenderSkyHemisphere(int hemi, bool mirror) SkyVertex(r + 1, c); SkyVertex(r, c); } - gl.End(); + glEnd(); } else { - gl.Begin(GL_TRIANGLE_STRIP); + glBegin(GL_TRIANGLE_STRIP); SkyVertex(r, 0); SkyVertex(r + 1, 0); for(c = 1; c <= columns; c++) @@ -232,7 +232,7 @@ static void RenderSkyHemisphere(int hemi, bool mirror) SkyVertex(r, c); SkyVertex(r + 1, c); } - gl.End(); + glEnd(); } } } @@ -255,33 +255,33 @@ static void RenderDome(FTextureID texno, FMaterial * tex, float x_offset, float if (tex) { - gl.PushMatrix(); + glPushMatrix(); tex->Bind(CM_Index, 0, 0); texw = tex->TextureWidth(GLUSE_TEXTURE); texh = tex->TextureHeight(GLUSE_TEXTURE); - gl.Rotatef(-180.0f+x_offset, 0.f, 1.f, 0.f); + glRotatef(-180.0f+x_offset, 0.f, 1.f, 0.f); yAdd = y_offset/texh; if (texh < 200) { - gl.Translatef(0.f, -1250.f, 0.f); - gl.Scalef(1.f, texh/230.f, 1.f); + glTranslatef(0.f, -1250.f, 0.f); + glScalef(1.f, texh/230.f, 1.f); } else if (texh <= 240) { - gl.Translatef(0.f, (200 - texh + tex->tex->SkyOffset + skyoffset)*skyoffsetfactor, 0.f); - gl.Scalef(1.f, 1.f + ((texh-200.f)/200.f) * 1.17f, 1.f); + glTranslatef(0.f, (200 - texh + tex->tex->SkyOffset + skyoffset)*skyoffsetfactor, 0.f); + glScalef(1.f, 1.f + ((texh-200.f)/200.f) * 1.17f, 1.f); } else { - gl.Translatef(0.f, (-40 + tex->tex->SkyOffset + skyoffset)*skyoffsetfactor, 0.f); - gl.Scalef(1.f, 1.2f * 1.17f, 1.f); - gl.MatrixMode(GL_TEXTURE); - gl.PushMatrix(); - gl.LoadIdentity(); - gl.Scalef(1.f, 240.f / texh, 1.f); - gl.MatrixMode(GL_MODELVIEW); + glTranslatef(0.f, (-40 + tex->tex->SkyOffset + skyoffset)*skyoffsetfactor, 0.f); + glScalef(1.f, 1.2f * 1.17f, 1.f); + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glLoadIdentity(); + glScalef(1.f, 240.f / texh, 1.f); + glMatrixMode(GL_MODELVIEW); texscale = true; } } @@ -330,11 +330,11 @@ static void RenderDome(FTextureID texno, FMaterial * tex, float x_offset, float RenderSkyHemisphere(SKYHEMI_LOWER, mirror); if (texscale) { - gl.MatrixMode(GL_TEXTURE); - gl.PopMatrix(); - gl.MatrixMode(GL_MODELVIEW); + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); } - if (tex) gl.PopMatrix(); + if (tex) glPopMatrix(); } @@ -352,11 +352,11 @@ static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, int C FMaterial * tex; if (!sky2) - gl.Rotatef(-180.0f+x_offset, glset.skyrotatevector.X, glset.skyrotatevector.Z, glset.skyrotatevector.Y); + glRotatef(-180.0f+x_offset, glset.skyrotatevector.X, glset.skyrotatevector.Z, glset.skyrotatevector.Y); else - gl.Rotatef(-180.0f+x_offset, glset.skyrotatevector2.X, glset.skyrotatevector2.Z, glset.skyrotatevector2.Y); + glRotatef(-180.0f+x_offset, glset.skyrotatevector2.X, glset.skyrotatevector2.Z, glset.skyrotatevector2.Y); - gl.Color3f(R, G ,B); + glColor3f(R, G ,B); if (sb->faces[5]) { @@ -366,61 +366,61 @@ static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, int C tex = FMaterial::ValidateTexture(sb->faces[0]); tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0); gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_FAN); - gl.TexCoord2f(0, 0); - gl.Vertex3f(128.f, 128.f, -128.f); - gl.TexCoord2f(1, 0); - gl.Vertex3f(-128.f, 128.f, -128.f); - gl.TexCoord2f(1, 1); - gl.Vertex3f(-128.f, -128.f, -128.f); - gl.TexCoord2f(0, 1); - gl.Vertex3f(128.f, -128.f, -128.f); - gl.End(); + glBegin(GL_TRIANGLE_FAN); + glTexCoord2f(0, 0); + glVertex3f(128.f, 128.f, -128.f); + glTexCoord2f(1, 0); + glVertex3f(-128.f, 128.f, -128.f); + glTexCoord2f(1, 1); + glVertex3f(-128.f, -128.f, -128.f); + glTexCoord2f(0, 1); + glVertex3f(128.f, -128.f, -128.f); + glEnd(); // east tex = FMaterial::ValidateTexture(sb->faces[1]); tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0); gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_FAN); - gl.TexCoord2f(0, 0); - gl.Vertex3f(-128.f, 128.f, -128.f); - gl.TexCoord2f(1, 0); - gl.Vertex3f(-128.f, 128.f, 128.f); - gl.TexCoord2f(1, 1); - gl.Vertex3f(-128.f, -128.f, 128.f); - gl.TexCoord2f(0, 1); - gl.Vertex3f(-128.f, -128.f, -128.f); - gl.End(); + glBegin(GL_TRIANGLE_FAN); + glTexCoord2f(0, 0); + glVertex3f(-128.f, 128.f, -128.f); + glTexCoord2f(1, 0); + glVertex3f(-128.f, 128.f, 128.f); + glTexCoord2f(1, 1); + glVertex3f(-128.f, -128.f, 128.f); + glTexCoord2f(0, 1); + glVertex3f(-128.f, -128.f, -128.f); + glEnd(); // south tex = FMaterial::ValidateTexture(sb->faces[2]); tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0); gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_FAN); - gl.TexCoord2f(0, 0); - gl.Vertex3f(-128.f, 128.f, 128.f); - gl.TexCoord2f(1, 0); - gl.Vertex3f(128.f, 128.f, 128.f); - gl.TexCoord2f(1, 1); - gl.Vertex3f(128.f, -128.f, 128.f); - gl.TexCoord2f(0, 1); - gl.Vertex3f(-128.f, -128.f, 128.f); - gl.End(); + glBegin(GL_TRIANGLE_FAN); + glTexCoord2f(0, 0); + glVertex3f(-128.f, 128.f, 128.f); + glTexCoord2f(1, 0); + glVertex3f(128.f, 128.f, 128.f); + glTexCoord2f(1, 1); + glVertex3f(128.f, -128.f, 128.f); + glTexCoord2f(0, 1); + glVertex3f(-128.f, -128.f, 128.f); + glEnd(); // west tex = FMaterial::ValidateTexture(sb->faces[3]); tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0); gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_FAN); - gl.TexCoord2f(0, 0); - gl.Vertex3f(128.f, 128.f, 128.f); - gl.TexCoord2f(1, 0); - gl.Vertex3f(128.f, 128.f, -128.f); - gl.TexCoord2f(1, 1); - gl.Vertex3f(128.f, -128.f, -128.f); - gl.TexCoord2f(0, 1); - gl.Vertex3f(128.f, -128.f, 128.f); - gl.End(); + glBegin(GL_TRIANGLE_FAN); + glTexCoord2f(0, 0); + glVertex3f(128.f, 128.f, 128.f); + glTexCoord2f(1, 0); + glVertex3f(128.f, 128.f, -128.f); + glTexCoord2f(1, 1); + glVertex3f(128.f, -128.f, -128.f); + glTexCoord2f(0, 1); + glVertex3f(128.f, -128.f, 128.f); + glEnd(); } else { @@ -430,98 +430,98 @@ static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, int C tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0); gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_FAN); - gl.TexCoord2f(0, 0); - gl.Vertex3f(128.f, 128.f, -128.f); - gl.TexCoord2f(.25f, 0); - gl.Vertex3f(-128.f, 128.f, -128.f); - gl.TexCoord2f(.25f, 1); - gl.Vertex3f(-128.f, -128.f, -128.f); - gl.TexCoord2f(0, 1); - gl.Vertex3f(128.f, -128.f, -128.f); - gl.End(); + glBegin(GL_TRIANGLE_FAN); + glTexCoord2f(0, 0); + glVertex3f(128.f, 128.f, -128.f); + glTexCoord2f(.25f, 0); + glVertex3f(-128.f, 128.f, -128.f); + glTexCoord2f(.25f, 1); + glVertex3f(-128.f, -128.f, -128.f); + glTexCoord2f(0, 1); + glVertex3f(128.f, -128.f, -128.f); + glEnd(); // east - gl.Begin(GL_TRIANGLE_FAN); - gl.TexCoord2f(.25f, 0); - gl.Vertex3f(-128.f, 128.f, -128.f); - gl.TexCoord2f(.5f, 0); - gl.Vertex3f(-128.f, 128.f, 128.f); - gl.TexCoord2f(.5f, 1); - gl.Vertex3f(-128.f, -128.f, 128.f); - gl.TexCoord2f(.25f, 1); - gl.Vertex3f(-128.f, -128.f, -128.f); - gl.End(); + glBegin(GL_TRIANGLE_FAN); + glTexCoord2f(.25f, 0); + glVertex3f(-128.f, 128.f, -128.f); + glTexCoord2f(.5f, 0); + glVertex3f(-128.f, 128.f, 128.f); + glTexCoord2f(.5f, 1); + glVertex3f(-128.f, -128.f, 128.f); + glTexCoord2f(.25f, 1); + glVertex3f(-128.f, -128.f, -128.f); + glEnd(); // south - gl.Begin(GL_TRIANGLE_FAN); - gl.TexCoord2f(.5f, 0); - gl.Vertex3f(-128.f, 128.f, 128.f); - gl.TexCoord2f(.75f, 0); - gl.Vertex3f(128.f, 128.f, 128.f); - gl.TexCoord2f(.75f, 1); - gl.Vertex3f(128.f, -128.f, 128.f); - gl.TexCoord2f(.5f, 1); - gl.Vertex3f(-128.f, -128.f, 128.f); - gl.End(); + glBegin(GL_TRIANGLE_FAN); + glTexCoord2f(.5f, 0); + glVertex3f(-128.f, 128.f, 128.f); + glTexCoord2f(.75f, 0); + glVertex3f(128.f, 128.f, 128.f); + glTexCoord2f(.75f, 1); + glVertex3f(128.f, -128.f, 128.f); + glTexCoord2f(.5f, 1); + glVertex3f(-128.f, -128.f, 128.f); + glEnd(); // west - gl.Begin(GL_TRIANGLE_FAN); - gl.TexCoord2f(.75f, 0); - gl.Vertex3f(128.f, 128.f, 128.f); - gl.TexCoord2f(1, 0); - gl.Vertex3f(128.f, 128.f, -128.f); - gl.TexCoord2f(1, 1); - gl.Vertex3f(128.f, -128.f, -128.f); - gl.TexCoord2f(.75f, 1); - gl.Vertex3f(128.f, -128.f, 128.f); - gl.End(); + glBegin(GL_TRIANGLE_FAN); + glTexCoord2f(.75f, 0); + glVertex3f(128.f, 128.f, 128.f); + glTexCoord2f(1, 0); + glVertex3f(128.f, 128.f, -128.f); + glTexCoord2f(1, 1); + glVertex3f(128.f, -128.f, -128.f); + glTexCoord2f(.75f, 1); + glVertex3f(128.f, -128.f, 128.f); + glEnd(); } // top tex = FMaterial::ValidateTexture(sb->faces[faces]); tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0); gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_FAN); + glBegin(GL_TRIANGLE_FAN); if (!sb->fliptop) { - gl.TexCoord2f(0, 0); - gl.Vertex3f(128.f, 128.f, -128.f); - gl.TexCoord2f(1, 0); - gl.Vertex3f(-128.f, 128.f, -128.f); - gl.TexCoord2f(1, 1); - gl.Vertex3f(-128.f, 128.f, 128.f); - gl.TexCoord2f(0, 1); - gl.Vertex3f(128.f, 128.f, 128.f); + glTexCoord2f(0, 0); + glVertex3f(128.f, 128.f, -128.f); + glTexCoord2f(1, 0); + glVertex3f(-128.f, 128.f, -128.f); + glTexCoord2f(1, 1); + glVertex3f(-128.f, 128.f, 128.f); + glTexCoord2f(0, 1); + glVertex3f(128.f, 128.f, 128.f); } else { - gl.TexCoord2f(0, 0); - gl.Vertex3f(128.f, 128.f, 128.f); - gl.TexCoord2f(1, 0); - gl.Vertex3f(-128.f, 128.f, 128.f); - gl.TexCoord2f(1, 1); - gl.Vertex3f(-128.f, 128.f, -128.f); - gl.TexCoord2f(0, 1); - gl.Vertex3f(128.f, 128.f, -128.f); + glTexCoord2f(0, 0); + glVertex3f(128.f, 128.f, 128.f); + glTexCoord2f(1, 0); + glVertex3f(-128.f, 128.f, 128.f); + glTexCoord2f(1, 1); + glVertex3f(-128.f, 128.f, -128.f); + glTexCoord2f(0, 1); + glVertex3f(128.f, 128.f, -128.f); } - gl.End(); + glEnd(); // bottom tex = FMaterial::ValidateTexture(sb->faces[faces+1]); tex->Bind(CM_Index, GLT_CLAMPX|GLT_CLAMPY, 0); gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_FAN); - gl.TexCoord2f(0, 0); - gl.Vertex3f(128.f, -128.f, -128.f); - gl.TexCoord2f(1, 0); - gl.Vertex3f(-128.f, -128.f, -128.f); - gl.TexCoord2f(1, 1); - gl.Vertex3f(-128.f, -128.f, 128.f); - gl.TexCoord2f(0, 1); - gl.Vertex3f(128.f, -128.f, 128.f); - gl.End(); + glBegin(GL_TRIANGLE_FAN); + glTexCoord2f(0, 0); + glVertex3f(128.f, -128.f, -128.f); + glTexCoord2f(1, 0); + glVertex3f(-128.f, -128.f, -128.f); + glTexCoord2f(1, 1); + glVertex3f(-128.f, -128.f, 128.f); + glTexCoord2f(0, 1); + glVertex3f(128.f, -128.f, 128.f); + glEnd(); } @@ -556,8 +556,8 @@ void GLSkyPortal::DrawContents() gl_RenderState.EnableAlphaTest(false); gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - gl.MatrixMode(GL_MODELVIEW); - gl.PushMatrix(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); GLRenderer->SetupView(0, 0, 0, viewangle, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1)); if (origin->texture[0] && origin->texture[0]->tex->gl_info.bSkybox) @@ -601,13 +601,13 @@ void GLSkyPortal::DrawContents() { gl_RenderState.EnableTexture(false); foglayer=true; - gl.Color4f(FadeColor.r/255.0f,FadeColor.g/255.0f,FadeColor.b/255.0f,skyfog/255.0f); + glColor4f(FadeColor.r/255.0f,FadeColor.g/255.0f,FadeColor.b/255.0f,skyfog/255.0f); RenderDome(FNullTextureID(), NULL, 0, 0, false, CM_DEFAULT); gl_RenderState.EnableTexture(true); foglayer=false; } } - gl.PopMatrix(); + glPopMatrix(); glset.lightmode = oldlightmode; } diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index 8150bf17d..40b55dfef 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -165,7 +165,7 @@ void GLSprite::Draw(int pass) } gl_RenderState.AlphaFunc(GL_GEQUAL,minalpha*gl_mask_sprite_threshold); - gl.Color4f(0.2f,0.2f,0.2f,fuzzalpha); + glColor4f(0.2f,0.2f,0.2f,fuzzalpha); additivefog = true; } else if (RenderStyle.BlendOp == STYLEOP_Add && RenderStyle.DestAlpha == STYLEALPHA_One) @@ -220,7 +220,7 @@ void GLSprite::Draw(int pass) //&& GLRenderer->mViewActor != NULL && (gl_billboard_mode == 1 || (actor && actor->renderflags & RF_FORCEXYBILLBOARD ))) ); gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_STRIP); + glBegin(GL_TRIANGLE_STRIP); if ( drawWithXYBillboard ) { // Rotate the sprite about the vector starting at the center of the sprite @@ -243,17 +243,17 @@ void GLSprite::Draw(int pass) if (gltexture) { - gl.TexCoord2f(ul, vt); gl.Vertex3fv(&v1[0]); - gl.TexCoord2f(ur, vt); gl.Vertex3fv(&v2[0]); - gl.TexCoord2f(ul, vb); gl.Vertex3fv(&v3[0]); - gl.TexCoord2f(ur, vb); gl.Vertex3fv(&v4[0]); + glTexCoord2f(ul, vt); glVertex3fv(&v1[0]); + glTexCoord2f(ur, vt); glVertex3fv(&v2[0]); + glTexCoord2f(ul, vb); glVertex3fv(&v3[0]); + glTexCoord2f(ur, vb); glVertex3fv(&v4[0]); } else // Particle { - gl.Vertex3fv(&v1[0]); - gl.Vertex3fv(&v2[0]); - gl.Vertex3fv(&v3[0]); - gl.Vertex3fv(&v4[0]); + glVertex3fv(&v1[0]); + glVertex3fv(&v2[0]); + glVertex3fv(&v3[0]); + glVertex3fv(&v4[0]); } } @@ -261,20 +261,20 @@ void GLSprite::Draw(int pass) { if (gltexture) { - gl.TexCoord2f(ul, vt); gl.Vertex3f(x1, z1, y1); - gl.TexCoord2f(ur, vt); gl.Vertex3f(x2, z1, y2); - gl.TexCoord2f(ul, vb); gl.Vertex3f(x1, z2, y1); - gl.TexCoord2f(ur, vb); gl.Vertex3f(x2, z2, y2); + glTexCoord2f(ul, vt); glVertex3f(x1, z1, y1); + glTexCoord2f(ur, vt); glVertex3f(x2, z1, y2); + glTexCoord2f(ul, vb); glVertex3f(x1, z2, y1); + glTexCoord2f(ur, vb); glVertex3f(x2, z2, y2); } else // Particle { - gl.Vertex3f(x1, z1, y1); - gl.Vertex3f(x2, z1, y2); - gl.Vertex3f(x1, z2, y1); - gl.Vertex3f(x2, z2, y2); + glVertex3f(x1, z1, y1); + glVertex3f(x2, z1, y2); + glVertex3f(x1, z2, y1); + glVertex3f(x2, z2, y2); } } - gl.End(); + glEnd(); } else { diff --git a/src/gl/scene/gl_spritelight.cpp b/src/gl/scene/gl_spritelight.cpp index 56ab7030c..cdbf1950c 100644 --- a/src/gl/scene/gl_spritelight.cpp +++ b/src/gl/scene/gl_spritelight.cpp @@ -156,7 +156,7 @@ static int gl_SetSpriteLight(AActor *self, fixed_t x, fixed_t y, fixed_t z, subs r *= ThingColor.r/255.f; g *= ThingColor.g/255.f; b *= ThingColor.b/255.f; - gl.Color4f(r, g, b, alpha); + glColor4f(r, g, b, alpha); if (glset.lightmode == 8) { gl.VertexAttrib1f(VATTR_LIGHTLEVEL, gl_CalcLightLevel(lightlevel, rellight, weapon) / 255.0f); // Korshun. @@ -178,7 +178,7 @@ static int gl_SetSpriteLight(AActor *self, fixed_t x, fixed_t y, fixed_t z, subs g *= ThingColor.g/255.f; b *= ThingColor.b/255.f; - gl.Color4f(r, g, b, alpha); + glColor4f(r, g, b, alpha); if (dlightlevel == 0) return 0; @@ -280,7 +280,7 @@ int gl_SetSpriteLighting(FRenderStyle style, AActor *thing, int lightlevel, int if (style.BlendOp == STYLEOP_Shadow) { - gl.Color4f(0.2f * ThingColor.r / 255.f, 0.2f * ThingColor.g / 255.f, + glColor4f(0.2f * ThingColor.r / 255.f, 0.2f * ThingColor.g / 255.f, 0.2f * ThingColor.b / 255.f, (alpha = 0.33f)); } else diff --git a/src/gl/scene/gl_vertex.cpp b/src/gl/scene/gl_vertex.cpp index 0e70b4077..a11b06fde 100644 --- a/src/gl/scene/gl_vertex.cpp +++ b/src/gl/scene/gl_vertex.cpp @@ -85,8 +85,8 @@ void GLWall::SplitUpperEdge(texcoord * tcs, bool glow) if (glow) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - ztop[0] + (facc - fact) * fracfac, ztop[0] - zfloor[0] + (fact - facf) * fracfac); - gl.TexCoord2f(tcs[1].u + facu * fracfac, tcs[1].v + facv * fracfac); - gl.Vertex3f(cseg->v2->fx, ztop[0] + fact * fracfac, cseg->v2->fy); + glTexCoord2f(tcs[1].u + facu * fracfac, tcs[1].v + facv * fracfac); + glVertex3f(cseg->v2->fx, ztop[0] + fact * fracfac, cseg->v2->fy); } vertexcount += sidedef->numsegs-1; } @@ -121,8 +121,8 @@ void GLWall::SplitLowerEdge(texcoord * tcs, bool glow) if (glow) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - zbottom[0] + (facc - facb) * fracfac, zbottom[0] - zfloor[0] + (facb - facf) * fracfac); - gl.TexCoord2f(tcs[0].u + facu * fracfac, tcs[0].v + facv * fracfac); - gl.Vertex3f(cseg->v2->fx, zbottom[0] + facb * fracfac, cseg->v2->fy); + glTexCoord2f(tcs[0].u + facu * fracfac, tcs[0].v + facv * fracfac); + glVertex3f(cseg->v2->fx, zbottom[0] + facb * fracfac, cseg->v2->fy); } vertexcount += sidedef->numsegs-1; } @@ -151,9 +151,9 @@ void GLWall::SplitLeftEdge(texcoord * tcs, bool glow) while (inumheights && vi->heightlist[i] < ztop[0]) { if (glow) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - vi->heightlist[i], vi->heightlist[i] - zfloor[0]); - gl.TexCoord2f(factu1*(vi->heightlist[i] - ztop[0]) + tcs[1].u, + glTexCoord2f(factu1*(vi->heightlist[i] - ztop[0]) + tcs[1].u, factv1*(vi->heightlist[i] - ztop[0]) + tcs[1].v); - gl.Vertex3f(glseg.x1, vi->heightlist[i], glseg.y1); + glVertex3f(glseg.x1, vi->heightlist[i], glseg.y1); i++; } vertexcount+=i; @@ -184,9 +184,9 @@ void GLWall::SplitRightEdge(texcoord * tcs, bool glow) while (i>0 && vi->heightlist[i] > zbottom[1]) { if (glow) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[1] - vi->heightlist[i], vi->heightlist[i] - zfloor[1]); - gl.TexCoord2f(factu2 * (vi->heightlist[i] - ztop[1]) + tcs[2].u, + glTexCoord2f(factu2 * (vi->heightlist[i] - ztop[1]) + tcs[2].u, factv2 * (vi->heightlist[i] - ztop[1]) + tcs[2].v); - gl.Vertex3f(glseg.x2, vi->heightlist[i], glseg.y2); + glVertex3f(glseg.x2, vi->heightlist[i], glseg.y2); i--; } vertexcount+=i; diff --git a/src/gl/scene/gl_walls_draw.cpp b/src/gl/scene/gl_walls_draw.cpp index 1689909fc..fbd881982 100644 --- a/src/gl/scene/gl_walls_draw.cpp +++ b/src/gl/scene/gl_walls_draw.cpp @@ -245,40 +245,40 @@ void GLWall::RenderWall(int textured, float * color2, ADynamicLight * light) // the rest of the code is identical for textured rendering and lights - gl.Begin(GL_TRIANGLE_FAN); + glBegin(GL_TRIANGLE_FAN); // lower left corner if (glowing) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - zbottom[0], zbottom[0] - zfloor[0]); - if (textured&1) gl.TexCoord2f(tcs[0].u,tcs[0].v); - gl.Vertex3f(glseg.x1,zbottom[0],glseg.y1); + if (textured&1) glTexCoord2f(tcs[0].u,tcs[0].v); + glVertex3f(glseg.x1,zbottom[0],glseg.y1); if (split && glseg.fracleft==0) SplitLeftEdge(tcs, glowing); // upper left corner if (glowing) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[0] - ztop[0], ztop[0] - zfloor[0]); - if (textured&1) gl.TexCoord2f(tcs[1].u,tcs[1].v); - gl.Vertex3f(glseg.x1,ztop[0],glseg.y1); + if (textured&1) glTexCoord2f(tcs[1].u,tcs[1].v); + glVertex3f(glseg.x1,ztop[0],glseg.y1); if (split && !(flags & GLWF_NOSPLITUPPER)) SplitUpperEdge(tcs, glowing); // color for right side - if (color2) gl.Color4fv(color2); + if (color2) glColor4fv(color2); // upper right corner if (glowing) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[1] - ztop[1], ztop[1] - zfloor[1]); - if (textured&1) gl.TexCoord2f(tcs[2].u,tcs[2].v); - gl.Vertex3f(glseg.x2,ztop[1],glseg.y2); + if (textured&1) glTexCoord2f(tcs[2].u,tcs[2].v); + glVertex3f(glseg.x2,ztop[1],glseg.y2); if (split && glseg.fracright==1) SplitRightEdge(tcs, glowing); // lower right corner if (glowing) gl.VertexAttrib2f(VATTR_GLOWDISTANCE, zceil[1] - zbottom[1], zbottom[1] - zfloor[1]); - if (textured&1) gl.TexCoord2f(tcs[3].u,tcs[3].v); - gl.Vertex3f(glseg.x2,zbottom[1],glseg.y2); + if (textured&1) glTexCoord2f(tcs[3].u,tcs[3].v); + glVertex3f(glseg.x2,zbottom[1],glseg.y2); if (split && !(flags & GLWF_NOSPLITLOWER)) SplitLowerEdge(tcs, glowing); - gl.End(); + glEnd(); vertexcount+=4; @@ -328,14 +328,14 @@ void GLWall::RenderFogBoundary() gl_RenderState.EnableTexture(false); gl_RenderState.EnableFog(false); gl_RenderState.AlphaFunc(GL_GREATER,0); - gl.DepthFunc(GL_LEQUAL); - gl.Color4f(fc[0],fc[1],fc[2], fogd1); + glDepthFunc(GL_LEQUAL); + glColor4f(fc[0],fc[1],fc[2], fogd1); if (glset.lightmode == 8) gl.VertexAttrib1f(VATTR_LIGHTLEVEL, 1.0); // Korshun. flags &= ~GLWF_GLOW; RenderWall(4,fc); - gl.DepthFunc(GL_LESS); + glDepthFunc(GL_LESS); gl_RenderState.EnableFog(true); gl_RenderState.AlphaFunc(GL_GEQUAL,0.5f); gl_RenderState.EnableTexture(true); @@ -364,7 +364,7 @@ void GLWall::RenderMirrorSurface() gl_SetColor(lightlevel, 0, &Colormap ,0.1f); gl_RenderState.BlendFunc(GL_SRC_ALPHA,GL_ONE); gl_RenderState.AlphaFunc(GL_GREATER,0); - gl.DepthFunc(GL_LEQUAL); + glDepthFunc(GL_LEQUAL); gl_SetFog(lightlevel, getExtraLight(), &Colormap, true); FMaterial * pat=FMaterial::ValidateTexture(GLRenderer->mirrortexture); @@ -379,19 +379,19 @@ void GLWall::RenderMirrorSurface() // Restore the defaults for the translucent pass gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); gl_RenderState.AlphaFunc(GL_GEQUAL,0.5f*gl_mask_sprite_threshold); - gl.DepthFunc(GL_LESS); + glDepthFunc(GL_LESS); // This is drawn in the translucent pass which is done after the decal pass // As a result the decals have to be drawn here. if (seg->sidedef->AttachedDecals) { - gl.Enable(GL_POLYGON_OFFSET_FILL); - gl.PolygonOffset(-1.0f, -128.0f); - gl.DepthMask(false); + glEnable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(-1.0f, -128.0f); + glDepthMask(false); DoDrawDecals(); - gl.DepthMask(true); - gl.PolygonOffset(0.0f, 0.0f); - gl.Disable(GL_POLYGON_OFFSET_FILL); + glDepthMask(true); + glPolygonOffset(0.0f, 0.0f); + glDisable(GL_POLYGON_OFFSET_FILL); gl_RenderState.SetTextureMode(TM_MODULATE); gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } @@ -471,8 +471,8 @@ void GLWall::Draw(int pass) { if (pass != GLPASS_DECALS) { - gl.Enable(GL_POLYGON_OFFSET_FILL); - gl.PolygonOffset(-1.0f, -128.0f); + glEnable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(-1.0f, -128.0f); } } @@ -585,8 +585,8 @@ void GLWall::Draw(int pass) { if (pass!=GLPASS_DECALS) { - gl.Disable(GL_POLYGON_OFFSET_FILL); - gl.PolygonOffset(0, 0); + glDisable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(0, 0); } } } diff --git a/src/gl/scene/gl_weapon.cpp b/src/gl/scene/gl_weapon.cpp index f9f1a823b..83cdf67f6 100644 --- a/src/gl/scene/gl_weapon.cpp +++ b/src/gl/scene/gl_weapon.cpp @@ -152,12 +152,12 @@ void FGLRenderer::DrawPSprite (player_t * player,pspdef_t *psp,fixed_t sx, fixed gl_RenderState.EnableAlphaTest(false); } gl_RenderState.Apply(); - gl.Begin(GL_TRIANGLE_STRIP); - gl.TexCoord2f(fU1, fV1); gl.Vertex2f(x1,y1); - gl.TexCoord2f(fU1, fV2); gl.Vertex2f(x1,y2); - gl.TexCoord2f(fU2, fV1); gl.Vertex2f(x2,y1); - gl.TexCoord2f(fU2, fV2); gl.Vertex2f(x2,y2); - gl.End(); + glBegin(GL_TRIANGLE_STRIP); + glTexCoord2f(fU1, fV1); glVertex2f(x1,y1); + glTexCoord2f(fU1, fV2); glVertex2f(x1,y2); + glTexCoord2f(fU2, fV1); glVertex2f(x2,y1); + glTexCoord2f(fU2, fV2); glVertex2f(x2,y2); + glEnd(); if (tex->GetTransparent() || OverrideShader != 0) { gl_RenderState.EnableAlphaTest(true); @@ -398,7 +398,7 @@ void FGLRenderer::DrawTargeterSprites() gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); gl_RenderState.AlphaFunc(GL_GEQUAL,gl_mask_sprite_threshold); gl_RenderState.BlendEquation(GL_FUNC_ADD); - gl.Color3f(1.0f,1.0f,1.0f); + glColor3f(1.0f,1.0f,1.0f); gl_RenderState.SetTextureMode(TM_MODULATE); // The Targeter's sprites are always drawn normally. diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index c486cb374..ec717934c 100644 Binary files a/src/gl/system/gl_framebuffer.cpp and b/src/gl/system/gl_framebuffer.cpp differ diff --git a/src/gl/system/gl_interface.cpp b/src/gl/system/gl_interface.cpp index 299ea7878..536dc194b 100644 --- a/src/gl/system/gl_interface.cpp +++ b/src/gl/system/gl_interface.cpp @@ -116,82 +116,6 @@ static bool CheckExtension(const char *ext) static void InitContext() { gl.flags=0; - - gl.Begin = glBegin; - gl.End = glEnd; - gl.DrawArrays = glDrawArrays; - - gl.TexCoord2f = glTexCoord2f; - gl.TexCoord2fv = glTexCoord2fv; - - gl.Vertex2f = glVertex2f; - gl.Vertex2i = glVertex2i; - gl.Vertex3f = glVertex3f; - gl.Vertex3fv = glVertex3fv; - gl.Vertex3d = glVertex3d; - - gl.Color4f = glColor4f; - gl.Color4fv = glColor4fv; - gl.Color3f = glColor3f; - gl.Color3ub = glColor3ub; - gl.Color4ub = glColor4ub; - - gl.ColorMask = glColorMask; - - gl.DepthFunc = glDepthFunc; - gl.DepthMask = glDepthMask; - gl.DepthRange = glDepthRange; - - gl.StencilFunc = glStencilFunc; - gl.StencilMask = glStencilMask; - gl.StencilOp = glStencilOp; - - gl.MatrixMode = glMatrixMode; - gl.PushMatrix = glPushMatrix; - gl.PopMatrix = glPopMatrix; - gl.LoadIdentity = glLoadIdentity; - gl.MultMatrixd = glMultMatrixd; - gl.Translatef = glTranslatef; - gl.Ortho = glOrtho; - gl.Scalef = glScalef; - gl.Rotatef = glRotatef; - - gl.Viewport = glViewport; - gl.Scissor = glScissor; - - gl.Clear = glClear; - gl.ClearColor = glClearColor; - gl.ClearDepth = glClearDepth; - gl.ShadeModel = glShadeModel; - gl.Hint = glHint; - - gl.DisableClientState = glDisableClientState; - gl.EnableClientState = glEnableClientState; - - gl.Fogf = glFogf; - gl.Fogi = glFogi; - gl.Fogfv = glFogfv; - - gl.Enable = glEnable; - gl.IsEnabled = glIsEnabled; - gl.Disable = glDisable; - - gl.TexGeni = glTexGeni; - gl.DeleteTextures = glDeleteTextures; - gl.GenTextures = glGenTextures; - gl.BindTexture = glBindTexture; - gl.TexImage2D = glTexImage2D; - gl.TexParameterf = glTexParameterf; - gl.TexParameteri = glTexParameteri; - gl.CopyTexSubImage2D = glCopyTexSubImage2D; - - gl.ReadPixels = glReadPixels; - gl.PolygonOffset = glPolygonOffset; - gl.ClipPlane = glClipPlane; - - gl.Finish = glFinish; - gl.Flush = glFlush; - gl.BlendEquation = glBlendEquationDummy; } diff --git a/src/gl/system/gl_interface.h b/src/gl/system/gl_interface.h index 2cd554111..7e937dcbf 100644 --- a/src/gl/system/gl_interface.h +++ b/src/gl/system/gl_interface.h @@ -66,81 +66,7 @@ struct RenderContext return maxuniforms>=2048? 128:64; } - void (APIENTRY * Begin) (GLenum mode); - void (APIENTRY * End) (void); - void (APIENTRY * DrawArrays) (GLenum mode, GLint first, GLsizei count); - - void (APIENTRY * TexCoord2f) (GLfloat s, GLfloat t); - void (APIENTRY * TexCoord2fv) (const GLfloat *v); - - void (APIENTRY * Vertex2f) (GLfloat x, GLfloat y); - void (APIENTRY * Vertex2i) (GLint x, GLint y); - void (APIENTRY * Vertex3f) (GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY * Vertex3d) (GLdouble x, GLdouble y, GLdouble z); - void (APIENTRY * Vertex3fv) (const GLfloat *v); - - void (APIENTRY * Color4f) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); - void (APIENTRY * Color4fv) (const GLfloat *v); - void (APIENTRY * Color3f) (GLfloat red, GLfloat green, GLfloat blue); - void (APIENTRY * Color3ub) (GLubyte red, GLubyte green, GLubyte blue); - void (APIENTRY * Color4ub) (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); - void (APIENTRY * BlendEquation) (GLenum); - void (APIENTRY * ColorMask) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); - - void (APIENTRY * DepthFunc) (GLenum func); - void (APIENTRY * DepthMask) (GLboolean flag); - void (APIENTRY * DepthRange) (GLclampd zNear, GLclampd zFar); - - void (APIENTRY * StencilFunc) (GLenum func, GLint ref, GLuint mask); - void (APIENTRY * StencilMask) (GLuint mask); - void (APIENTRY * StencilOp) (GLenum fail, GLenum zfail, GLenum zpass); - - void (APIENTRY * MatrixMode) (GLenum mode); - void (APIENTRY * PushMatrix) (void); - void (APIENTRY * PopMatrix) (void); - void (APIENTRY * LoadIdentity) (void); - void (APIENTRY * MultMatrixd) (const GLdouble *m); - void (APIENTRY * Translatef) (GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY * Ortho) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); - void (APIENTRY * Scalef) (GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY * Rotatef) (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); - - void (APIENTRY * Viewport) (GLint x, GLint y, GLsizei width, GLsizei height); - void (APIENTRY * Scissor) (GLint x, GLint y, GLsizei width, GLsizei height); - - void (APIENTRY * Clear) (GLbitfield mask); - void (APIENTRY * ClearColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - void (APIENTRY * ClearDepth) (GLclampd depth); - void (APIENTRY * ShadeModel) (GLenum mode); - void (APIENTRY * Hint) (GLenum target, GLenum mode); - - void (APIENTRY * DisableClientState) (GLenum array); - void (APIENTRY * EnableClientState) (GLenum array); - - void (APIENTRY * Fogf) (GLenum pname, GLfloat param); - void (APIENTRY * Fogi) (GLenum pname, GLint param); - void (APIENTRY * Fogfv) (GLenum pname, const GLfloat *params); - - void (APIENTRY * Enable) (GLenum cap); - GLboolean (APIENTRY * IsEnabled) (GLenum cap); - void (APIENTRY * Disable) (GLenum cap); - - void (APIENTRY * TexGeni) (GLenum coord, GLenum pname, GLint param); - void (APIENTRY * DeleteTextures) (GLsizei n, const GLuint *textures); - void (APIENTRY * GenTextures) (GLsizei n, GLuint *textures); - void (APIENTRY * BindTexture) (GLenum target, GLuint texture); - void (APIENTRY * TexImage2D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); - void (APIENTRY * TexParameterf) (GLenum target, GLenum pname, GLfloat param); - void (APIENTRY * TexParameteri) (GLenum target, GLenum pname, GLint param); - void (APIENTRY * CopyTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); - - void (APIENTRY * ReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); - void (APIENTRY * PolygonOffset) (GLfloat factor, GLfloat units); - void (APIENTRY * ClipPlane) (GLenum which, const GLdouble *); - - void (APIENTRY * Finish) (void); - void (APIENTRY * Flush) (void); // ARB_SHADER_OBJECTS PFNGLDELETESHADERPROC DeleteShader; diff --git a/src/gl/system/gl_wipe.cpp b/src/gl/system/gl_wipe.cpp index 63ec45b43..d290fcc30 100644 --- a/src/gl/system/gl_wipe.cpp +++ b/src/gl/system/gl_wipe.cpp @@ -145,13 +145,13 @@ bool OpenGLFrameBuffer::WipeStartScreen(int type) wipestartscreen = new FHardwareTexture(Width, Height, false, false, false, true); wipestartscreen->CreateTexture(NULL, Width, Height, false, 0, CM_DEFAULT); - gl.Finish(); + glFinish(); wipestartscreen->Bind(0, CM_DEFAULT); - gl.CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, Width, Height); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, Width, Height); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); return true; } @@ -168,13 +168,13 @@ void OpenGLFrameBuffer::WipeEndScreen() { wipeendscreen = new FHardwareTexture(Width, Height, false, false, false, true); wipeendscreen->CreateTexture(NULL, Width, Height, false, 0, CM_DEFAULT); - gl.Flush(); + glFlush(); wipeendscreen->Bind(0, CM_DEFAULT); - gl.CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, Width, Height); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, Width, Height); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); Unlock(); } @@ -202,11 +202,11 @@ bool OpenGLFrameBuffer::WipeDo(int ticks) gl_RenderState.EnableTexture(true); gl_RenderState.EnableFog(false); - gl.Disable(GL_DEPTH_TEST); - gl.DepthMask(false); + glDisable(GL_DEPTH_TEST); + glDepthMask(false); bool done = ScreenWipe->Run(ticks, this); - gl.DepthMask(true); + glDepthMask(true); //DrawLetterbox(); return done; } @@ -280,30 +280,30 @@ bool OpenGLFrameBuffer::Wiper_Crossfade::Run(int ticks, OpenGLFrameBuffer *fb) gl_RenderState.EnableAlphaTest(false); gl_RenderState.Apply(); fb->wipestartscreen->Bind(0, CM_DEFAULT); - gl.Color4f(1.f, 1.f, 1.f, 1.f); - gl.Begin(GL_TRIANGLE_STRIP); - gl.TexCoord2f(0, vb); - gl.Vertex2i(0, 0); - gl.TexCoord2f(0, 0); - gl.Vertex2i(0, fb->Height); - gl.TexCoord2f(ur, vb); - gl.Vertex2i(fb->Width, 0); - gl.TexCoord2f(ur, 0); - gl.Vertex2i(fb->Width, fb->Height); - gl.End(); + glColor4f(1.f, 1.f, 1.f, 1.f); + glBegin(GL_TRIANGLE_STRIP); + glTexCoord2f(0, vb); + glVertex2i(0, 0); + glTexCoord2f(0, 0); + glVertex2i(0, fb->Height); + glTexCoord2f(ur, vb); + glVertex2i(fb->Width, 0); + glTexCoord2f(ur, 0); + glVertex2i(fb->Width, fb->Height); + glEnd(); fb->wipeendscreen->Bind(0, CM_DEFAULT); - gl.Color4f(1.f, 1.f, 1.f, clamp(Clock/32.f, 0.f, 1.f)); - gl.Begin(GL_TRIANGLE_STRIP); - gl.TexCoord2f(0, vb); - gl.Vertex2i(0, 0); - gl.TexCoord2f(0, 0); - gl.Vertex2i(0, fb->Height); - gl.TexCoord2f(ur, vb); - gl.Vertex2i(fb->Width, 0); - gl.TexCoord2f(ur, 0); - gl.Vertex2i(fb->Width, fb->Height); - gl.End(); + glColor4f(1.f, 1.f, 1.f, clamp(Clock/32.f, 0.f, 1.f)); + glBegin(GL_TRIANGLE_STRIP); + glTexCoord2f(0, vb); + glVertex2i(0, 0); + glTexCoord2f(0, 0); + glVertex2i(0, fb->Height); + glTexCoord2f(ur, vb); + glVertex2i(fb->Width, 0); + glTexCoord2f(ur, 0); + glVertex2i(fb->Width, fb->Height); + glEnd(); gl_RenderState.EnableAlphaTest(true); gl_RenderState.SetTextureMode(TM_MODULATE); @@ -347,17 +347,17 @@ bool OpenGLFrameBuffer::Wiper_Melt::Run(int ticks, OpenGLFrameBuffer *fb) gl_RenderState.SetTextureMode(TM_OPAQUE); gl_RenderState.Apply(); fb->wipeendscreen->Bind(0, CM_DEFAULT); - gl.Color4f(1.f, 1.f, 1.f, 1.f); - gl.Begin(GL_TRIANGLE_STRIP); - gl.TexCoord2f(0, vb); - gl.Vertex2i(0, 0); - gl.TexCoord2f(0, 0); - gl.Vertex2i(0, fb->Height); - gl.TexCoord2f(ur, vb); - gl.Vertex2i(fb->Width, 0); - gl.TexCoord2f(ur, 0); - gl.Vertex2i(fb->Width, fb->Height); - gl.End(); + glColor4f(1.f, 1.f, 1.f, 1.f); + glBegin(GL_TRIANGLE_STRIP); + glTexCoord2f(0, vb); + glVertex2i(0, 0); + glTexCoord2f(0, 0); + glVertex2i(0, fb->Height); + glTexCoord2f(ur, vb); + glVertex2i(fb->Width, 0); + glTexCoord2f(ur, 0); + glVertex2i(fb->Width, fb->Height); + glEnd(); int i, dy; bool done = false; @@ -397,17 +397,17 @@ bool OpenGLFrameBuffer::Wiper_Melt::Run(int ticks, OpenGLFrameBuffer *fb) float th = (float)FHardwareTexture::GetTexDimension(fb->Height); rect.bottom = fb->Height - rect.bottom; rect.top = fb->Height - rect.top; - gl.Color4f(1.f, 1.f, 1.f, 1.f); - gl.Begin(GL_TRIANGLE_STRIP); - gl.TexCoord2f(rect.left / tw, rect.top / th); - gl.Vertex2i(rect.left, rect.bottom); - gl.TexCoord2f(rect.left / tw, rect.bottom / th); - gl.Vertex2i(rect.left, rect.top); - gl.TexCoord2f(rect.right / tw, rect.top / th); - gl.Vertex2i(rect.right, rect.bottom); - gl.TexCoord2f(rect.right / tw, rect.bottom / th); - gl.Vertex2i(rect.right, rect.top); - gl.End(); + glColor4f(1.f, 1.f, 1.f, 1.f); + glBegin(GL_TRIANGLE_STRIP); + glTexCoord2f(rect.left / tw, rect.top / th); + glVertex2i(rect.left, rect.bottom); + glTexCoord2f(rect.left / tw, rect.bottom / th); + glVertex2i(rect.left, rect.top); + glTexCoord2f(rect.right / tw, rect.top / th); + glVertex2i(rect.right, rect.bottom); + glTexCoord2f(rect.right / tw, rect.bottom / th); + glVertex2i(rect.right, rect.top); + glEnd(); } } } @@ -492,22 +492,22 @@ bool OpenGLFrameBuffer::Wiper_Burn::Run(int ticks, OpenGLFrameBuffer *fb) gl_RenderState.EnableAlphaTest(false); gl_RenderState.Apply(); fb->wipestartscreen->Bind(0, CM_DEFAULT); - gl.Color4f(1.f, 1.f, 1.f, 1.f); - gl.Begin(GL_TRIANGLE_STRIP); - gl.TexCoord2f(0, vb); - gl.Vertex2i(0, 0); - gl.TexCoord2f(0, 0); - gl.Vertex2i(0, fb->Height); - gl.TexCoord2f(ur, vb); - gl.Vertex2i(fb->Width, 0); - gl.TexCoord2f(ur, 0); - gl.Vertex2i(fb->Width, fb->Height); - gl.End(); + glColor4f(1.f, 1.f, 1.f, 1.f); + glBegin(GL_TRIANGLE_STRIP); + glTexCoord2f(0, vb); + glVertex2i(0, 0); + glTexCoord2f(0, 0); + glVertex2i(0, fb->Height); + glTexCoord2f(ur, vb); + glVertex2i(fb->Width, 0); + glTexCoord2f(ur, 0); + glVertex2i(fb->Width, fb->Height); + glEnd(); gl_RenderState.SetTextureMode(TM_MODULATE); gl_RenderState.Apply(true); gl.ActiveTexture(GL_TEXTURE1); - gl.Enable(GL_TEXTURE_2D); + glEnable(GL_TEXTURE_2D); // mask out the alpha channel of the wipeendscreen. glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); @@ -521,35 +521,35 @@ bool OpenGLFrameBuffer::Wiper_Burn::Run(int ticks, OpenGLFrameBuffer *fb) gl.ActiveTexture(GL_TEXTURE0); // Burn the new screen on top of it. - gl.Color4f(1.f, 1.f, 1.f, 1.f); + glColor4f(1.f, 1.f, 1.f, 1.f); fb->wipeendscreen->Bind(1, CM_DEFAULT); //BurnTexture->Bind(0, CM_DEFAULT); BurnTexture->CreateTexture(rgb_buffer, WIDTH, HEIGHT, false, 0, CM_DEFAULT); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - gl.Begin(GL_TRIANGLE_STRIP); + glBegin(GL_TRIANGLE_STRIP); gl.MultiTexCoord2f(GL_TEXTURE0, 0, 0); gl.MultiTexCoord2f(GL_TEXTURE1, 0, vb); - gl.Vertex2i(0, 0); + glVertex2i(0, 0); gl.MultiTexCoord2f(GL_TEXTURE0, 0, 1); gl.MultiTexCoord2f(GL_TEXTURE1, 0, 0); - gl.Vertex2i(0, fb->Height); + glVertex2i(0, fb->Height); gl.MultiTexCoord2f(GL_TEXTURE0, 1, 0); gl.MultiTexCoord2f(GL_TEXTURE1, ur, vb); - gl.Vertex2i(fb->Width, 0); + glVertex2i(fb->Width, 0); gl.MultiTexCoord2f(GL_TEXTURE0, 1, 1); gl.MultiTexCoord2f(GL_TEXTURE1, ur, 0); - gl.Vertex2i(fb->Width, fb->Height); - gl.End(); + glVertex2i(fb->Width, fb->Height); + glEnd(); gl.ActiveTexture(GL_TEXTURE1); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - gl.Disable(GL_TEXTURE_2D); + glDisable(GL_TEXTURE_2D); gl.ActiveTexture(GL_TEXTURE0); // The fire may not always stabilize, so the wipe is forced to end diff --git a/src/gl/textures/gl_hwtexture.cpp b/src/gl/textures/gl_hwtexture.cpp index 0093729b2..eaf581be4 100644 --- a/src/gl/textures/gl_hwtexture.cpp +++ b/src/gl/textures/gl_hwtexture.cpp @@ -96,8 +96,8 @@ void FHardwareTexture::LoadImage(unsigned char * buffer,int w, int h, unsigned i if (alphatexture) texformat=GL_ALPHA8; else if (forcenocompression) texformat = GL_RGBA8; - if (glTexID==0) gl.GenTextures(1,&glTexID); - gl.BindTexture(GL_TEXTURE_2D, glTexID); + if (glTexID==0) glGenTextures(1,&glTexID); + glBindTexture(GL_TEXTURE_2D, glTexID); lastbound[texunit]=glTexID; if (!buffer) @@ -109,7 +109,7 @@ void FHardwareTexture::LoadImage(unsigned char * buffer,int w, int h, unsigned i // The texture must at least be initialized if no data is present. mipmap=false; - gl.TexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, false); + glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, false); buffer=(unsigned char *)calloc(4,rw * (rh+1)); deletebuffer=true; //texheight=-h; @@ -119,7 +119,7 @@ void FHardwareTexture::LoadImage(unsigned char * buffer,int w, int h, unsigned i rw = GetTexDimension (w); rh = GetTexDimension (h); - gl.TexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, (mipmap && use_mipmapping && !forcenofiltering)); + glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, (mipmap && use_mipmapping && !forcenofiltering)); if (rw == w && rh == h) { @@ -157,38 +157,38 @@ void FHardwareTexture::LoadImage(unsigned char * buffer,int w, int h, unsigned i } } } - gl.TexImage2D(GL_TEXTURE_2D, 0, texformat, rw, rh, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + glTexImage2D(GL_TEXTURE_2D, 0, texformat, rw, rh, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer); if (deletebuffer) free(buffer); // When using separate samplers the stuff below is not needed. // if (gl.flags & RFL_SAMPLER_OBJECTS) return; - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapparam==GL_CLAMP? GL_CLAMP_TO_EDGE : GL_REPEAT); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapparam==GL_CLAMP? GL_CLAMP_TO_EDGE : GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapparam==GL_CLAMP? GL_CLAMP_TO_EDGE : GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapparam==GL_CLAMP? GL_CLAMP_TO_EDGE : GL_REPEAT); clampmode = wrapparam==GL_CLAMP? GLT_CLAMPX|GLT_CLAMPY : 0; if (forcenofiltering) { - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - gl.TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.f); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.f); } else { if (mipmap && use_mipmapping) { - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[gl_texture_filter].minfilter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[gl_texture_filter].minfilter); if (gl_texture_filter_anisotropic) { - gl.TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic); } } else { - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[gl_texture_filter].magfilter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[gl_texture_filter].magfilter); } - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[gl_texture_filter].magfilter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[gl_texture_filter].magfilter); } } @@ -230,7 +230,7 @@ void FHardwareTexture::DeleteTexture(unsigned int texid) lastbound[i] = 0; } } - gl.DeleteTextures(1, &texid); + glDeleteTextures(1, &texid); } } @@ -249,7 +249,7 @@ void FHardwareTexture::Clean(bool all) { DeleteTexture(glTexID[i]); } - //gl.DeleteTextures(cm_arraysize,glTexID); + //glDeleteTextures(cm_arraysize,glTexID); memset(glTexID,0,sizeof(unsigned int)*cm_arraysize); } else @@ -258,7 +258,7 @@ void FHardwareTexture::Clean(bool all) { DeleteTexture(glTexID[i]); } - //gl.DeleteTextures(cm_arraysize-1,glTexID+1); + //glDeleteTextures(cm_arraysize-1,glTexID+1); memset(glTexID+1,0,sizeof(unsigned int)*(cm_arraysize-1)); } for(unsigned int i=0;iBind(texunit, cm, translation)) { - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (clampmode & GLT_CLAMPX)? GL_CLAMP_TO_EDGE : GL_REPEAT); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (clampmode & GLT_CLAMPY)? GL_CLAMP_TO_EDGE : GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (clampmode & GLT_CLAMPX)? GL_CLAMP_TO_EDGE : GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (clampmode & GLT_CLAMPY)? GL_CLAMP_TO_EDGE : GL_REPEAT); } } else @@ -446,8 +446,8 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int cm, int clampmode, int delete[] buffer; return NULL; } - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (clampmode & GLT_CLAMPX)? GL_CLAMP_TO_EDGE : GL_REPEAT); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (clampmode & GLT_CLAMPY)? GL_CLAMP_TO_EDGE : GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (clampmode & GLT_CLAMPX)? GL_CLAMP_TO_EDGE : GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (clampmode & GLT_CLAMPY)? GL_CLAMP_TO_EDGE : GL_REPEAT); delete[] buffer; } @@ -502,8 +502,8 @@ const FHardwareTexture * FGLTexture::BindPatch(int texunit, int cm, int translat return NULL; } delete[] buffer; - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } return glpatch; }