General question
2 posters
General question
I'm developing a first person shotter. Which do you think is the best way to implement a crosshair associated to the viewpoint?
Thank you very much!
Thank you very much!
manuelmartinf- Posts : 14
Join date : 2009-09-13
Re: General question
The way I have done this is simply go into landscape 2d(for landscape games) and then draw four lines. here is the code, just remember to go into landscape 2d(see tutorials if you don't know how to do this)
- Code:
glPushMatrix();
{
glTranslatef( sio2->_SIO2window->scl->x * 0.5f,
sio2->_SIO2window->scl->y * 0.5f, 0.0f );
sio2MaterialReset();
glColor4f(1, 1, 0, 1);
glLineWidth(1);
glEnableClientState(GL_VERTEX_ARRAY);
float drawArray[4] = {-35, 0, -10, 0};
glVertexPointer(2, GL_FLOAT, 0, drawArray);
glDrawArrays(GL_LINES, 0, 2);
float drawArray2[4] = {0, -35, 0, -10};
glVertexPointer(2, GL_FLOAT, 0, drawArray2);
glDrawArrays(GL_LINES, 0, 2);
float drawArray3[4] = {35, 0, 10, 0};
glVertexPointer(2, GL_FLOAT, 0, drawArray3);
glDrawArrays(GL_LINES, 0, 2);
float drawArray4[4] = {0, 35, 0, 10};
glVertexPointer(2, GL_FLOAT, 0, drawArray4);
glDrawArrays(GL_LINES, 0, 2);
}
glPopMatrix();
oioioi- Posts : 136
Join date : 2008-12-02
Location : Norway
Re: General question
Thank you!!!
Simple solutions are the best
Simple solutions are the best
manuelmartinf- Posts : 14
Join date : 2009-09-13
Similar topics
» Particles Question
» hi... A noob question..
» Shadow & Shading Issues
» Developing in windows?
» No intended collision with camera
» hi... A noob question..
» Shadow & Shading Issues
» Developing in windows?
» No intended collision with camera
Permissions in this forum:
You cannot reply to topics in this forum