PDA

View Full Version : Visual Basic 6.0 and OGL



BanksySan
12-18-2002, 03:59 AM
Hi guys,

I have to write the front end of a reserch application. The app needs to represent the data visually. I will also need to be able to rotate it arround all 3 axis. To top it all off it needs to be implemented with VB 6.0

How do I start?

Mazy
12-18-2002, 04:53 AM
Look for a file called opengl.tlb, or gl.tlb and glu.tlb

you should be able to find them via google

BanksySan
12-18-2002, 04:54 AM
Will do, what do these files do though?

John Jenkins
12-18-2002, 05:35 AM
VB 6 has a opengl library. In project references there is a VB opengl 1.3 I think is the exact name. I only program in VB6 and opengl. I started with learning the NEHE examples http://nehe.gamedev.net/ He has VB examples there to help you get your foot in the door on programming in VB and opengl. You can rotate your objects like NEHE does and get OK results. However if you want to kick it up a notch and rotate with a mouse and not have problems with rotaion sticking (look up quaternion, just a heads up on problems you might have), use the trackball example at http://is6.pacific.net.hk/~edx/othersamples.htm
There are other examples at the site too that will allow you to do some advanced stuff.
You don't have to restrict yourself to just learning VB examples since Opengl has the same syntax in other languages too.
Finally, use the search on this web page to search for what you need. Nine times out of ten your question has already been answered.
Well thats the best VB Opengl advice I know, have fun.

BanksySan
12-18-2002, 05:40 AM
John you are a star mate. Cheers, that sounds like exactly what I need.

BanksySan
12-18-2002, 03:05 PM
John,

I have had a look at the VB examples. They have put a few things in light, mainly that OpenGL is blooy complicated!

I ham having a hell of a time trying to decipher the methods, I really have no graphical experience at all. I have done some VERY basic VRML, Is the structure of the OpenGL object similar? As in, does it consist of nodes, each of which is linked to the parent nodes in some way?

Please help. Dave

John Jenkins
12-19-2002, 05:41 AM
First of all go to the NEHE tutorials and download the VB version of lesson 3.
In the NEHE examples just concentrate on the DrawGLScene method. Look between the glBegin and glEnd commands. Right there is where you put all of your vertices to draw your shapes. Notice after glbegin it says bmquads or glquads. What that means is that every four vertices form a square or rectangle. You can change that to draw triangles lines points or whatever you need. At this time you don't have to worry about the other settings like pixel format and rendering context. You will see a statement called gluperspective in the program. That controls your viewpoint, the vertical angle the field of vision and how far away from the camera. glColor3f changes the color of the vertices. You can set every vertice to a different color. OK that should get you started. Lesson 4 and 5 are almost the same except they rotate and draw 3d images.