Game Development Community

dev|Pro Game Development Curriculum

GLU quadrics for Torque

by James \"Corvidae\" Williams · 03/01/2003 (4:42 pm) · 23 comments

Download Code File

In working on a yet-unannounced project, I discovered that I needed to be able to draw rings, disks, and other primitives. However, the stock GLU library conflicted with DGL and wouldn't work. Therefore, I took it upon myself to port the portions of GLU I needed to Torque, so they could be used.

Installation:
-------------

* Copy the three source files from the zip into your engine/dgl directory and add them to the project.
* Recompile.

Usage:
------

Here's the code to use gluDisk, as seen in the screenshot (in ShapeBase::renderObject):

static GLUquadricObj *quadric = gluNewQuadric();

glPushMatrix();
dglMultMatrix(&getRenderTransform());
gluQuadricDrawStyle(quadric, GL_FILL);
gluQuadricNormals(quadric, GL_SMOOTH);
glColor3f(0, 1, 0);
gluDisk(quadric, 0.9, 1.1, 32, 1);
glPopMatrix();

Currently only disks, partial disks, and spheres are supported. I can add more, if there's demand for them.
Page«First 1 2 Next»
#21
04/02/2007 (9:45 am)
@Sander: Where and how are you implementing the disks?
I've just implemented this in conjunction with the Object Selection resource, and it works beautifully.
#22
07/09/2008 (6:19 pm)
GLU quadrics are working great for my shield rings, but how do you add alpha blending? I trying changing the Color3F to Color4F (with added alpha) to no avail. 100% alpha is just too harsh.
#23
08/22/2008 (10:05 pm)
@Cyberkada, I think you'll have to do the Torque equivelent to "glEnable(GL_BLEN)" for the alpha paramater to have any effect. The Torque version is probably something like dglEnable(). I'd push this attribute on the stack before setting it, then pop it back off after your render to make sure you restore the rendering state back to what it was before you rendered.
Page«First 1 2 Next»