GL rendering problem.
by Sam Guffey · in Torque Game Engine · 01/02/2006 (7:59 pm) · 2 replies
In the first picture (Img A) you see the blending of the line correctly, but as soon as another line is created the blending is no longer applied (Img B).
This is a modified version of the 'Bullet Tracers' resource located here
Img A
Img B
What seems to be the issue with this? Do I need to disable anything in particular or vise-versa?
This is a modified version of the 'Bullet Tracers' resource located here
if (mDataBlock->tracerLength > 0)
{
Point3F end = mCurrVelocity;
end.normalize(mClampF((mCurrPosition - mInitialPosition).len(), 1.0, mDataBlock->tracerLength));
// Make sure we have a width no matter what.
F32 tracerWidth = mDataBlock->tracerWidth;
tracerWidth > 0 ? tracerWidth : 0.1f;
glLineWidth(tracerWidth);
glEnable(GL_BLEND);
glBegin(GL_LINES);
// Start..
glColor4fv(mDataBlock->tracerStartColor);
glVertex3fv(mCurrPosition);
end = mCurrPosition - end;
glColor4fv(mDataBlock->tracerEndColor);
glVertex3fv(end);
// End..
glEnd();
glDisable(GL_BLEND);
}Img A

Img B

What seems to be the issue with this? Do I need to disable anything in particular or vise-versa?
About the author
Torque Owner Sam Guffey
I needed to add 'glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)' right before 'glBegin(GL_LINES)'. At one point in time I had it right after the glBegin call and it didnt work, guess you just have to put things in the right place.
Sam