Forums > Jitter

x/y/z axis rendering off/on (default = 0)

April 10, 2007 | 5:51 pm

Dear Josh,

What OpenGL code does what myobject.axes = 1 does?

Thanks, Greg


April 10, 2007 | 6:24 pm

On Apr 10, 2007, at 10:51 AM, Greg Niemeyer wrote:

> What OpenGL code does what myobject.axes = 1 does?

Here’s our C code for this. The line loop stuff is used for the
"units" along each axis.

-Joshua

if (ob3d->axes)
{
// RGB axes utility
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
// x
glBegin(GL_LINES);
glColor3f(4., 0., 0.);
glVertex3f(0., 0., 0.);
glVertex3f(4., 0., 0.);
glEnd();
for (i=1;i<5;i++)
{
glBegin(GL_LINE_LOOP);
glVertex3f(i*1., 0.01, 0.01);
glVertex3f(i*1., 0.01, -0.01);
glVertex3f(i*1., -0.01, -0.01);
glVertex3f(i*1., -0.01, 0.01);
glEnd();
}
// y
glBegin(GL_LINES);
glColor3f(0., 4., 0.);
glVertex3f(0., 0., 0.);
glVertex3f(0., 4., 0.);
glEnd();
for (i=1;i<5;i++)
{
glBegin(GL_LINE_LOOP);
glVertex3f(0.01, i*1., 0.01);
glVertex3f(0.01, i*1., -0.01);
glVertex3f(-0.01, i*1., -0.01);
glVertex3f(-0.01, i*1., 0.01);
glEnd();
}
// z
glBegin(GL_LINES);
glColor3f(0., 0., 4.);
glVertex3f(0., 0., 0.);
glVertex3f(0., 0., 4.);
glEnd();
for (i=1;i<5;i++)
{
glBegin(GL_LINE_LOOP);
glVertex3f(0.01, 0.01, i*1.);
glVertex3f(0.01, -0.01, i*1.);
glVertex3f(-0.01, -0.01, i*1.);
glVertex3f(-0.01, 0.01, i*1.);
glEnd();
}
jit_gl_report_error("ob3d_draw_end axes");
}


Viewing 2 posts - 1 through 2 (of 2 total)