Dear OGL specialists. After a desperate week of trial and error, I stuck in error. I am working on a project to generate topographical maps from terrain profile data.
Task:
The task is to create a BMP file from a OGL frame. The picture shall not be a screen copy, it shall be rendered separately in a user defined pixel resolution (maximum 16384 x 9498 RGB 32 bit).
Solution:
To render the frame separately, I used a memory bitmap as drawing surface. The bitmap is created with the function ‘CreateDIBSection’ with the screen device context (HDC) as input parameter. The only difference to the screen pixel format is the attribute PFD_DRAW_TO_BITMAP given in the PIXELFORMATDESCRIPTOR. Since the entire frame is made of colored polygons, I need polygon antialiasing. To avoid the annoying stitches between polygons, the blend function is set to ‘glBlendFunc(GL_SRC_ALPHA, GL_ONE)’.
Problem:
The described configuration rendered to the screen works perfect. If I render to the memory bitmap, I do not find any configuration which avoids stitches and shows a good quality with polygon antialiasing.
the following combinations were tested:
glBlendFunc: GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA
GL_BLEND: enabled
Result:
Stitches between polygons, antialiasing perfect.
glBlendFunc: GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA
GL_BLEND: disabled
Result:
no stitches, perfect colors, ugly antialiasing.
glBlendFunc: GL_SRC_ALPHA,GL_ONE
GL_BLEND: enabled
Result:
nothing is drawn but the background color.
glBlendFunc: GL_SRC_ALPHA,GL_ONE
GL_BLEND: disabled
Result:
no stitches, perfect colors, ugly antialiasing.
Question:
[ul]
[li]Is there any blending combination for memory bitmaps which works without the stitches and GL_BLEND on ?
[/li][li]Is there any possibility to share display lists between the screen render context and the memory render context? (I could not get that to work).
[/li][li]
[/li][li]What is the sense behind the polygon stitches, which are complete useless and beeing observed over decades in every OGL version? The stitches are not hardware dependent. They are even observed if rendered directly to memory bitmaps or to printer DCs and no graphics card is involved.
[/li][/ul]
Regards
Mike