A crash with SDL 1.3, Glew and OpenGL 3.2

Hi,

As a preamble, here are my specs:
Acer 5552G Laptop
AMD Phenom II X4 N970
AMD Radeon HD 6650M (supports up to OpenGL 4.0)
4 GB of RAM

Also, I’m trying to port an opengl tutorial series (
http://www.opengl-tutorial.org/ ), and I was able to compile everything fine
there, with one or two very minor tweaks.

A few days ago, I asked for help in loading OpenGL 3.2 functions, and I was
told to use Glew, which to the most of my knowledge is working, however, I’m
having a weird issue with my program (
http://code.google.com/p/opengl-3x-tutorials-sdl/ > grab a copy off SVN).

Everything compiles fine, but when running, the window closes almost
immediately. I wasn’t sure what was going on, so I ran things through gdb,
which gave this output:

Program received signal SIGSEGV, Segmentation fault.

0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x00401653 in _fu38___ZNSs4_Rep20_S_empty_rep_storageE (argc=1,
argv=0x8618a8) at tutorial06.cpp:48
#2 0x00405408 in console_main (argc=1, argv=0x8618a8) at
src/main/windows/SDL_windows_main.c:142
#3 0x00405487 in WinMain (hInst=0x400000, hPrev=0x0, szCmdLine=0x5c324d
"", sw=10) at src/main/windows/SDL_windows_main.c:199
#4 0x00404f86 in main ()

So, on that note, some forum posts recommended gl3w, so I downloaded that,
and I get another batch of errors.

So, after some fiddling, it seems that if I don’t try and set the opengl
context version, it automatically bumps up to 4.0, and gl3w works fine.

Is this a SDL issue, or is it more in the handles of OpenGL and gl3w?

Thanks guys,
-Alex

Hey, sorry for the double post.

Anyway, I found this weird bug(?) or behaviour with SDL 1.3 and setting
opengl context bit depth. If you are just using OpenGL 1.1 (Default?), this
does not happen, but if you are trying to get an OpenGL 3.x or better
context (I didn’t test with the 2.x branch), the context and program will
crash.

To demonstrate, you can grab my program and compile and run it, it’s fine.
Then, go into common/sdlapp.cpp and uncomment line 32, compile and run, and
the program will crash.

Does doing SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depth) (where depth is up
to 32 bits) perform some sort of hack to the OpenGL context, or am I just
doing it wrong somehow?

Thanks,
-AlexOn Tue, Oct 11, 2011 at 6:37 PM, Alex Barry <@Alex_Barry> wrote:

Hi,

As a preamble, here are my specs:
Acer 5552G Laptop
AMD Phenom II X4 N970
AMD Radeon HD 6650M (supports up to OpenGL 4.0)
4 GB of RAM

Also, I’m trying to port an opengl tutorial series (
http://www.opengl-tutorial.org/ ), and I was able to compile everything
fine there, with one or two very minor tweaks.

A few days ago, I asked for help in loading OpenGL 3.2 functions, and I was
told to use Glew, which to the most of my knowledge is working, however, I’m
having a weird issue with my program (
http://code.google.com/p/opengl-3x-tutorials-sdl/ > grab a copy off SVN).

Everything compiles fine, but when running, the window closes almost
immediately. I wasn’t sure what was going on, so I ran things through gdb,
which gave this output:

Program received signal SIGSEGV, Segmentation fault.

0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x00401653 in _fu38___ZNSs4_Rep20_S_empty_rep_storageE (argc=1,
argv=0x8618a8) at tutorial06.cpp:48
#2 0x00405408 in console_main (argc=1, argv=0x8618a8) at
src/main/windows/SDL_windows_main.c:142
#3 0x00405487 in WinMain (hInst=0x400000, hPrev=0x0, szCmdLine=0x5c324d
"", sw=10) at src/main/windows/SDL_windows_main.c:199
#4 0x00404f86 in main ()

So, on that note, some forum posts recommended gl3w, so I downloaded that,
and I get another batch of errors.

So, after some fiddling, it seems that if I don’t try and set the opengl
context version, it automatically bumps up to 4.0, and gl3w works fine.

Is this a SDL issue, or is it more in the handles of OpenGL and gl3w?

Thanks guys,
-Alex