[Scummvm-cvs-logs] SF.net SVN: scummvm:[50979] scummvm/branches/gsoc2010-opengl/backends/ graphics/opengl
vgvgf at users.sourceforge.net
vgvgf at users.sourceforge.net
Sun Jul 18 07:32:45 CEST 2010
Revision: 50979
http://scummvm.svn.sourceforge.net/scummvm/?rev=50979&view=rev
Author: vgvgf
Date: 2010-07-18 05:32:44 +0000 (Sun, 18 Jul 2010)
Log Message:
-----------
Fixed rect size when drawing npot textures. Added OpenGL attr for SDL.
Modified Paths:
--------------
scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.cpp
scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp
Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.cpp 2010-07-18 04:56:16 UTC (rev 50978)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/gltexture.cpp 2010-07-18 05:32:44 UTC (rev 50979)
@@ -36,10 +36,10 @@
// Supported GL extensions
static bool npot_supported = false;
-static inline GLint xdiv(int numerator, int denominator) {
+/*static inline GLint xdiv(int numerator, int denominator) {
assert(numerator < (1 << 16));
return (numerator << 16) / denominator;
-}
+}*/
static GLuint nextHigher2(GLuint v) {
if (v == 0)
@@ -61,6 +61,7 @@
const char* ext_string =
reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
+ CHECK_GL_ERROR(0);
Common::StringTokenizer tokenizer(ext_string, " ");
while (!tokenizer.empty()) {
Common::String token = tokenizer.nextToken();
@@ -128,8 +129,7 @@
CHECK_GL_ERROR( glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) );
CHECK_GL_ERROR( glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) );
CHECK_GL_ERROR( glTexImage2D(GL_TEXTURE_2D, 0, _glFormat,
- _textureWidth, _textureHeight,
- 0, _glFormat, _glType, NULL) );
+ _textureWidth, _textureHeight, 0, _glFormat, _glType, NULL) );
}
void GLTexture::updateBuffer(const void *buf, int pitch, GLuint x, GLuint y, GLuint w, GLuint h) {
@@ -165,15 +165,15 @@
void GLTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) {
CHECK_GL_ERROR( glBindTexture(GL_TEXTURE_2D, _textureName) );
- const GLint texWidth = 1;//xdiv(_surface.w, _textureWidth);
- const GLint texHeight = 1;//xdiv(_surface.h, _textureHeight);
- const GLint texcoords[] = {
+ const GLfloat texWidth = (GLfloat)_surface.w / _textureWidth;//xdiv(_surface.w, _textureWidth);
+ const GLfloat texHeight = (GLfloat)_surface.h / _textureHeight;//xdiv(_surface.h, _textureHeight);
+ const GLfloat texcoords[] = {
0, 0,
texWidth, 0,
0, texHeight,
texWidth, texHeight,
};
- CHECK_GL_ERROR( glTexCoordPointer(2, GL_INT, 0, texcoords) );
+ CHECK_GL_ERROR( glTexCoordPointer(2, GL_FLOAT, 0, texcoords) );
const GLshort vertices[] = {
x, y,
Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp 2010-07-18 04:56:16 UTC (rev 50978)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp 2010-07-18 05:32:44 UTC (rev 50979)
@@ -127,6 +127,13 @@
_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
_videoMode.hardwareHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
+ // Setup OpenGL attributes for SDL
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+
_hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 32,
_videoMode.fullscreen ? (SDL_FULLSCREEN | SDL_OPENGL) : SDL_OPENGL
);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list