Am I the only one having issues with WindowsXP & OpenGL & SDL 1.2.4?

Hopefully someone else is having the same problem as me? If I run fullscreen with SDL and OpenGL my quicklaunch, system tray icons mess up. The tooltip box don’t match up with the icons program name? If I run in a window mode everything is fine. I have a AthlonXP 1800+, Radeon 8500 card, 768MB, MSI K7T Pro 2RU MB. I am running Windows XP Prof. I never had these problems with my Win2K system. I hope this issue can be fixed soon, I don’t want to stop using SDL due to me switching back to a Mac in the next few months. I want to be able to code on the PC till then and want my code portable. I do not want to use Direct X. I am wondering if OpenGL is the problem? Is it Windows XP? I just need some answers before I go nuts!!! Here is my code for someone to look at and see if their is something wrong. Thanks.

//includes header
#include “includes.h”

//globals
int game_state = 0;
Sprite *jet = new Sprite();

ofstream fout(“error.txt”);

//consts
const int width = 1024;
const int height = 768;
const int bits = 32;

//() prototypes
void Render(void);
void Update(void);
bool LoadTextures(void);
bool InitGame(void);
bool InitSDL(int width, int height, int bits);
bool InitOpenGL(int width, int height);
void Quit(void);
void FreeMemory(void);
void GetEvents(void);

//main(void)
int main(int argc, char *argv[])
{
if(InitSDL(width, height, bits) != true)
Quit();

if(InitOpenGL(width, height) != true)
Quit();

if(LoadTextures() != true)
Quit();

if(InitGame() != true)
Quit();

while(game_state == 0)
{
Render();
GetEvents();
}

Quit();

return 0;
}

void Render(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

jet->Draw();

SDL_GL_SwapBuffers();
}

void Update(void)
{
}

bool LoadTextures(void)
{
return true;
}

bool InitGame(void)
{
return true;
}

bool InitSDL(int width, int height, int bits)
{
if(SDL_Init(SDL_INIT_EVERYTHING) != 0)
{
fout << “Error on Initialization of SDL\n”;
Quit();
}

if(SDL_SetVideoMode(width, height, bits, SDL_FULLSCREEN | SDL_OPENGL) == NULL)
{
fout << “Error on Initialization of OpenGL\n”;
Quit();
}

return true;
}

bool InitOpenGL(int width, int height)
{
glViewport(0, 0, width, height);

glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glShadeModel(GL_SMOOTH);
glClearDepth(1.0f);

glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
glFrontFace(GL_CCW);

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthFunc(GL_LEQUAL);

glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);

glMatrixMode(GL_PROJECTION);

glLoadIdentity();

glOrtho(0.0, double(width), 0.0, double(height), -100.0, 100.0);

glMatrixMode(GL_MODELVIEW);

return true;
}

void Quit(void)
{
FreeMemory();
SDL_Quit();
fout.close();
}

void FreeMemory(void)
{
delete jet;
}

void GetEvents(void)
{
SDL_Event event;

while(SDL_PollEvent(&event))
{
    switch(event.type)
    {
        case SDL_KEYDOWN:
            switch(event.key.keysym.sym)
            {
                case SDLK_ESCAPE:
                    game_state = 1;
                    break;
 
 default:
                    break;
            }
            break;

case SDL_MOUSEBUTTONDOWN:
break;

case SDL_MOUSEMOTION:
default:
break;
}
}
}

Hi,

when I run “testgl -fullscreen” from a DOS box on win98 I get a
"window button" left hanging around on the task-bar. If I run the
program again I get another one! Not very nice …

This may be related to your problem.
I found that this fixes it for directx:

File: src\video\windx5\SDL_dx5video.c
Line: 2211 (approximately!)

void DX5_VideoQuit(_THIS)
{
int i, j;

/* If we’re fullscreen GL, we need to reset the display */
if ( this->screen != NULL ) {
if ( (this->screen->flags & (SDL_OPENGL|SDL_FULLSCREEN)) ==
(SDL_OPENGL|SDL_FULLSCREEN) ) {

ChangeDisplaySettings(NULL, 0);
ShowWindow( SDL_Window, SW_HIDE ); /<------ add this line/
}

}

and for the windib version:

File: src\video\windib\SDL_dibvideo.c
Line: 892 (approximately!)

void DIB_VideoQuit(_THIS)
{
/* Destroy the window and everything associated with it /
if ( SDL_Window ) {
/
Delete the screen bitmap (also frees screen->pixels) /
if ( this->screen ) {
#ifndef NO_CHANGEDISPLAYSETTINGS
if ( this->screen->flags & SDL_FULLSCREEN ) {
ChangeDisplaySettings(NULL, 0);
ShowWindow( SDL_Window, SW_HIDE ); /
<------ add this line*/
}

}

