- overlay = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, texturebpp, rmask, gmask, bmask, amask);
+ texture = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, texturebpp, rmask, gmask, bmask, amask);
+
+ if (texture == NULL)
+ {
+ WriteLog("sdlemu_opengl: Could not create texture surface! (SDL: %s)\n", SDL_GetError());
+ }
+
+ // Setting up OpenGL
+ glDisable(GL_FOG);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_DEPTH_TEST);
+// glDisable(GL_BLEND);
+ glEnable(GL_BLEND);
+ glDisable(GL_NORMALIZE);
+ glDisable(GL_ALPHA_TEST);
+ glEnable(GL_TEXTURE_2D);
+// glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+// glBlendFunc(GL_ONE, GL_SRC_ALPHA);
+//This works, but in a wrong way...
+// glBlendFunc(GL_ONE, GL_ONE);
+
+ // Definitely needed for screen resolution larger then the *src.
+ // This way we can have automatic scaling functionality.
+ glViewport(0, 0, dst->w, dst->h);
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0.0, (GLdouble)dst->w, (GLdouble)dst->h, 0.0, 0.0, 1.0);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();