more opengles changes
authorMatthias Braun <matze@braunis.de>
Sun, 18 May 2008 14:26:06 +0000 (14:26 +0000)
committerMatthias Braun <matze@braunis.de>
Sun, 18 May 2008 14:26:06 +0000 (14:26 +0000)
SVN-Revision: 5493

src/video/gl_lightmap.cpp
src/video/texture_manager.cpp

index 7db0c2b..f37b540 100644 (file)
@@ -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);
   }
index a1b7ecb..4bdece7 100644 (file)
@@ -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<SavedTexture>::iterator i = saved_textures.begin();