summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/glwrapper-ogl.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2010-07-28 20:13:58 +0200
committerAdam Borowski <kilobyte@angband.pl>2010-07-28 20:54:38 +0200
commitc5ef8a7d05ab323adbe740056e9d3d3d235a3038 (patch)
tree13a4894b7c9041d69978e606b3ce18f444a01df1 /crawl-ref/source/glwrapper-ogl.cc
parent000de2017e1c676cc8266efb2b5827bcb0a22790 (diff)
downloadcrawl-ref-c5ef8a7d05ab323adbe740056e9d3d3d235a3038.tar.gz
crawl-ref-c5ef8a7d05ab323adbe740056e9d3d3d235a3038.zip
OpenGLES porting, part 1.
Diffstat (limited to 'crawl-ref/source/glwrapper-ogl.cc')
-rw-r--r--crawl-ref/source/glwrapper-ogl.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/crawl-ref/source/glwrapper-ogl.cc b/crawl-ref/source/glwrapper-ogl.cc
index 6b8a4a9cec..7e5f9f987c 100644
--- a/crawl-ref/source/glwrapper-ogl.cc
+++ b/crawl-ref/source/glwrapper-ogl.cc
@@ -9,8 +9,14 @@
// If other UI types use the -ogl wrapper they should
// include more conditional includes here.
#ifdef USE_SDL
+#ifdef USE_GLES
+#include <SDL.h>
+#include <SDL_gles.h>
+#include <GLES/gl.h>
+#else
#include <SDL_opengl.h>
#endif
+#endif
#include "debug.h"
@@ -83,7 +89,7 @@ void OGLStateManager::set(const GLState& state)
// [enne] This should *not* be necessary, but the Linux OpenGL
// driver that I'm using sets this to the last colour of the
// colour array. So, we need to unset it here.
- glColor3f(1.0f, 1.0f, 1.0f);
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
}
@@ -145,7 +151,7 @@ void OGLStateManager::reset_view_for_resize(const coord_def &m_windowsz)
glLoadIdentity();
// For ease, vertex positions are pixel positions.
- glOrtho(0, m_windowsz.x, m_windowsz.y, 0, -1000, 1000);
+ glOrthox(0, m_windowsz.x, m_windowsz.y, 0, -1000, 1000);
}
void OGLStateManager::reset_transform()
@@ -185,9 +191,14 @@ void OGLStateManager::load_texture(unsigned char *pixels, unsigned int width,
// Also assume that the texture is already bound using bind_texture
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+#ifdef GL_CLAMP
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
-
+#else
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+#endif
+#ifndef USE_GLES
if (mip_opt == MIPMAP_CREATE)
{
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
@@ -197,6 +208,7 @@ void OGLStateManager::load_texture(unsigned char *pixels, unsigned int width,
texture_format, format, pixels);
}
else
+#endif
{
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);