Просмотр исходного кода

gpu: better state restoration after vertex buffer usage.

legacy
Sam Hocevar sam 12 лет назад
Родитель
Сommit
18d22e1fc5
1 измененных файлов: 11 добавлений и 0 удалений
  1. +11
    -0
      src/gpu/vertexbuffer.cpp

+ 11
- 0
src/gpu/vertexbuffer.cpp Просмотреть файл

@@ -147,6 +147,7 @@ void VertexDeclaration::DrawElements(MeshPrimitive type, int skip, int count)
glFrontFace(GL_CCW); glFrontFace(GL_CCW);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
# if defined HAVE_GL_2X && !defined __APPLE__ # if defined HAVE_GL_2X && !defined __APPLE__
/* FIXME: this has nothing to do here! */
glEnable(GL_ALPHA_TEST); glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GEQUAL, 0.01f); glAlphaFunc(GL_GEQUAL, 0.01f);
# endif # endif
@@ -162,6 +163,10 @@ 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
} }


@@ -190,6 +195,7 @@ void VertexDeclaration::DrawIndexedElements(MeshPrimitive type, int vbase,
} }
#else #else
# if defined HAVE_GL_2X && !defined __APPLE__ # if defined HAVE_GL_2X && !defined __APPLE__
/* FIXME: this has nothing to do here! */
glEnable(GL_ALPHA_TEST); glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GEQUAL, 0.01f); glAlphaFunc(GL_GEQUAL, 0.01f);
# endif # endif
@@ -207,6 +213,10 @@ 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
} }


@@ -229,6 +239,7 @@ void VertexDeclaration::Unbind()
/* FIXME: temporary kludge */ /* FIXME: temporary kludge */
for (int i = 0; i < 12; i++) for (int i = 0; i < 12; i++)
glDisableVertexAttribArray(i); glDisableVertexAttribArray(i);
glBindBuffer(GL_ARRAY_BUFFER, 0);
/* FIXME: only useful for VAOs */ /* FIXME: only useful for VAOs */
//glBindBuffer(GL_ARRAY_BUFFER, 0); //glBindBuffer(GL_ARRAY_BUFFER, 0);
/* Or: */ /* Or: */


Загрузка…
Отмена
Сохранить