|
[Allegro 5.0.8] glGenBuffers not initialized? (Allegro noob) |
dennmat
Member #15,153
May 2013
|
Hey guys, I've done a few small projects with Allegro before, nothing too intense, so it's quite possible that I'm missing a step or some info. glGenBuffers is throwing a good ole 'memory access error'. The debug shows it to not be properly initialized. Which correct me if I'm wrong here but I'm using the ALLEGRO_OPENGL_3_0 flag and this required 3.0 or >. And 3 has VBOs. So am I missing something to properly initialize the gl function calls. Something similar to glewInit perhaps? Includes #include <allegro5/allegro.h> #include <allegro5/allegro_opengl.h> Which I believe is all I need to include for opengl support in allegro correct? Display Creation (`al_init` is before this point and returns successfully) al_set_new_display_flags(ALLEGRO_OPENGL | ALLEGRO_OPENGL_3_0); display = al_create_display(display_data.width, display_data.height); Call to Generate a Buffer GLuint vboNy; glGenBuffers(1, &vboNy); The run time error occurs at the glGenBuffers call and using msvc's debugger shows that it isn't pointing to a valid location in memory where the function might exist. What steps am I missing to make glGenBuffers defined? Side note glGenBuffersARB is also not valid currently. |
Arthur Kalliokoski
Second in Command
February 2005
|
This page says the second parameter is supposed to be a GLuint pointer, not a pointer to an GLuint, which is what you have. They all watch too much MSNBC... they get ideas. |
dennmat
Member #15,153
May 2013
|
Thanks for the prompt reply. Reference linked to: void glGenBuffers(GLsizei n, GLuint * buffers); They are one in the same(as far as a receiving function is concerned), GLuint x; &x; is equivalent to GLuint * x = new GLuint(); or GLuint x[] = {0}; x; They are all pointers to a GLuint/of type GLuint pointer. However I tried anyway(pointer definitions): GLuint * vboNy = new GLuint(); glGenBuffers(1, vboNy);
Result in the same errors. (glGenBuffers == NULL) //true std::cout << glGenBuffers; //00000000 Thanks edit clarified a statement. |
Erin Maus
Member #7,537
July 2006
|
Similar code works on my end. Does your graphics card support OpenGL 3? Are the drivers up to date? --- |
dennmat
Member #15,153
May 2013
|
Running a GTX 670, drivers are updated and I have had OpenGL 4 commands work outside of Allegro previously, in particular MultiDrawArraysIndirect. I noticed al_get_opengl_version in the docs. (Which I believe returns an int meant to be read as hex) printf("VERSION %X", al_get_opengl_version()); //VERSION 0 However it can't be 0 because I've been successful in using opengl until trying to move over from using VertexArrays stored cpu side to Buffers stored GPU side. |
Erin Maus
Member #7,537
July 2006
|
Try and call al_set_current_opengl_context(display) before generating the VBO. How did you compile Allegro? Are you using the proper compiler runtime and, similarly, the proper libraries for the compiler runtime? This example works for me: 1#include <allegro5/allegro.h>
2#include <allegro5/allegro_opengl.h>
3#include <stdio.h>
4
5int main(void)
6{
7 if (!al_init())
8 return 1;
9
10 al_set_new_display_flags(ALLEGRO_OPENGL | ALLEGRO_OPENGL_3_0);
11 ALLEGRO_DISPLAY* display = al_create_display(640, 480);
12
13 GLuint vbo;
14 glGenBuffers(1, &vbo);
15
16 printf("Version: %X\n", al_get_opengl_version());
17 printf("glGenBuffers == %X", glGenBuffers);
18
19 glDeleteBuffers(1, &vbo);
20 al_destroy_display(display);
21
22 return 0;
23}
Result: Version: 3000000 glGenBuffers == 5EEB4790
--- |
dennmat
Member #15,153
May 2013
|
I downloaded the msvc 11 precompiled binaries from https://www.allegro.cc/files/ at the time it was 5.0.8 but I see now a new(stable) release is out. Linking to the allegro-5.0.8-monolith-md-debug.lib and have the equivalent .dll. I'll download source(5.0.9) from the http://alleg.sourceforge.net/download.html and build it and see if it remedies the situation and I'll update this post with the result. Thanks edit Also I tried your suggestion no luck and your example for me produces the same result as I've been having. I feel like you're onto something with the whole allegro setup thing, I thought I'd get away with being lazy and use some precompiled binaries. However something tells me building it locally will probably fix this. UPDATE Tried getting glew to play nice with Allegro(dirty I know but running out of options) couldn't get it to go. Not sure where to go from here and help/ideas are appreciated. UPDATE 2 UPDATE Thanks Guys |
Edgar Reynaldo
Major Reynaldo
May 2007
|
The man page on opengl with allegro 5 gives you several ways to check for supported opengl extensions. Is glGenBuffers an extension? (I wouldn't know as I have little experience with OpenGL). And I thought I heard once upon a time Allegro would give you the latest OpenGL just with the ALLEGRO_OPENGL flag, (ie... and not with ALLEGRO_OPENGL_3_0 needed). Also, the manual says you have to create an OpenGL context (read - opengl allegro display) BEFORE calling al_get_opengl_version. I assume the rest of the opengl functions may behave similarly. 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 |
|