Fixed video output on OpenGL ES 1.1

- call SDL_GLES_SwapBuffers() after glDrawArrays()
 - do not call glViewport() and glMatrixMode(GL_PROJECTION)
This commit is contained in:
Pali Rohár 2010-06-24 13:08:04 +02:00
parent 8192ffb6f6
commit 2b2b7e06d0
5 changed files with 13 additions and 4 deletions

View file

@ -117,7 +117,7 @@ AC_ARG_ENABLE(debug,
if test "$enable_debug" != "yes" -a "$enable_profile" != "yes"; then
CXXFLAGS="$CXXFLAGS -O2 -pipe -fsigned-char -fomit-frame-pointer -fexpensive-optimizations -ffast-math"
else
CXXFLAGS="$CXXFLAGS -O0 -g -fsigned-char -Wsign-compare -Werror -Wall"
CXXFLAGS="$CXXFLAGS -O0 -g -fsigned-char -Wsign-compare -Wall"
CPPFLAGS="$CPPFLAGS -DDEBUG"
fi

View file

@ -656,6 +656,7 @@ void CMinimap::Draw(int vx, int vy)
glTexCoordPointer(2, GL_FLOAT, 0, texCoord);
glVertexPointer(2, GL_FLOAT, 0, vertex);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
SDL_GLES_SwapBuffers();
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

View file

@ -998,6 +998,7 @@ void DrawPixel(Uint32 color, int x, int y)
glVertexPointer(2, GL_FLOAT, 0, vertex);
glDrawArrays(GL_POINTS, 0, 1);
SDL_GLES_SwapBuffers();
glDisableClientState(GL_VERTEX_ARRAY);
#else
@ -1084,6 +1085,7 @@ void DrawHLine(Uint32 color, int x, int y, int width)
glVertexPointer(2, GL_FLOAT, 0, vertex);
glDrawArrays(GL_LINES, 0, 2);
SDL_GLES_SwapBuffers();
glDisableClientState(GL_VERTEX_ARRAY);
#else
@ -1188,6 +1190,7 @@ void DrawVLine(Uint32 color, int x, int y, int height)
glVertexPointer(2, GL_FLOAT, 0, vertex);
glDrawArrays(GL_LINES, 0, 2);
SDL_GLES_SwapBuffers();
glDisableClientState(GL_VERTEX_ARRAY);
#else
@ -1310,6 +1313,7 @@ void DrawLine(Uint32 color, int x1, int y1, int x2, int y2)
glVertexPointer(2, GL_FLOAT, 0, vertex);
glDrawArrays(GL_LINES, 0, 2);
SDL_GLES_SwapBuffers();
glDisableClientState(GL_VERTEX_ARRAY);
#else
@ -1485,6 +1489,7 @@ void DrawRectangle(Uint32 color, int x, int y, int w, int h)
glVertexPointer(2, GL_FLOAT, 0, vertex);
glDrawArrays(GL_LINES, 0, 8);
SDL_GLES_SwapBuffers();
glDisableClientState(GL_VERTEX_ARRAY);
#else
@ -1659,6 +1664,7 @@ void FillRectangle(Uint32 color, int x, int y,
glVertexPointer(2, GL_FLOAT, 0, vertex);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
SDL_GLES_SwapBuffers();
glDisableClientState(GL_VERTEX_ARRAY);
#else

View file

@ -244,14 +244,15 @@ static void InitOpenGLExtensions()
*/
static void InitOpenGL(void)
{
InitOpenGLExtensions();
glViewport(0, 0, (GLsizei)Video.Width, (GLsizei)Video.Height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef USE_GLES
glOrthof(0, Video.Width, Video.Height, 0, -1, 1);
#else
glViewport(0, 0, (GLsizei)Video.Width, (GLsizei)Video.Height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, Video.Width, Video.Height, 0, -1, 1);
#endif
glMatrixMode(GL_MODELVIEW);

View file

@ -160,6 +160,7 @@ void DrawTexture(const CGraphic *g, GLuint *textures, int sx, int sy,
glTexCoordPointer(2, GL_FLOAT, 0, texCoord);
glVertexPointer(2, GL_FLOAT, 0, vertex);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
SDL_GLES_SwapBuffers();
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);