diff options
author | Alejandro Marzini | 2010-07-16 04:45:47 +0000 |
---|---|---|
committer | Alejandro Marzini | 2010-07-16 04:45:47 +0000 |
commit | cfe85d6b9f1201a6ad3a88f9e97e58af92047264 (patch) | |
tree | 3de84a911e1b7a089046577029be13c8c7fb319a /backends/graphics/opengl/gltexture.cpp | |
parent | fc8b60abda3090e01f3f147f7307bbede1e7de06 (diff) | |
download | scummvm-rg350-cfe85d6b9f1201a6ad3a88f9e97e58af92047264.tar.gz scummvm-rg350-cfe85d6b9f1201a6ad3a88f9e97e58af92047264.tar.bz2 scummvm-rg350-cfe85d6b9f1201a6ad3a88f9e97e58af92047264.zip |
Added basic screen drawing (only overlay working).
svn-id: r50930
Diffstat (limited to 'backends/graphics/opengl/gltexture.cpp')
-rw-r--r-- | backends/graphics/opengl/gltexture.cpp | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/backends/graphics/opengl/gltexture.cpp b/backends/graphics/opengl/gltexture.cpp index d609dd612f..eada261ca2 100644 --- a/backends/graphics/opengl/gltexture.cpp +++ b/backends/graphics/opengl/gltexture.cpp @@ -78,7 +78,8 @@ GLTexture::GLTexture(byte bpp, GLenum format, GLenum type) _textureWidth(0), _textureHeight(0) { - refresh(); + // Generates the texture ID for GL + CHECK_GL_ERROR( glGenTextures(1, &_textureName) ); // This all gets reset later in allocBuffer: _surface.w = 0; @@ -108,12 +109,6 @@ void GLTexture::allocBuffer(GLuint w, GLuint h) { // Already allocated a sufficiently large buffer return; - nextHigher2(0); - nextHigher2(100); - nextHigher2(1025); - nextHigher2(9999); - - if (npot_supported) { _textureWidth = w; _textureHeight = h; @@ -160,7 +155,7 @@ void GLTexture::updateBuffer(const void *buf, int pitch, GLuint x, GLuint y, GLu void GLTexture::fillBuffer(byte x) { byte* tmpbuf = new byte[_surface.h * _surface.w * _bytesPerPixel]; - memset(tmpbuf, 0, _surface.h * _surface.w * _bytesPerPixel); + memset(tmpbuf, x, _surface.h * _surface.w * _bytesPerPixel); CHECK_GL_ERROR( glBindTexture(GL_TEXTURE_2D, _textureName) ); CHECK_GL_ERROR( glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _surface.w, _surface.h, _glFormat, _glType, tmpbuf) ); @@ -170,13 +165,13 @@ void GLTexture::fillBuffer(byte x) { void GLTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) { CHECK_GL_ERROR( glBindTexture(GL_TEXTURE_2D, _textureName) ); - const GLint tex_width = xdiv(_surface.w, _textureWidth); - const GLint tex_height = xdiv(_surface.h, _textureHeight); + const GLint texWidth = 1;//xdiv(_surface.w, _textureWidth); + const GLint texHeight = 1;//xdiv(_surface.h, _textureHeight); const GLint texcoords[] = { 0, 0, - tex_width, 0, - 0, tex_height, - tex_width, tex_height, + texWidth, 0, + 0, texHeight, + texWidth, texHeight, }; CHECK_GL_ERROR( glTexCoordPointer(2, GL_INT, 0, texcoords) ); @@ -188,8 +183,7 @@ void GLTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) { }; CHECK_GL_ERROR( glVertexPointer(2, GL_SHORT, 0, vertices) ); - assert(ARRAYSIZE(vertices) == ARRAYSIZE(texcoords)); - CHECK_GL_ERROR( glDrawArrays(GL_TRIANGLE_STRIP, 0, ARRAYSIZE(vertices) / 2) ); + CHECK_GL_ERROR( glDrawArrays(GL_TRIANGLE_STRIP, 0, 4) ); } #endif |