SDL+GL=bugs

Started by
12 comments, last by Pipo DeClown 19 years, 4 months ago
When I use OpenGL with SDL, I find a lot of strange bugs: 1) The Win32 MessageBox() doesn't work. (Even when it returns S_OK, I just hear a bumpbeep) 2) fprintf() crashes with a writing exception at 0000000010. Something like that. (Only when I delete the code, it doesn't crash. It even crashes when commented out) I use VC++.NET and SDL-1.2.7. (Tried the real OpenGL headers instead of SDL_opengl.h, still the same bugs)
Advertisement
Have you tried fiddling with the choice of runtime libraries? I think SDL requires that you use Multithreaded DLL, but that's just some distant thing in the back of my head. It's in code generation in C/C++ folder in the project settings.
Also, are you running in fullscreen? That might be the reason the Win32 Message Box isn't showing up. In my experience, mixing Win32 stuff with OGL/DX is asking for trouble.

Check your code around yuor fprintf. I would suspect the error there is with something else, and not your OGL code. What are you printing out?

In all likelihood, you're already compiling using the Multithreaded DLL option (I don't think an SDL program will even compile without it).

Hope that helps,
--Brian

aren't you not supposed to touch any Win32 functions if your using SDL? i would bet that's why its not working. why do you even need to use it? SDL should handle everything for you..

plus, it un-cross-platformizes (lol) your code.
FTA, my 2D futuristic action MMORPG
Yeah why are you doing that, the reason to combine SDL and OpenGL is to make is cross platform, if you are using the WinAPI might as well ditch SDL. . .
By the way. . .SDL_opengl.h. . .what use

#include <SDL/SDL.h>
#include <GL/GL.h>
#include <GL/GLU.h>

(Only when I delete the code, it doesn't crash. It even crashes when commented out) that doesnt make any sense. . .
One reason to use win32 message boxes is if you have an error and you want your user to see it. You can use that temporarily until you make a gui or implement on the other systems you are using your game/app on. Or if its only for the developer.
______________________________________________________________________________________With the flesh of a cow.
I have had bugs such as these before. THe only solution I have is to create a Win32 console app, instead of a Win32 App, so you can use printf to help you track erros.

[Edited by - Drew_Benton on January 3, 2006 4:04:01 AM]
If you use printf in a win32 app with SDL, the output should automatically be directed to a text file which you can read when your program finishes.

Edit: oh sorry, you said fprintf

[Edited by - Kelly G on November 28, 2004 6:35:58 AM]
i want to know too.and i dont know where i can download the SDL!

This topic is closed to new replies.

Advertisement