glew icon indicating copy to clipboard operation
glew copied to clipboard

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

Open alexanderAmaltsev opened this issue 8 years ago • 1 comments

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

alexanderAmaltsev avatar Feb 14 '17 10:02 alexanderAmaltsev

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.

nigels-com avatar Feb 15 '17 23:02 nigels-com