mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 23:32:02 +00:00
- put all the common part of buffer based drawing into a separate method of the vertex buffer.
This commit is contained in:
parent
23fbd69963
commit
09ba62fbef
7 changed files with 16 additions and 24 deletions
|
@ -70,6 +70,14 @@ public:
|
|||
mCurIndex = newofs;
|
||||
return diff;
|
||||
}
|
||||
#ifdef __GL_PCH_H // we need the system includes for this but we cannot include them ourselves without creating #define clashes. The affected files wouldn't try to draw anyway.
|
||||
void RenderCurrent(FFlatVertex *newptr, unsigned int primtype)
|
||||
{
|
||||
unsigned int offset;
|
||||
unsigned int count = GetCount(newptr, &offset);
|
||||
glDrawArrays(primtype, offset, count);
|
||||
}
|
||||
#endif
|
||||
void Reset()
|
||||
{
|
||||
mCurIndex = mIndex;
|
||||
|
|
|
@ -355,9 +355,7 @@ void GLWall::DrawDecal(DBaseDecal *decal)
|
|||
ptr->Set(dv[i].x, dv[i].z, dv[i].y, dv[i].u, dv[i].v);
|
||||
ptr++;
|
||||
}
|
||||
unsigned int offset;
|
||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
||||
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
|
||||
}
|
||||
rendered_decals++;
|
||||
gl_RenderState.SetTextureMode(TM_MODULATE);
|
||||
|
|
|
@ -1011,9 +1011,7 @@ void FDrawInfo::SetupFloodStencil(wallseg * ws)
|
|||
ptr++;
|
||||
ptr->Set(ws->x2, ws->z1, ws->y2, 0, 0);
|
||||
ptr++;
|
||||
unsigned int offset;
|
||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
||||
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
|
||||
}
|
||||
|
||||
glStencilFunc(GL_EQUAL,recursion+1,~0); // draw sky into stencil
|
||||
|
@ -1055,9 +1053,7 @@ void FDrawInfo::ClearFloodStencil(wallseg * ws)
|
|||
ptr++;
|
||||
ptr->Set(ws->x2, ws->z1, ws->y2, 0, 0);
|
||||
ptr++;
|
||||
unsigned int offset;
|
||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
||||
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
|
||||
}
|
||||
|
||||
// restore old stencil op.
|
||||
|
@ -1158,9 +1154,7 @@ void FDrawInfo::DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, boo
|
|||
ptr++;
|
||||
ptr->Set(px4, planez, py4, px4 / 64, -py4 / 64);
|
||||
ptr++;
|
||||
unsigned int offset;
|
||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
||||
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
|
||||
}
|
||||
|
||||
if (pushed)
|
||||
|
|
|
@ -295,9 +295,7 @@ void GLFlat::DrawSubsector(subsector_t * sub)
|
|||
ptr++;
|
||||
}
|
||||
}
|
||||
unsigned int offset;
|
||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
||||
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
|
||||
}
|
||||
|
||||
flatvertices += sub->numlines;
|
||||
|
|
|
@ -637,9 +637,7 @@ static void FillScreen()
|
|||
ptr++;
|
||||
ptr->Set((float)SCREENWIDTH, (float)SCREENHEIGHT, 0, 0, 0);
|
||||
ptr++;
|
||||
unsigned int offset;
|
||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
||||
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_STRIP);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -302,9 +302,7 @@ void GLWall::RenderWall(int textured, float * color2, ADynamicLight * light)
|
|||
ptr->Set(glseg.x2, zbottom[1], glseg.y2, tcs[3].u, tcs[3].v);
|
||||
ptr++;
|
||||
if (split && !(flags & GLWF_NOSPLITLOWER)) SplitLowerEdge(tcs, ptr);
|
||||
unsigned int offset;
|
||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
||||
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
|
||||
vertexcount += 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,9 +174,7 @@ void FGLRenderer::DrawPSprite (player_t * player,pspdef_t *psp,fixed_t sx, fixed
|
|||
ptr++;
|
||||
ptr->Set(x2, y2, 0, fU2, fV2);
|
||||
ptr++;
|
||||
unsigned int offset;
|
||||
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, offset, count);
|
||||
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_STRIP);
|
||||
}
|
||||
if (tex->GetTransparent() || OverrideShader != 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue