Can someone help me with drawing of a line animated?
I found a lot about custom drawing in openGL but I can't find anything that will work with Sparrow.
I'm stuck with the animation; here is the code what I have right now:
(this code is working with 2 single lines)
- (void)render:(SPRenderSupport *)support
{
[super render:support];
paX = 10.0;
paY = 10.0;
pbX = 50.0;
pbY = 50.0;
mRed = 255.0;
mGreen = 0.0;
mBlue = 0.0;
[support bindTexture:nil];
static GLfloat line[4];
line[0] = paX;
line[1] = paY;
line[2] = pbX;
line[3] = pbY;
static GLfloat line2[4];
line2[0] = pbX;
line2[1] = pbY;
line2[2] = 100.0;
line2[3] = 100.0;
glColor4f(mRed, mGreen, mBlue, self.alpha);
glLineWidth(4.0);
glVertexPointer(2, GL_FLOAT, 0, line);
glVertexPointer(2, GL_FLOAT, 0, line2);
glEnableClientState(GL_VERTEX_ARRAY);
glDrawArrays(GL_LINES, 0, 4);
glDisableClientState(GL_VERTEX_ARRAY);
}
As you can see, I draw two lines but in the future this can be like 100..
Can someone put me on the right direction? Don't know where to start.
I need to draw a laser in my game, if someone know's an easier solution: BRING IT ON!
Thanks in advance!