|
@@ -145,10 +145,9 @@ nk_sdl_device_destroy(void)
|
|
|
NK_API void
|
|
|
nk_sdl_render(enum nk_anti_aliasing AA, int max_vertex_buffer, int max_element_buffer)
|
|
|
{
|
|
|
+
|
|
|
struct nk_sdl_device *dev = &sdl.ogl;
|
|
|
int width, height;
|
|
|
- GLint last_prog, last_tex;
|
|
|
- GLint last_ebo, last_vbo, last_vao;
|
|
|
GLfloat ortho[4][4] = {
|
|
|
{2.0f, 0.0f, 0.0f, 0.0f},
|
|
|
{0.0f,-2.0f, 0.0f, 0.0f},
|
|
@@ -159,13 +158,6 @@ nk_sdl_render(enum nk_anti_aliasing AA, int max_vertex_buffer, int max_element_b
|
|
|
ortho[0][0] /= (GLfloat)width;
|
|
|
ortho[1][1] /= (GLfloat)height;
|
|
|
|
|
|
- /* save previous opengl state */
|
|
|
- glGetIntegerv(GL_CURRENT_PROGRAM, &last_prog);
|
|
|
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_tex);
|
|
|
- glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_vao);
|
|
|
- glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &last_ebo);
|
|
|
- glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vbo);
|
|
|
-
|
|
|
/* setup global state */
|
|
|
glEnable(GL_BLEND);
|
|
|
glBlendEquation(GL_FUNC_ADD);
|
|
@@ -230,12 +222,11 @@ nk_sdl_render(enum nk_anti_aliasing AA, int max_vertex_buffer, int max_element_b
|
|
|
nk_clear(&sdl.ctx);
|
|
|
}
|
|
|
|
|
|
- /* restore old state */
|
|
|
- glUseProgram((GLuint)last_prog);
|
|
|
- glBindTexture(GL_TEXTURE_2D, (GLuint)last_tex);
|
|
|
- glBindBuffer(GL_ARRAY_BUFFER, (GLuint)last_vbo);
|
|
|
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, (GLuint)last_ebo);
|
|
|
- glBindVertexArray((GLuint)last_vao);
|
|
|
+ glUseProgram(0);
|
|
|
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
|
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
|
|
+ glBindVertexArray(0);
|
|
|
+ glDisable(GL_BLEND);
|
|
|
glDisable(GL_SCISSOR_TEST);
|
|
|
}
|
|
|
|