Hello, I’m David.
I’m adding some other graphics features to a charts engine written with
Visual Basic (ActiveX/COM).
That’s the problem:
I used a VB sample that I have downloaded from NeHe website.
It uses the form Device Context (frm.hDC) to draw primitives. these are the
statements:
… [other init statements]
PixelFormat = ChoosePixelFormat(frm.hDC, pfd)
If PixelFormat = 0 Then ’ Did Windows Find A
Matching Pixel Format?
KillGLWindow ’ Reset The Display
MsgBox “Can’t Find A Suitable PixelFormat.”, vbExclamation, “ERROR”
CreateGLWindow = False ’ Return FALSE
End If
If SetPixelFormat(frm.hDC, PixelFormat, pfd) = 0 Then ' Are We Able To
Set The Pixel Format?
KillGLWindow ’ Reset The Display
MsgBox “Can’t Set The PixelFormat.”, vbExclamation, “ERROR”
CreateGLWindow = False ’ Return FALSE
End If
I don’t want to see the image on a form but I would like to build it in
memory.
I tried to create a compatible Device Context: hDCC=CreateCompatibleDC(0)
and then used instead of frm.hDC.
When I Try to set the PixelFormat I get an error (… .can’t set the pixel
format… ) ok…
Why?
Is it not possible to draw with OpenGL on a DC different from the Form DC?
Thanks in advance.
David