Game Development Community

Line rendering in 3rd space

by Vladimir Kavoun · in Torque Game Engine · 05/30/2007 (9:24 pm) · 0 replies

I know this is a reoccuring thread, I have been looking around with no results. I would like to render a line from a basic models eye location to a location some 5 units away. I am planning for this to act as a crosshair so this code is going into OnRender in guiCrosshairHud. This is what I've been attempting to draw the line:

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glColor3f(0.0f,1.0f,1.0f);
glLineWidth(5.0f);
glBegin(GL_LINES);

glVertex3f(endPointHead.x,endPointHead.y,endPointHead.z);
glVertex3f(camPos.x,camPos.y,camPos.z);
glEnd();

glLineWidth(1.0f);
glDisable(GL_BLEND);

line width of 5 was just something for testing.