nigels-com / glew

The OpenGL Extension Wrangler Library
Other
2.58k stars 608 forks source link

GLEW: glWindowPos does not change the position if rendering to a dib section (not to screen window) #134

Open alexanderAmaltsev opened 7 years ago

alexanderAmaltsev commented 7 years ago

Hi,

to briefly describe: I use OpenGL embedded in a Microsoft MFC class (CWnd is a base class). For drawing a frame around my scene I use glWindowPos2i to directly specify the points in window coordinates. Anything works fine until I render my GL scene and the frame directly to the screen. For printing I use a dib section first and then transfer the dib section drawn to the printer device context. Under Microsoft I need to use GLEW to invoke glWindowPos2i. It seems that glWindowPos2i works for screen rendering only, not for rendering to a dib section (memory device context).

For example the following code:

int params[10]; glGetIntegerv(GL_CURRENT_RASTER_POSITION, params); glWindowPos2i(0, 0); glGetIntegerv(GL_CURRENT_RASTER_POSITION, params);

If I observe in the debugger watch (MS VS 2015) the values of params while Rendering directly to the screen the values params[0], params[1] are indeed all zero. If I do it while rendering to a dib section some other than zero values remain unchanged in the watch window. So the invocation of glWindowPos2i(0, 0) has no effect.

Is it a problem of GLEW in connection with a memory device context? Or any suggestions?

thanks in advance

nigels-com commented 7 years ago

Seems likely to be a Microsoft OpenGL limitation, rather than a GLEW issue.

Modern practice would be to do offscreen rendering, rather than a CPU-side DUB section.