Strange behavior with SDL/OpenGL

Started by
4 comments, last by acrimon 18 years, 3 months ago
Hi, I'm experiencing a weird problem when I try to use SDL and OpenGL (with Dev-C++) to write a simple test app. The code itself is very brief; I just open a window and draw a rotating triangle. Anyway, the main problem is that when the app is executed, it is displayed without a frame, even though I never told SDL to do such a thing. Could this have something to do with my runtime libraries? However, the code I'm using runs fine on Linux, but apparently Windows gives this unexpected result. Any ideas? Thanks in advance!
Advertisement
I'd have to see the specific code, but are you calling SDL_SetVideMode with SDL_NOFRAME?
you might be '&'ing the screen options together?

what does your call to SDL_SetVideoMode look like?
I pass certain video flags to SDL_SetVideoMode() based on the result of calling SDL_GetVideoInfo(), but none of them include SDL_NOFRAME. In essence, I'm passing the following:
SDL_OPENGL, SDL_RESIZABLE, SDL_HWPALETTE, either SDL_HWSURFACE or SDL_SWSURFACE, and SDL_HWACCEL if available.

Also, when I used freeglut instead of SDL to try to reproduce this situation, freeglut functioned how I expected, so I'm guessing we can isolate this issue to SDL.

Here is the code in question:
// set video flags based on info returned by sdlint flags;const SDL_VideoInfo *info=SDL_GetVideoInfo();if (!info) {	// this shouldn't happen :s	printf("Unable to get video information!\n");	exit(0);}// default stuffflags |= SDL_OPENGL;flags |= SDL_RESIZABLE;flags |= SDL_HWPALETTE;// now we set flags based on what is availableif (info->blit_hw)	flags |= SDL_HWACCEL;if (info->hw_available)	flags |= SDL_HWSURFACE;else	flags |= SDL_SWSURFACE;// set double bufferingSDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);// try to set the video modescreen=SDL_SetVideoMode(640, 480, 32, flags);if (!screen) {	printf("Unable to set 640x480 video mode!\nReason: %s\n", SDL_GetError());	exit(0);}
int flags; should be int flags = 0; for starters. Otherwise it will be some random number that will probabally cause it to be SDL_NOFRAME. See if that fixes it.
Yep, that did it. :) Thanks!

This topic is closed to new replies.

Advertisement