I was thinking of posting the error on github, but unfortunately it is not possible, my current email was hijacked and when trying a new email, github blocks it. Anyway.
Have a error from al_get_opengl_proc_address(), give wrongs pointers and get a segfault in the L28.
TESTCASE:
Line compiling: gcc pru.c -o pru -lallegro -g
RESULT:
PROC ADDRESS: 0xfffffffff4f535e0
(SIGSEGV in 0xfffffffff4f535e0)
I also trying with a TESTCASE for SDL:
Line Compiling: gcc -o main main.c `pkg-config --libs --cflags mpv sdl2` -std=c99
RESULT:
PROC ADDRESS: 0x7fafcd76b5e0
PROC ADDRESS: 3.0 Mesa 19.3.4
properly terminated
-------------------------------------------------------------
This is my first serious fault discovered in Allegro 5...
Bah humbug. This is not a bug in Allegro. You didn't request ALLEGRO_OPENGL, so you were using D3D. Which means al_get_opengl_proc_address will fail spectacularly.
Well, at least if you were on Windows that code would fail.
On Linux, it should work.
Is this with Allegro from distribution package, or compiled from source?
@Edgar
It fails the same anyway, I have already tried all the context variants for OpenGL.
@gusnan
For both. (From the system and from the source code)
glGetString is OpenGL 2.0. It will fail if your drivers aren't recent enough. But you say you're using Mesa?
What platform are you on that fails? What version of Allegro are you using? What version are your MesaGL drivers?
this is the first like that i use: al_set_new_display_flags(ALLEGRO_OPENGL);
(in the comment line)
Yes, i use mesa.
Allegro from the system and from the source code in both sides, all updated in less of 1 day.
Also for the Archlinux system is updated in less of 3 days.
Archlinux Kernel: Linux 5.5.3-arch1-1 #1 SMP PREEMPT Tue, 11 Feb 2020 15:35:41 +0000 x86_64 GNU/Linux
mesa 19.3.4-2
EDIT:
mesa 19.3.4-2 is only get from testing... i unknown what patches're applied...
But it doesn't matter, since in the SDL testcase it works.
Rmbeer2, post the solution. You were incorrectly casting as a different type of function signature, were you not?
Just add #include <allegro5/allegro_opengl.h> and it will work.
Also, never compile without warnings, that would have easily avoided that mistake.
SOLUTION: Read the complete documentation and add this line:
#include <allegro5/allegro_opengl.h>
From what I read of your conversation on IRC, you incorrectly cast a function pointer as well.
No, I don't think so, when I added that line of #include everything worked fine and without warnings.
From what I read of your conversation on IRC, you incorrectly cast a function pointer as well.
Well, the effect of forgetting the #include means the compiler (after displaying a big warning) just assumes all undefined functions return int and so essentially the 64-bit function pointer got cast to a 32-bit int.