mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- enable shader-less rendering. Still very incomplete, but at least the basics are working.
This commit is contained in:
parent
3b1500438d
commit
eb27057853
5 changed files with 69 additions and 26 deletions
|
@ -110,6 +110,8 @@ FFlatVertexBuffer::~FFlatVertexBuffer()
|
|||
void FFlatVertexBuffer::BindVBO()
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
if (gl.glslversion > 0)
|
||||
{
|
||||
if (vbo_id != 0) // set this up only if there is an actual buffer.
|
||||
{
|
||||
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FFlatVertex), &VTO->x);
|
||||
|
@ -125,6 +127,13 @@ void FFlatVertexBuffer::BindVBO()
|
|||
glDisableVertexAttribArray(VATTR_COLOR);
|
||||
glDisableVertexAttribArray(VATTR_VERTEX2);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -134,11 +134,20 @@ void FModelVertexBuffer::BindVBO()
|
|||
{
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
if (gl.glslversion > 0)
|
||||
{
|
||||
glEnableVertexAttribArray(VATTR_VERTEX);
|
||||
glEnableVertexAttribArray(VATTR_TEXCOORD);
|
||||
glEnableVertexAttribArray(VATTR_VERTEX2);
|
||||
glDisableVertexAttribArray(VATTR_COLOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -222,9 +231,18 @@ void FModelVertexBuffer::UnlockIndexBuffer()
|
|||
unsigned int FModelVertexBuffer::SetupFrame(unsigned int frame1, unsigned int frame2)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
if (gl.glslversion > 0)
|
||||
{
|
||||
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame1].x);
|
||||
glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame1].u);
|
||||
glVertexAttribPointer(VATTR_VERTEX2, 3, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame2].x);
|
||||
}
|
||||
else
|
||||
{
|
||||
// only used for single frame models so there is no vertex2 here, which has no use without a shader.
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(FModelVertex), &VMO[frame1].x);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(FModelVertex), &VMO[frame1].u);
|
||||
}
|
||||
return frame1;
|
||||
}
|
||||
|
||||
|
|
|
@ -315,6 +315,8 @@ void FRenderState::ApplyMatrices()
|
|||
}
|
||||
|
||||
void FRenderState::ApplyLightIndex(int index)
|
||||
{
|
||||
if (gl.lightmethod != LM_SOFTWARE)
|
||||
{
|
||||
if (index > -1 && GLRenderer->mLights->GetBufferType() == GL_UNIFORM_BUFFER)
|
||||
{
|
||||
|
@ -322,3 +324,4 @@ void FRenderState::ApplyLightIndex(int index)
|
|||
}
|
||||
activeShader->muLightIndex.Set(index);
|
||||
}
|
||||
}
|
|
@ -87,6 +87,8 @@ FSkyVertexBuffer::~FSkyVertexBuffer()
|
|||
void FSkyVertexBuffer::BindVBO()
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
if (gl.glslversion > 0)
|
||||
{
|
||||
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FSkyVertex), &VSO->x);
|
||||
glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FSkyVertex), &VSO->u);
|
||||
glVertexAttribPointer(VATTR_COLOR, 4, GL_UNSIGNED_BYTE, true, sizeof(FSkyVertex), &VSO->color);
|
||||
|
@ -95,6 +97,16 @@ void FSkyVertexBuffer::BindVBO()
|
|||
glEnableVertexAttribArray(VATTR_COLOR);
|
||||
glDisableVertexAttribArray(VATTR_VERTEX2);
|
||||
}
|
||||
else
|
||||
{
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(FSkyVertex), &VSO->x);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(FSkyVertex), &VSO->u);
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(FSkyVertex), &VSO->color);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -162,6 +162,7 @@ void gl_LoadExtensions()
|
|||
{
|
||||
gl.version = 2.11f;
|
||||
gl.glslversion = 0;
|
||||
gl.lightmethod = LM_SOFTWARE;
|
||||
}
|
||||
else if (gl.version < 3.0f)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue