aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/opengl/texture.cpp
diff options
context:
space:
mode:
authorKamil Zbrog2014-03-29 22:13:07 +0100
committerKamil Zbrog2014-03-29 22:13:07 +0100
commit5ffa58dba7a941249af9ca8c1bd229c310fb296b (patch)
tree49faae8eb3424c32d890b4d3cd1eefeb11fc3cd9 /backends/graphics/opengl/texture.cpp
parent8eac80cfc59c34299899ebe18a3b0582ef76e0d2 (diff)
parent620411bfebe72fb0f60c4d8f64558be088cff58d (diff)
downloadscummvm-rg350-5ffa58dba7a941249af9ca8c1bd229c310fb296b.tar.gz
scummvm-rg350-5ffa58dba7a941249af9ca8c1bd229c310fb296b.tar.bz2
scummvm-rg350-5ffa58dba7a941249af9ca8c1bd229c310fb296b.zip
Merge remote-tracking branch 'sync/master' into prince-malik
Diffstat (limited to 'backends/graphics/opengl/texture.cpp')
-rw-r--r--backends/graphics/opengl/texture.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/backends/graphics/opengl/texture.cpp b/backends/graphics/opengl/texture.cpp
index 8f17ed7eeb..7b0b22d630 100644
--- a/backends/graphics/opengl/texture.cpp
+++ b/backends/graphics/opengl/texture.cpp
@@ -65,6 +65,9 @@ void Texture::releaseInternalTexture() {
}
void Texture::recreateInternalTexture() {
+ // Release old texture name in case it exists.
+ releaseInternalTexture();
+
// Get a new texture name.
GLCALL(glGenTextures(1, &_glTexture));
@@ -163,7 +166,7 @@ void Texture::fill(uint32 color) {
flagDirty();
}
-void Texture::draw(GLuint x, GLuint y, GLuint w, GLuint h) {
+void Texture::draw(GLfloat x, GLfloat y, GLfloat w, GLfloat h) {
// Only do any processing when the Texture is initialized.
if (!_textureData.getPixels()) {
return;
@@ -187,13 +190,13 @@ void Texture::draw(GLuint x, GLuint y, GLuint w, GLuint h) {
GLCALL(glTexCoordPointer(2, GL_FLOAT, 0, texcoords));
// Calculate the screen rect where the texture will be drawn.
- const GLshort vertices[4*2] = {
- (GLshort)x, (GLshort)y,
- (GLshort)(x + w), (GLshort)y,
- (GLshort)x, (GLshort)(y + h),
- (GLshort)(x + w), (GLshort)(y + h)
+ const GLfloat vertices[4*2] = {
+ x, y,
+ x + w, y,
+ x, y + h,
+ x + w, y + h
};
- GLCALL(glVertexPointer(2, GL_SHORT, 0, vertices));
+ GLCALL(glVertexPointer(2, GL_FLOAT, 0, vertices));
// Draw the texture to the screen buffer.
GLCALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4));