Salutations!
I'm new to Allegro and am trying to use it to create an OpenGL 3+ context. Which works, using the code below:
This compiles, links and returns:
OpenGL version: 3.0.0 NVIDIA 256.44 GLSL version: 1.30 NVIDIA via Cg compiler
However, when I try to initialize a forward compatible context by uncommenting ALLEGRO_OPENGL_FORWARD_COMPATIBLE, the program crashes with the output
opengl3.3.exe: /home/tim/ccpp/allegro-4.9.21/src/opengl/extensions.c:153: print_extensions: Assertion `extension' failed. Aborted
where the assertion is checking for an empty string of OpenGL extensions.
So:
What am I doing wrong? What is the correct way to request a forward compatible context?
Or is it Allegro that is doing something wrong?
Also, I have two other questions that I wouldn't mind an answer to:
Is it necessary to do both the two al_create_display()s? On my installation it crashes if I do not first create the OpenGL 2 context. Is this the expected behaviour for allegro?
How do I request a OpenGL version of, for example, 3.3? The glxinfo output claims to be capable of that.
Speaking of which, I am using Allegro 4.9.21 (from sourceforge 2010-08-17), built with GCC 4.3.3 on Ubuntu 9.4 (Jaunty) with the Nvidia 256.44 drivers.
Any and all answers are greatly appreciated!
The assertion will be because Allegro internally calls glGetString(GL_EXTENSIONS); which is deprecated in OpenGL 3. So you aren't doing anything wrong, it's a bug. You shouldn't need to create two displays either.
We'll need to think about the API for requesting later OpenGL versions as well.
You're probably the first to try OpenGL 3 support...
Thanks for the prompt reply, Peter.
It is good to know that I am not doing it wrong...