Open GL Device Context and VB
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). these are the init
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 (for example):
hDC=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?
How can I set the PixelFormat to a non-form DC?
Thanks in advance.
David
brainkiller@progcenter.com
Hi David,
You don''t have to use a form... you can use any object that has a hDC property. If you want to create a GL Rendering Context for something that is not visible, try using a Picture Box with the Visible property set to false.
Hope that helped
You don''t have to use a form... you can use any object that has a hDC property. If you want to create a GL Rendering Context for something that is not visible, try using a Picture Box with the Visible property set to false.
Hope that helped
Thank you. Of Course.
But I cannot use a form in my project because this is an ActiveX DLL with no forms. I don''t want to use it.
The engine builds the charts in memory and sends them to the user via http. I would like now to create 3d pie charts, but
without using forms or picture boxes.
David
But I cannot use a form in my project because this is an ActiveX DLL with no forms. I don''t want to use it.
The engine builds the charts in memory and sends them to the user via http. I would like now to create 3d pie charts, but
without using forms or picture boxes.
David
I may be missing the point here, but if you are sending the data for the chart via http, why are you bothering about rendering it in OpenGL in the dll. Surely the client receiving the data should be responsible for displaying it however they wish... ?
Ok... i think i get you now... I''ve just written a user control at work that uses OpenGL to display shit on itself... you just need to use the ActiveX Property Wizard (may not be the actual name... can''t remember off the top of my head) to add a hDC property to the control. The client then uses this control on one of it''s forms etc to display the stuff.
Is that any more helpful, or am i making more of an ass out of myself?
Ok... i think i get you now... I''ve just written a user control at work that uses OpenGL to display shit on itself... you just need to use the ActiveX Property Wizard (may not be the actual name... can''t remember off the top of my head) to add a hDC property to the control. The client then uses this control on one of it''s forms etc to display the stuff.
Is that any more helpful, or am i making more of an ass out of myself?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement