Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Setup OpenGL version

This thread is locked; no one can reply to it. rss feed Print
Setup OpenGL version
I-am-bigov
Member #16,909
October 2018
avatar

Hi all! I try to init display with OpenGL 3.2:

#SelectExpand
1void window_create(void) 2{ 3 if(!al_init()) ERR("failed to initialize allegro!\n"); 4 5 uint32_t version = al_get_allegro_version(); 6 unsigned int major = version >> 24; 7 unsigned int minor = (version >> 16) & 255; 8 unsigned int revision = (version >> 8) & 255; 9 unsigned int release = version & 255; 10 std::cout << "Allegro version: " 11 << major << "." << minor << "." << revision << "." << release << "\n"; 12 13 al_install_keyboard(); 14 15 timer = al_create_timer(1.0 / 30.0); 16 queue = al_create_event_queue(); 17 18 al_set_new_display_flags(ALLEGRO_OPENGL | 19 ALLEGRO_WINDOWED | ALLEGRO_RESIZABLE); 20 al_set_new_display_option(ALLEGRO_OPENGL_MAJOR_VERSION, 3, ALLEGRO_REQUIRE); 21 al_set_new_display_option(ALLEGRO_OPENGL_MINOR_VERSION, 2, ALLEGRO_REQUIRE); 22 display = al_create_display(640, 480); 23 if(nullptr == display) ERR ("failed to create display!\n"); 24 al_set_current_opengl_context(display); 25 26 al_register_event_source(queue, al_get_keyboard_event_source()); 27 al_register_event_source(queue, al_get_timer_event_source(timer)); 28 29 std::cout<<"al opengl version: " 30 << std::hex << al_get_opengl_version() << std::endl; 31 32 std::cout << "disp options: OPENGL_MAJOR = " 33 << al_get_display_option(display, ALLEGRO_OPENGL_MAJOR_VERSION) << ", " 34 << "OPENGL_MINOR = " 35 << al_get_display_option(display, ALLEGRO_OPENGL_MINOR_VERSION) << "\n"; 36 37 return; 38}

But I see that version 3.2 did not load. I see:

Allegro version: 5.2.4.1
al opengl version: 4060000
disp options: OPENGL_MAJOR = 0, OPENGL_MINOR = 0
---
OpenGL Version 4 6 loaded

What am I doing wrong? I need for OpenGL version 3.2, not 4.6.

Go to: