2013-09-04 23:43:12 UTC
I have a problem with two spheres (both same size, one red the other
green). When they are drawn at the same location the resultant sphere
is drawn with a speckled appearance.
A bit of reseach found the "Z fighting" problem, together with the
solution of using glPolygonOffset.
The Delphi supplied OpenGL header doesn't include glPolygonOffset so I
add all the code necessary.
And it all works as expected.
But wait, there is a problem.
When I setup my on screen rendering, I call ChoosePixelFormat and
PFDFlags := PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or
PFDPixelType := PFD_TYPE_RGBA;
PFDColorBits := 24;
PFDDepthBits := 32;
which is working OK.
In order to do a hard copy print, I Clean up and terminate Screen DC
and RC and then Create an off screen buffer, Select a pixel format,
Create and bind an OpenGL rendering context.
The pixel format is specified as
PFDFlags := PFD_DRAW_TO_BITMAP or PFD_SUPPORT_OPENGL;
I then call wglGetProcAddress('glPolygonOffset') but this fails with
error 127 The specified procedure could not be found.
According to the MSDN help for wglGetProcAddress
The OpenGL library supports multiple implementations of its functions.
Extension functions supported in one rendering context are not
necessarily available in a separate rendering context. Thus, for a
given rendering context in an application, use the function addresses
returned by the wglGetProcAddress function only.
The extension function addresses are unique for each pixel format. All
rendering contexts of a given pixel format share the same extension