using wglMakeCurrent for different windows

Hi people! First, sorry for my grammar.

I have created within one thread four windows, each one with its device and rendering context, and I have a scene that I want to visualize. In my Draw(idView) function I do

wglMakeCurrent(visualization_windows[idView].context.hDC, visualization_windows[idView].context.hRC);

This function always returns 1, so it seems to work .
The problem is that only draws my stuff in the first window that I have created. I do not get any errors, but seems to ignore the OpenGL calls in the other windows.

This function, Draw(idView), is mainly called from the WndProc of the windows.

Thankx. =]
guille

Hi !

If you don’t get any glGetError’s and nothing show up in any of the other Windows I would check the projections and matrix setups, it sounds like you have done something wrong there.

If you execute OpenGL functions and no errors are returned then it is usually that they are displayed somewhere outside the window, to small or to big or something like that, so my guess is that it’s a matrix problem…

Mikael

Thanks for your answer.

Well, I don’t think is a projection error. I have the same drawing routine for all the windows, the only thing that I change is the rendering context. It works fine with the first window, but with the others it does not display anything.
There is another thing. In the Draw(int idView) routine I call
glClearColor( …) with the background color that I want for that window. This works, because it changes the background color depending the window (so, the glMakeCurrent seems to work). But in the first window draws also my glVertex and in the other windows no. Why glClearColor works in all the windows and other OpenGL calls not?

guille

Thanks for your answer.

Well, I don’t think is a projection error. I have the same drawing routine for all the windows, the only thing that I change is the rendering context. It works fine with the first window, but with the others it does not display anything.
There is another thing. In the Draw(int idView) routine I call
glClearColor( …) with the background color that I want for that window. This works, because it changes the background color depending the window (so, the glMakeCurrent seems to work). But in the first window draws also my glVertex and in the other windows no. Why glClearColor works in all the windows and other OpenGL calls not?
guille

Originally posted by mikael_aronsson:
[b]Hi !

If you don’t get any glGetError’s and nothing show up in any of the other Windows I would check the projections and matrix setups, it sounds like you have done something wrong there.

If you execute OpenGL functions and no errors are returned then it is usually that they are displayed somewhere outside the window, to small or to big or something like that, so my guess is that it’s a matrix problem…

Mikael[/b]

Hi !

That was what I meant, clearing the background works even with an incorrect matrix, but what if all the vertices end up somewhere where you can’t see them or something like that ?

But if that’s not the problem, then I am not sure what might be the problem.

Mikael