![]() |
|
al_get_opengl_proc_address failed |
RmBeer2
Member #16,660
April 2017
![]() |
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: 1#include <stdio.h>
2#include <allegro5/allegro.h>
3#include <allegro5/allegro_image.h>
4
5int main(){
6 int err,i,CICLO=1,redraw=0;
7 //Prepara ALLEGRO
8 ALLEGRO_DISPLAY*dsp;
9 ALLEGRO_EVENT event;
10 ALLEGRO_EVENT_QUEUE*queue;
11
12 //Inicializa Allegro
13 if(!al_init()){printf("Fallo AL_INIT\n");return -1;}
14 al_install_mouse();
15 al_install_keyboard();
16 //al_init_image_addon();
17 //al_set_new_display_flags(ALLEGRO_OPENGL_ES_PROFILE);
18 dsp=al_create_display(640,480);
19 if(!dsp){printf("Fallo creando display\n");return -1;}
20 al_set_window_title(dsp,"HAPPY VIDEO");
21 //timer=al_create_timer(1/60);
22 queue=al_create_event_queue();
23 al_register_event_source(queue,al_get_keyboard_event_source());
24 //al_register_event_source(queue,al_get_display_event_source(dsp));
25
26 void*f=al_get_opengl_proc_address("glGetString");
27 printf("PROC ADDRESS: %p\n",f);
28 const char *version_string = ((const char*(*)(int))f)(0x1F02);
29 printf("PROC ADDRESS: %s\n",version_string);
30 return 0;
31}
Line compiling: gcc pru.c -o pru -lallegro -g RESULT: I also trying with a TESTCASE for SDL: 1#include <stddef.h>
2#include <stdio.h>
3#include <stdlib.h>
4
5#include <SDL.h>
6
7int main(int argc, char *argv[])
8{
9
10 // Jesus Christ SDL, you suck!
11 SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "no");
12
13 if (SDL_Init(SDL_INIT_VIDEO) < 0){
14 printf("SDL init failed\n");return -1;}
15
16 SDL_Window *window =
17 SDL_CreateWindow("hi", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
18 1000, 500, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN |
19 SDL_WINDOW_RESIZABLE);
20 if (!window){
21 printf("failed to create SDL window\n");return -1;}
22
23 SDL_GLContext glcontext = SDL_GL_CreateContext(window);
24 if (!glcontext){
25 printf("failed to create SDL GL context\n");return -1;}
26
27 void*f=SDL_GL_GetProcAddress("glGetString");
28 printf("PROC ADDRESS: %p\n",f);
29 const char *version_string = ((const char*(*)(int))f)(0x1F02);
30 printf("PROC ADDRESS: %s\n",version_string);
31
32 printf("properly terminated\n");
33 return 0;
34}
Line Compiling: gcc -o main main.c `pkg-config --libs --cflags mpv sdl2` -std=c99 RESULT: ------------------------------------------------------------- This is my first serious fault discovered in Allegro 5... 🌈🌈🌈 🌟 BlackRook WebSite (Only valid from my installer) 🌟 C/C++ 🌟 GNU/Linux 🌟 IceCream/Cornet 🌟 🌈🌈🌈 Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024! |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
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. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
gusnan
Member #11,822
April 2010
|
Is this with Allegro from distribution package, or compiled from source? |
RmBeer2
Member #16,660
April 2017
![]() |
@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) 🌈🌈🌈 🌟 BlackRook WebSite (Only valid from my installer) 🌟 C/C++ 🌟 GNU/Linux 🌟 IceCream/Cornet 🌟 🌈🌈🌈 Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024! |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
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? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
RmBeer2
Member #16,660
April 2017
![]() |
this is the first like that i use: al_set_new_display_flags(ALLEGRO_OPENGL); Yes, i use mesa. Archlinux Kernel: Linux 5.5.3-arch1-1 #1 SMP PREEMPT Tue, 11 Feb 2020 15:35:41 +0000 x86_64 GNU/Linux EDIT: 🌈🌈🌈 🌟 BlackRook WebSite (Only valid from my installer) 🌟 C/C++ 🌟 GNU/Linux 🌟 IceCream/Cornet 🌟 🌈🌈🌈 Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024! |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Rmbeer2, post the solution. You were incorrectly casting as a different type of function signature, were you not? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Elias
Member #358
May 2000
|
Just add #include <allegro5/allegro_opengl.h> and it will work. Also, never compile without warnings, that would have easily avoided that mistake. -- |
RmBeer2
Member #16,660
April 2017
![]() |
SOLUTION: Read the complete documentation and add this line: #include <allegro5/allegro_opengl.h>
🌈🌈🌈 🌟 BlackRook WebSite (Only valid from my installer) 🌟 C/C++ 🌟 GNU/Linux 🌟 IceCream/Cornet 🌟 🌈🌈🌈 Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024! |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
From what I read of your conversation on IRC, you incorrectly cast a function pointer as well. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
RmBeer2
Member #16,660
April 2017
![]() |
No, I don't think so, when I added that line of #include everything worked fine and without warnings. 🌈🌈🌈 🌟 BlackRook WebSite (Only valid from my installer) 🌟 C/C++ 🌟 GNU/Linux 🌟 IceCream/Cornet 🌟 🌈🌈🌈 Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024! |
Elias
Member #358
May 2000
|
Edgar Reynaldo said: 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. -- |
|