PDA

View Full Version : dglOpenGL



MuteClown
17-03-2011, 12:33 PM
im converting to using the dglOpenGL with SDL, i've been using the GL and GLU units which come with fpc. now i see you need to define device context and rendering context, can someone explain this to me? how should i use them and what are they for?

device context and rendering context sound familiar, but i can't remember their purpose.

Sascha Willems
18-03-2011, 08:51 AM
Even when using SDL + OpenGL there is a rendercontext (RC) and a devicecontext (DC) though SDL most likely just hides it from you.

The rendercontext is kinda like an OpenGL namespace, so all functions and names (textures, display lists, shaders are all adressed by "names" wher names in OpenGL are usually integers) are tied to it and can only be used within it unless you share e.g. the namespace for textures, displaylists etc. via something like wglShareLists.

And the devicecontext is containing all the metrics of a windows/component and is used as a base to create your rendercontext from. So if you e.g. want to render onto a panel you use the panel's DC to create your RC from.