# HG changeset patch # User reimar # Date 1317159766 0 # Node ID a70e8abec08934a7f789e0e709e2620c3bd5f9c4 # Parent 77c1b5736020e5810f050d358da92c1814fdf71b Change silly matrixview code to not needlessly change state on every frame (in addition to it making the code confusing this is a sure way to make OpenGL code really slow). diff -r 77c1b5736020 -r a70e8abec089 libvo/matrixview.c --- a/libvo/matrixview.c Tue Sep 27 16:39:36 2011 +0000 +++ b/libvo/matrixview.c Tue Sep 27 21:42:46 2011 +0000 @@ -297,6 +297,13 @@ // Allow adjusting of texture color via glColor mpglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + mpglEnable(GL_BLEND); + mpglEnable(GL_TEXTURE_2D); + + mpglDisable(GL_LIGHTING); + mpglBlendFunc(GL_SRC_ALPHA, GL_ONE); + mpglDisable(GL_DEPTH_TEST); + matrixview_reshape(w, h); } @@ -310,23 +317,14 @@ mpglFrustum(-_text_x, _text_x, -_text_y, _text_y, -Z_Off - Z_Depth, -Z_Off); mpglMatrixMode(GL_MODELVIEW); + mpglLoadIdentity(); + mpglTranslated(0.0f, 0.0f, Z_Off); } void matrixview_draw(int w, int h, double currentTime, float frameTime, uint8_t *data) { - mpglEnable(GL_BLEND); - mpglEnable(GL_TEXTURE_2D); - - mpglDisable(GL_LIGHTING); - mpglBlendFunc(GL_SRC_ALPHA, GL_ONE); - mpglDisable(GL_DEPTH_TEST); - - mpglMatrixMode(GL_MODELVIEW); - mpglLoadIdentity(); - mpglTranslated(0.0f, 0.0f, Z_Off); - // Clear the color and depth buffers. mpglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -342,9 +340,6 @@ mpglBindTexture(GL_TEXTURE_2D, 0); make_change(currentTime); - - mpglLoadIdentity(); - mpglMatrixMode(GL_PROJECTION); } void matrixview_contrast_set(float contrast)