PDA

View Full Version : CS_OWNDC? strange behaviour?



mathias_123
02-02-2002, 12:29 AM
Hi!
I'm building a tool to make bezier-surfaces. I'm doing this
with my Delphi rad-tool, because I need some Windows-stuff like
panels, trackbars and so on. I use two panels to get two rendering-
contexts. (The first panel is to have a look at the surface with rotation,
texturing and stuff, and the second panel is the view from above on the
surface with some GL_POINTS on it, on which can be clicked to modify
the control points.)
The problem is, that I have a second window in use, which offers some
trackbars to modify colour and lighting. When this (tool-)window is
shown, the first panel (with rendering context) isn't updated anymore, and
the whole application seems to become strange. Sometimes the second
panel (with rendering c.) seems to have become both rendering contextes
(because on this panel both scenes are shown, they're just switching
continuosly between each other...)
I have the suggestion, that this behaviour is caused in the windowclass-parameter
CS_OWNDC that I use, when I create the window without delphi...

any suggestions?

thanks!
mathias_123

Turbo_Pascal
02-04-2002, 02:44 PM
Hi,

I am a delphi programer and i have my opengl library too.

For some time I was working with just one rendering window, but then when i needed to work with another i get exactly the same problem like yours.

The problem is how to handle which opengl RC is active because you have two of them.

When i was creating the Dc and Rc i was saving then for be used later in the command

wglMakeCurrent( pdc, pRC);

for make current the viewport at your render window, but i found that when two or more opengl Rc are created, seems that the DC is changing, so it;s more safer to use:

wglMakeCurrent( getdc(pcontrol.handle), pRC);

That is using the getdc function for get the DC for the render windows each time that you need to make it active. this fixed the problem.

good luck

tp.