*** empty log message ***
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40493
This commit is contained in:
parent
40bb8b5aab
commit
ae337cc4b4
1 changed files with 26 additions and 17 deletions
|
@ -18,8 +18,12 @@
|
||||||
/* The SDL_OPENGLBLIT interface is deprecated.
|
/* The SDL_OPENGLBLIT interface is deprecated.
|
||||||
The code is still available for benchmark purposes though.
|
The code is still available for benchmark purposes though.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static SDL_bool USE_DEPRECATED_OPENGLBLIT = SDL_FALSE;
|
static SDL_bool USE_DEPRECATED_OPENGLBLIT = SDL_FALSE;
|
||||||
|
|
||||||
|
static SDL_Surface *global_image = NULL;
|
||||||
|
static GLuint global_texture = 0;
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
void HotKey_ToggleFullScreen(void)
|
void HotKey_ToggleFullScreen(void)
|
||||||
|
@ -233,9 +237,9 @@ GLuint SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord)
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DrawLogoTexture(void)
|
void DrawLogoTexture(void)
|
||||||
{
|
{
|
||||||
static GLuint texture;
|
|
||||||
static GLfloat texMinX, texMinY;
|
static GLfloat texMinX, texMinY;
|
||||||
static GLfloat texMaxX, texMaxY;
|
static GLfloat texMaxX, texMaxY;
|
||||||
static int x = 0;
|
static int x = 0;
|
||||||
|
@ -247,7 +251,7 @@ void DrawLogoTexture(void)
|
||||||
|
|
||||||
SDL_Surface *screen = SDL_GetVideoSurface();
|
SDL_Surface *screen = SDL_GetVideoSurface();
|
||||||
|
|
||||||
if ( ! texture ) {
|
if ( ! global_texture ) {
|
||||||
SDL_Surface *image;
|
SDL_Surface *image;
|
||||||
GLfloat texcoord[4];
|
GLfloat texcoord[4];
|
||||||
|
|
||||||
|
@ -260,7 +264,7 @@ void DrawLogoTexture(void)
|
||||||
h = image->h;
|
h = image->h;
|
||||||
|
|
||||||
/* Convert the image into an OpenGL texture */
|
/* Convert the image into an OpenGL texture */
|
||||||
texture = SDL_GL_LoadTexture(image, texcoord);
|
global_texture = SDL_GL_LoadTexture(image, texcoord);
|
||||||
|
|
||||||
/* Make texture coordinates easy to understand */
|
/* Make texture coordinates easy to understand */
|
||||||
texMinX = texcoord[0];
|
texMinX = texcoord[0];
|
||||||
|
@ -272,7 +276,7 @@ void DrawLogoTexture(void)
|
||||||
SDL_FreeSurface(image);
|
SDL_FreeSurface(image);
|
||||||
|
|
||||||
/* Make sure that the texture conversion is okay */
|
/* Make sure that the texture conversion is okay */
|
||||||
if ( ! texture ) {
|
if ( ! global_texture ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,7 +303,7 @@ void DrawLogoTexture(void)
|
||||||
|
|
||||||
/* Show the image on the screen */
|
/* Show the image on the screen */
|
||||||
SDL_GL_Enter2DMode();
|
SDL_GL_Enter2DMode();
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
glBindTexture(GL_TEXTURE_2D, global_texture);
|
||||||
glBegin(GL_TRIANGLE_STRIP);
|
glBegin(GL_TRIANGLE_STRIP);
|
||||||
glTexCoord2f(texMinX, texMinY); glVertex2i(x, y );
|
glTexCoord2f(texMinX, texMinY); glVertex2i(x, y );
|
||||||
glTexCoord2f(texMaxX, texMinY); glVertex2i(x+w, y );
|
glTexCoord2f(texMaxX, texMinY); glVertex2i(x+w, y );
|
||||||
|
@ -312,10 +316,6 @@ void DrawLogoTexture(void)
|
||||||
/* This code is deprecated, but available for speed comparisons */
|
/* This code is deprecated, but available for speed comparisons */
|
||||||
void DrawLogoBlit(void)
|
void DrawLogoBlit(void)
|
||||||
{
|
{
|
||||||
static SDL_Surface *image = NULL;
|
|
||||||
static GLuint texture;
|
|
||||||
static GLfloat texMinX, texMinY;
|
|
||||||
static GLfloat texMaxX, texMaxY;
|
|
||||||
static int x = 0;
|
static int x = 0;
|
||||||
static int y = 0;
|
static int y = 0;
|
||||||
static int w, h;
|
static int w, h;
|
||||||
|
@ -326,7 +326,7 @@ void DrawLogoBlit(void)
|
||||||
SDL_Rect dst;
|
SDL_Rect dst;
|
||||||
SDL_Surface *screen = SDL_GetVideoSurface();
|
SDL_Surface *screen = SDL_GetVideoSurface();
|
||||||
|
|
||||||
if ( image == NULL ) {
|
if ( global_image == NULL ) {
|
||||||
SDL_Surface *temp;
|
SDL_Surface *temp;
|
||||||
|
|
||||||
/* Load the image (could use SDL_image library here) */
|
/* Load the image (could use SDL_image library here) */
|
||||||
|
@ -338,7 +338,7 @@ void DrawLogoBlit(void)
|
||||||
h = temp->h;
|
h = temp->h;
|
||||||
|
|
||||||
/* Convert the image into the screen format */
|
/* Convert the image into the screen format */
|
||||||
image = SDL_CreateRGBSurface(
|
global_image = SDL_CreateRGBSurface(
|
||||||
SDL_SWSURFACE,
|
SDL_SWSURFACE,
|
||||||
w, h,
|
w, h,
|
||||||
screen->format->BitsPerPixel,
|
screen->format->BitsPerPixel,
|
||||||
|
@ -346,13 +346,13 @@ void DrawLogoBlit(void)
|
||||||
screen->format->Gmask,
|
screen->format->Gmask,
|
||||||
screen->format->Bmask,
|
screen->format->Bmask,
|
||||||
screen->format->Amask);
|
screen->format->Amask);
|
||||||
if ( image ) {
|
if ( global_image ) {
|
||||||
SDL_BlitSurface(temp, NULL, image, NULL);
|
SDL_BlitSurface(temp, NULL, global_image, NULL);
|
||||||
}
|
}
|
||||||
SDL_FreeSurface(temp);
|
SDL_FreeSurface(temp);
|
||||||
|
|
||||||
/* Make sure that the texture conversion is okay */
|
/* Make sure that the texture conversion is okay */
|
||||||
if ( ! image ) {
|
if ( ! global_image ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ void DrawLogoBlit(void)
|
||||||
dst.y = y;
|
dst.y = y;
|
||||||
dst.w = w;
|
dst.w = w;
|
||||||
dst.h = h;
|
dst.h = h;
|
||||||
SDL_BlitSurface(image, NULL, screen, &dst);
|
SDL_BlitSurface(global_image, NULL, screen, &dst);
|
||||||
|
|
||||||
/* Show the image on the screen */
|
/* Show the image on the screen */
|
||||||
SDL_UpdateRects(screen, 1, &dst);
|
SDL_UpdateRects(screen, 1, &dst);
|
||||||
|
@ -678,6 +678,15 @@ int RunGLTest( int argc, char* argv[],
|
||||||
((float)frames/(this_time-start_time))*1000.0);
|
((float)frames/(this_time-start_time))*1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( global_image ) {
|
||||||
|
SDL_FreeSurface(global_image);
|
||||||
|
global_image = NULL;
|
||||||
|
}
|
||||||
|
if ( global_texture ) {
|
||||||
|
glDeleteTextures( 1, &global_texture );
|
||||||
|
global_texture = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Destroy our GL context, etc. */
|
/* Destroy our GL context, etc. */
|
||||||
SDL_Quit( );
|
SDL_Quit( );
|
||||||
return(0);
|
return(0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue