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);
}
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();