Of course, this is just a work-around :slight_smile:

cheers,
John.> ----- Original Message -----

From: mars_999@mac.com (Mars_999)
To:
Sent: Wednesday, May 01, 2002 6:17 AM
Subject: [SDL] Am I the only one having issues with WindowsXP & OpenGL & SDL
1.2.4???

Hopefully someone else is having the same problem as me? If I run fullscreen
with SDL and OpenGL my quicklaunch, system tray icons mess up. The tooltip
box don’t match up with the icons program name? If I run in a window mode
everything is fine. I have a AthlonXP 1800+, Radeon 8500 card, 768MB, MSI
K7T Pro 2RU MB. I am running Windows XP Prof. I never had these problems
with my Win2K system. I hope this issue can be fixed soon, I don’t want to
stop using SDL due to me switching back to a Mac in the next few months. I w
ant to be able to code on the PC till then and want my code portable. I do
not want to use Direct X. I am wondering if OpenGL is the problem? Is it
Windows XP? I just need some answers before I go nuts!!! Here is my code for
someone to look at and see if their is something wrong. Thanks.

//includes header
#include “includes.h”

//globals
int game_state = 0;
Sprite *jet = new Sprite();

ofstream fout(“error.txt”);

//consts
const int width = 1024;
const int height = 768;
const int bits = 32;

//() prototypes
void Render(void);
void Update(void);
bool LoadTextures(void);
bool InitGame(void);
bool InitSDL(int width, int height, int bits);
bool InitOpenGL(int width, int height);
void Quit(void);
void FreeMemory(void);
void GetEvents(void);

//main(void)
int main(int argc, char *argv[])
{
if(InitSDL(width, height, bits) != true)
Quit();

if(InitOpenGL(width, height) != true)
Quit();

if(LoadTextures() != true)
Quit();

if(InitGame() != true)
Quit();

while(game_state == 0)
{
Render();
GetEvents();
}

Quit();

return 0;
}

void Render(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

jet->Draw();

SDL_GL_SwapBuffers();
}

void Update(void)
{
}

bool LoadTextures(void)
{
return true;
}

bool InitGame(void)
{
return true;
}

bool InitSDL(int width, int height, int bits)
{
if(SDL_Init(SDL_INIT_EVERYTHING) != 0)
{
fout << “Error on Initialization of SDL\n”;
Quit();
}

if(SDL_SetVideoMode(width, height, bits, SDL_FULLSCREEN | SDL_OPENGL) ==
NULL)
{
fout << “Error on Initialization of OpenGL\n”;
Quit();
}

return true;
}

bool InitOpenGL(int width, int height)
{
glViewport(0, 0, width, height);

glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glShadeModel(GL_SMOOTH);
glClearDepth(1.0f);

glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
glFrontFace(GL_CCW);

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthFunc(GL_LEQUAL);

glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);

glMatrixMode(GL_PROJECTION);

glLoadIdentity();

glOrtho(0.0, double(width), 0.0, double(height), -100.0, 100.0);

glMatrixMode(GL_MODELVIEW);

return true;
}

void Quit(void)
{
FreeMemory();
SDL_Quit();
fout.close();
}

void FreeMemory(void)
{
delete jet;
}

void GetEvents(void)
{
SDL_Event event;

while(SDL_PollEvent(&event))
{
    switch(event.type)
    {
        case SDL_KEYDOWN:
            switch(event.key.keysym.sym)
            {
                case SDLK_ESCAPE:
                    game_state = 1;
                    break;

 default:
                    break;
            }
            break;

case SDL_MOUSEBUTTONDOWN:
break;

case SDL_MOUSEMOTION:
default:
break;
}
}
}

when I run “testgl -fullscreen” from a DOS box on win98 I get a
"window button" left hanging around on the task-bar. If I run the
program again I get another one! Not very nice …

This may be related to your problem.
I found that this fixes it for directx:

[snipped]

Thanks! I’ve added your fix into CVS.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment