Browse Source

gpu: remove some crap from vertexbuffer.cpp and allow for

empty vertex declarations even though many video card
drivers do not support them — and they should.
legacy
Sam Hocevar sam 12 years ago
parent
commit
7658744c44
2 changed files with 3 additions and 21 deletions
  1. +2
    -20
      src/gpu/vertexbuffer.cpp
  2. +1
    -1
      src/gpu/vertexbuffer.h

+ 2
- 20
src/gpu/vertexbuffer.cpp View File

@@ -156,13 +156,9 @@ void VertexDeclaration::DrawElements(MeshPrimitive type, int skip, int count)
break; break;
} }
#else #else
/* FIXME: this has nothing to do here! */
glFrontFace(GL_CCW); glFrontFace(GL_CCW);
glEnable(GL_CULL_FACE); 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); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 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); glDrawArrays(GL_POINTS, skip, count);
break; break;
} }
# if defined HAVE_GL_2X && !defined __APPLE__
/* FIXME: this has nothing to do here! */
glDisable(GL_ALPHA_TEST);
# endif
#endif #endif
} }


@@ -228,13 +220,9 @@ void VertexDeclaration::DrawIndexedElements(MeshPrimitive type, int vbase,
break; break;
} }
#else #else
/* FIXME: this has nothing to do here! */
glFrontFace(GL_CCW); glFrontFace(GL_CCW);
glEnable(GL_CULL_FACE); 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); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 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); glDrawElements(GL_POINTS, count, GL_UNSIGNED_SHORT, 0);
break; break;
} }
# if defined HAVE_GL_2X && !defined __APPLE__
/* FIXME: this has nothing to do here! */
glDisable(GL_ALPHA_TEST);
# endif
#endif #endif
} }


@@ -294,8 +278,6 @@ void VertexDeclaration::Unbind()
} }
} }
glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0);
/* FIXME: only useful for VAOs? */
//glBindBuffer(GL_ARRAY_BUFFER, 0);
#else #else
/* Or even: */ /* Or even: */
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);


+ 1
- 1
src/gpu/vertexbuffer.h View File

@@ -171,7 +171,7 @@ public:
class VertexDeclaration class VertexDeclaration
{ {
public: public:
VertexDeclaration(VertexStreamBase const &s1,
VertexDeclaration(VertexStreamBase const &s1 = VertexStreamBase::Empty,
VertexStreamBase const &s2 = VertexStreamBase::Empty, VertexStreamBase const &s2 = VertexStreamBase::Empty,
VertexStreamBase const &s3 = VertexStreamBase::Empty, VertexStreamBase const &s3 = VertexStreamBase::Empty,
VertexStreamBase const &s4 = VertexStreamBase::Empty, VertexStreamBase const &s4 = VertexStreamBase::Empty,


Loading…
Cancel
Save