PDA

View Full Version : RC-DC--GDI



ravi2030
08-27-2001, 06:07 AM
hi,

where can we get info abt device context,rendering context and Graphics Device Interface..can u explain the relation between the three......

thanks

mikael_aronsson
08-27-2001, 10:55 AM
MSDN has everything you want about this: http://msdn.microsoft.com/

A device context is what you use to render to a window (GDI functions), myDC = GetDC( hWnd);

A rendering context is what you get from:
myRC = wglCreateContext( myDC);

The rendering context is what OpenGL use to render it's output, the rendering context is connected to the device context.

So what you do is that you create a Window, then get a DC from the Window, then you can create a rendering context from the DC.

All OpenGL functions are executed on the current active rendering context, you can select which one with: wglMakeCurrent( myDC, myRC);

If you want to mix GDI output With OpenGL output you must turn of doublebuffering and set a flag that you want to mix GDI with OpenGL output.

Hope that helps a bit.

Mikael