Once
Once

Reputation: 121

how to create opengl 3.x or 4.x context with fltk 1.3?

I am considering porting one of my softwares from opengl 2.1 to modern versions (3.x or 4.x).

The GUI is designed with fltk, and includes a FL_GL_Window where I do all the rendering. Now my problem is that I do not understand how to specify the opengl context for this window.

If I would use SDL to create the OpenGL context, I could use something like: SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);

Is there something similar for fltk ? Or can it handle only Opengl 2.1 ?

Upvotes: 1

Views: 1488

Answers (2)

DejanLekic
DejanLekic

Reputation: 19797

I suppose you can use WGL_ARB_create_context or wglCreateContext to create an OpenGL context, and after that you can use Fl_GL_Window's void context (void *, int destroy_flag=0) method to set the context. Ofcourse, you must be careful about creation. Luckilly, FLTK will be able to give you details about DC so you can create valid OpenGL context. Also, you can use void* context() method to get a point of the OpenGL context in use by FLTK.

Upvotes: 1

Nicol Bolas
Nicol Bolas

Reputation: 473447

Neither FLTK 1.1 nor FLTX 2.0's window creation functions allow the creation of a core OpenGL context. You can still create a compatibility context of post 2.1 versions (though not on MacOSX, where they only offer core OpenGL).

Upvotes: 1

Related Questions