From 7658744c44d5c11c9282a8cce00b896652307250 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 17 Nov 2012 13:24:47 +0000 Subject: [PATCH] =?UTF-8?q?gpu:=20remove=20some=20crap=20from=20vertexbuff?= =?UTF-8?q?er.cpp=20and=20allow=20for=20empty=20vertex=20declarations=20ev?= =?UTF-8?q?en=20though=20many=20video=20card=20drivers=20do=20not=20suppor?= =?UTF-8?q?t=20them=20=E2=80=94=20and=20they=20should.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gpu/vertexbuffer.cpp | 22 ++-------------------- src/gpu/vertexbuffer.h | 2 +- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/gpu/vertexbuffer.cpp b/src/gpu/vertexbuffer.cpp index 8901d2c3..9ebdaf56 100644 --- a/src/gpu/vertexbuffer.cpp +++ b/src/gpu/vertexbuffer.cpp @@ -156,13 +156,9 @@ void VertexDeclaration::DrawElements(MeshPrimitive type, int skip, int count) break; } #else + /* FIXME: this has nothing to do here! */ glFrontFace(GL_CCW); glEnable(GL_CULL_FACE); -# if defined HAVE_GL_2X && !defined __APPLE__ - /* FIXME: this has nothing to do here! */ - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_GEQUAL, 0.01f); -# endif glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -181,10 +177,6 @@ void VertexDeclaration::DrawElements(MeshPrimitive type, int skip, int count) glDrawArrays(GL_POINTS, skip, count); break; } -# if defined HAVE_GL_2X && !defined __APPLE__ - /* FIXME: this has nothing to do here! */ - glDisable(GL_ALPHA_TEST); -# endif #endif } @@ -228,13 +220,9 @@ void VertexDeclaration::DrawIndexedElements(MeshPrimitive type, int vbase, break; } #else + /* FIXME: this has nothing to do here! */ glFrontFace(GL_CCW); glEnable(GL_CULL_FACE); -# if defined HAVE_GL_2X && !defined __APPLE__ - /* FIXME: this has nothing to do here! */ - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_GEQUAL, 0.01f); -# endif glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -261,10 +249,6 @@ void VertexDeclaration::DrawIndexedElements(MeshPrimitive type, int vbase, glDrawElements(GL_POINTS, count, GL_UNSIGNED_SHORT, 0); break; } -# if defined HAVE_GL_2X && !defined __APPLE__ - /* FIXME: this has nothing to do here! */ - glDisable(GL_ALPHA_TEST); -# endif #endif } @@ -294,8 +278,6 @@ void VertexDeclaration::Unbind() } } glBindBuffer(GL_ARRAY_BUFFER, 0); - /* FIXME: only useful for VAOs? */ - //glBindBuffer(GL_ARRAY_BUFFER, 0); #else /* Or even: */ glDisableClientState(GL_VERTEX_ARRAY); diff --git a/src/gpu/vertexbuffer.h b/src/gpu/vertexbuffer.h index dfe01266..62d77735 100644 --- a/src/gpu/vertexbuffer.h +++ b/src/gpu/vertexbuffer.h @@ -171,7 +171,7 @@ public: class VertexDeclaration { public: - VertexDeclaration(VertexStreamBase const &s1, + VertexDeclaration(VertexStreamBase const &s1 = VertexStreamBase::Empty, VertexStreamBase const &s2 = VertexStreamBase::Empty, VertexStreamBase const &s3 = VertexStreamBase::Empty, VertexStreamBase const &s4 = VertexStreamBase::Empty,