From 370a96bee0d32e27c4be9d029dd156450f9801f7 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sun, 18 May 2008 14:26:06 +0000 Subject: [PATCH] more opengles changes SVN-Revision: 5493 --- src/video/gl_lightmap.cpp | 27 +++++++++++++++------------ src/video/texture_manager.cpp | 3 +++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/video/gl_lightmap.cpp b/src/video/gl_lightmap.cpp index 7db0c2ba1..f37b540bd 100644 --- a/src/video/gl_lightmap.cpp +++ b/src/video/gl_lightmap.cpp @@ -196,21 +196,24 @@ namespace GL glBlendFunc(GL_DST_COLOR, GL_ZERO); glBindTexture(GL_TEXTURE_2D, texture->get_handle()); - glBegin(GL_QUADS); - glTexCoord2f(0, lightmap_uv_bottom); - glVertex2f(0, 0); - - glTexCoord2f(lightmap_uv_right, lightmap_uv_bottom); - glVertex2f(SCREEN_WIDTH, 0); - - glTexCoord2f(lightmap_uv_right, 0); - glVertex2f(SCREEN_WIDTH, SCREEN_HEIGHT); + float vertices[] = { + 0, 0, + SCREEN_WIDTH, 0, + SCREEN_WIDTH, SCREEN_HEIGHT, + 0, SCREEN_HEIGHT + }; + glVertexPointer(2, GL_FLOAT, 0, vertices); - glTexCoord2f(0, 0); - glVertex2f(0, SCREEN_HEIGHT); + float uvs[] = { + 0, lightmap_uv_bottom, + lightmap_uv_right, lightmap_uv_bottom, + lightmap_uv_right, 0, + 0, 0 + }; + glTexCoordPointer(2, GL_FLOAT, 0, uvs); - glEnd(); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } diff --git a/src/video/texture_manager.cpp b/src/video/texture_manager.cpp index a1b7ecb0b..4bdece75a 100644 --- a/src/video/texture_manager.cpp +++ b/src/video/texture_manager.cpp @@ -177,11 +177,14 @@ TextureManager::save_texture(GL::Texture* texture) void TextureManager::reload_textures() { +#ifdef GL_UNPACK_ROW_LENGTH + /* OpenGL ES doesn't support these */ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0); glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); glPixelStorei(GL_UNPACK_SKIP_IMAGES, 0); +#endif glPixelStorei(GL_UNPACK_ALIGNMENT, 1); for(std::vector::iterator i = saved_textures.begin(); -- 2.11.0