|
Allegro 5 + OpenGL setup |
KirbyDS11
Member #15,167
June 2013
|
Hi 1#include <allegro5/allegro.h>
2#include <allegro5/allegro_opengl.h>
3#include <iostream>
4
5using namespace std;
6
7int main()
8{
9 al_init();
10 al_set_new_display_flags(ALLEGRO_OPENGL | ALLEGRO_WINDOWED);
11 ALLEGRO_DISPLAY *display = al_create_display(screenwidth,screenheight);
12 al_set_window_position(display,100,100);
13 al_set_window_title(display,"OpenGL test");
14 cout << al_get_opengl_version() << endl;
15 return 0;
16}
67305216 is the output from al_get_opengl_version() so something is wrong here. Woops |
Arthur Kalliokoski
Second in Command
February 2005
|
KirbyDS11 said: 67305216 is the output from al_get_opengl_version() so something is wrong here. Looking at it as a hex number, it's 0x402FF00, which breaks down to version 4.2.255, as explained in the documentation. They all watch too much MSNBC... they get ideas. |
KirbyDS11
Member #15,167
June 2013
|
Okay so that explains that but when I use this code... 1#include <allegro5/allegro.h>
2#include <allegro5/allegro_opengl.h>
3#include <iostream>
4
5using namespace std;
6
7int main()
8{
9 al_init();
10 al_set_new_display_flags(ALLEGRO_OPENGL | ALLEGRO_WINDOWED);
11 ALLEGRO_DISPLAY *display = al_create_display(screenwidth,screenheight);
12 al_set_window_position(display,100,100);
13 al_set_window_title(display,"OpenGL test");
14 al_set_current_opengl_context(display);
15 glEnable(GL_DEPTH_TEST);
16 return 0;
17}
I get an undefined reference to glEnable. So how could I get this to work? Woops |
Arthur Kalliokoski
Second in Command
February 2005
|
You didn't say what compiler you're using, just at a guess MSVC would want opengl32.lib (and possibly glu32.lib if you use any of those functions in the future) and Mingw would want -lopengl32 and -lglu32. They all watch too much MSNBC... they get ideas. |
KirbyDS11
Member #15,167
June 2013
|
oh sorry Woops |
Arthur Kalliokoski
Second in Command
February 2005
|
I don't use Code::Blocks, but if it wants the literal names of the libraries, they'd be libopengl32.a and libglu32.a. They all watch too much MSNBC... they get ideas. |
KirbyDS11
Member #15,167
June 2013
|
Okay I linked the libraries and it works Woops |
|