Half DC & Half RC

Hi,

Im trying to create a polygon using LineTo() and MoveTo()using the users mouse inputs in a Windows SDI based program in the left half of the screen. This part is already finished.

And the same polygon using OpenGL slightly shifted from the main polygon on the right hand side…as soon as I try to initialize opengl…my whole screen becomes black…and I cant see anything…inclyding the previous users drawing…(which used to be black on white…) …I dont know if its being drawn at all…or just overwritten with the black background when i initialize opengl.

I am completely stuck…I dont seem to be able to understand the RC and DC interconversions…how do I do this ?

Thanks
Vikky

Hi !

I think you need to post some code because I don’t have a clue what you mean, are you trying to use GDI an OpenGL in the same Window ?

Mikael

Yes…I am trying to use GDI and OpenGL in the same window.

Is it possible ?

What I have is a program…to follow the users mouse and draw a polygon using GDI.

I want to draw the same polygon in the same window…in a different area of the window using OpenGL.

Any help ?

Hi !

You cannot mix GDI and OpenGL if you have doublebuffering enabled, with single buffering it works but you must also set a flag when you create the rendering context to enable it.

You also need to be aware that glClear() will erase the contents of your window including and GDI stuff, but you can what part of the window should be used by OpenGL, but an easier solution is to draw the OpenGL stuff first and then draw all GDI stuff at the end if that is possible.

Mikael