Nice n' Easy JQuery Image Rotator
Changing Mailman Python Scripts for Virtual Host Support
Development Resource Project
Book Review: How to Implement Design Patterns in PHP
JQuery Venetian Blinds Transition Effect
Symfony 2 Crash Course

The G3D Library

Sunday, 18 December 05, 12:00 am
G3D is an open source graphics engine that can be used from VC++ 7. This means G3D projects can be developed in VS.NET, and make use of Intellisense and its debugger.

It requires the SDL library, which I've installed OK. G3D is also installed, but the test program isn't as simple as the SDL one, so I have not yet confirmed it is installed and available to VS.NET.

compton

7:00 am, Sunday, 18 December 05

So G3D is installed, and I've managed to follow the tutorial to create my first OpenGL Windows prog!

The tutorial prog is a simple affair, as you would expect, and I've initialised a 3D world with lighting, a sky box and a set of axes. The axes are a simple way to add an object to the world.

Unfortunately, the tutorial says in order to add other objects, such as a rectangle, simply "use methods in G3D::RenderDevice that correspond to similarly-named OpenGL calls you are familiar with".

What could be easier? Except I don't know any OpenGL calls of course. Looks like that's the next task for Google...

compton

7:00 am, Sunday, 18 December 05

Now I have at last managed to create a textured rectangle just below the origin. It didn't help of course that the tutorial had at least one typo, which threw me for ages. Finally sorted it out by looking at the code for the supplied examples.



Creating shapes isn't hard, the tutorial should have showed how it was done using BeginPrimitive()/EndPrimitive(). Basically, you call BeginPrimitive() on your RenderDevice, specifying which primitive you are about to describe, e.g. RenderDevice::QUADS for rectangles, RenderDevice::TRIANGLES for triangles. Then you send the vertices to the Gfx card using sendVertex(Vector3). If you are drawing a textured primitive, you use setTexCoord() to specify the texture co-ordinate to map to each vertex just before calling sendVertex().



So, for a simple textured rectangle, you would have four calls to setTexCoord(), and four to sendVertex(). After these, you call endPrimitive().

compton

7:00 am, Friday, 13 January 06

Undescribed and Poorly Described Methods

  • void G3D::RenderDevice::setProjectionAndCameraMatrix (const class GCamera & camera)

    Could be obvious to those with OpenGL experience, otherwise needs clarifying

  • void G3D::RenderDevice::setLight(...)

    What is the meaning of the first parameter?

  • void G3D::RenderDevice::beginIndexedPrimitives()

    How is usage different to beginPrimitive(), which has an example given in the RenderDevice section?


In general, the methods in the class docs are listed in arbitary order. Some related methods are listed sequentially, however it is confusing and an alphabetical ordering would be preferable. Related methods should be indicated in a 'See Also' section of each method's description.

Please enter your comment in the box below. Comments will be moderated before going live. Thanks for your feedback!

Cancel Post

/xkcd/ Linear Sort