mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
- renamed WipeVertexBuffer to FSimpleVertexBuffer because this will be useful elsewhere, too.
This commit is contained in:
parent
52537b0af2
commit
04c59b434b
4 changed files with 41 additions and 48 deletions
|
@ -71,6 +71,34 @@ FVertexBuffer::~FVertexBuffer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FSimpleVertexBuffer::BindVBO()
|
||||||
|
{
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||||
|
if (gl.glslversion > 0)
|
||||||
|
{
|
||||||
|
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FFlatVertex), &VTO->x);
|
||||||
|
glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FFlatVertex), &VTO->u);
|
||||||
|
glDisableVertexAttribArray(VATTR_COLOR);
|
||||||
|
glDisableVertexAttribArray(VATTR_VERTEX2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glVertexPointer(3, GL_FLOAT, sizeof(FFlatVertex), &VTO->x);
|
||||||
|
glTexCoordPointer(2, GL_FLOAT, sizeof(FFlatVertex), &VTO->u);
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FSimpleVertexBuffer::set(FFlatVertex *verts, int count)
|
||||||
|
{
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||||
|
gl_RenderState.SetVertexBuffer(this);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, count * sizeof(*verts), verts, GL_STREAM_DRAW);
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -41,6 +41,16 @@ struct FFlatVertex
|
||||||
|
|
||||||
#define VTO ((FFlatVertex*)NULL)
|
#define VTO ((FFlatVertex*)NULL)
|
||||||
|
|
||||||
|
class FSimpleVertexBuffer : public FVertexBuffer
|
||||||
|
{
|
||||||
|
TArray<FFlatVertex> mBuffer;
|
||||||
|
public:
|
||||||
|
FSimpleVertexBuffer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void BindVBO();
|
||||||
|
void set(FFlatVertex *verts, int count);
|
||||||
|
};
|
||||||
|
|
||||||
class FFlatVertexBuffer : public FVertexBuffer
|
class FFlatVertexBuffer : public FVertexBuffer
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class FHardwareTexture;
|
class FHardwareTexture;
|
||||||
|
class FSimpleVertexBuffer;
|
||||||
|
|
||||||
extern long gl_frameMS;
|
extern long gl_frameMS;
|
||||||
extern long gl_frameCount;
|
extern long gl_frameCount;
|
||||||
|
@ -94,10 +95,9 @@ private:
|
||||||
|
|
||||||
class Wiper
|
class Wiper
|
||||||
{
|
{
|
||||||
class WipeVertexBuffer;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WipeVertexBuffer *mVertexBuf;
|
FSimpleVertexBuffer *mVertexBuf;
|
||||||
|
|
||||||
void MakeVBO(OpenGLFrameBuffer *fb);
|
void MakeVBO(OpenGLFrameBuffer *fb);
|
||||||
|
|
||||||
|
|
|
@ -271,51 +271,6 @@ void OpenGLFrameBuffer::WipeCleanup()
|
||||||
FMaterial::ClearLastTexture();
|
FMaterial::ClearLastTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// The wiper vertex buffer
|
|
||||||
//
|
|
||||||
// Note that this will recreate the buffer each frame, although
|
|
||||||
// only for melt its contents will change.
|
|
||||||
//
|
|
||||||
// But since this is no time critical code, ease of implementation
|
|
||||||
// was chosen over maximum efficiency.
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
class OpenGLFrameBuffer::Wiper::WipeVertexBuffer : public FVertexBuffer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
WipeVertexBuffer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
void BindVBO()
|
|
||||||
{
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
|
||||||
if (gl.glslversion > 0)
|
|
||||||
{
|
|
||||||
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FFlatVertex), &VTO->x);
|
|
||||||
glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FFlatVertex), &VTO->u);
|
|
||||||
glDisableVertexAttribArray(VATTR_COLOR);
|
|
||||||
glDisableVertexAttribArray(VATTR_VERTEX2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
glVertexPointer(3, GL_FLOAT, sizeof(FFlatVertex), &VTO->x);
|
|
||||||
glTexCoordPointer(2, GL_FLOAT, sizeof(FFlatVertex), &VTO->u);
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void set(FFlatVertex *verts, int count)
|
|
||||||
{
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
|
||||||
gl_RenderState.SetVertexBuffer(this);
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, count * sizeof(*verts), verts, GL_STREAM_DRAW);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// OpenGLFrameBuffer :: Wiper Constructor
|
// OpenGLFrameBuffer :: Wiper Constructor
|
||||||
|
@ -323,7 +278,7 @@ public:
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
OpenGLFrameBuffer::Wiper::Wiper()
|
OpenGLFrameBuffer::Wiper::Wiper()
|
||||||
{
|
{
|
||||||
mVertexBuf = new WipeVertexBuffer;
|
mVertexBuf = new FSimpleVertexBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenGLFrameBuffer::Wiper::~Wiper()
|
OpenGLFrameBuffer::Wiper::~Wiper()
|
||||||
|
|
Loading…
Reference in a new issue