Recommended Posts

Hello guys... I am new to this Forum ... I am AHmed ...
I am creating a game using OpenGl "glut.h" ...
the game is about shooting target...
and i wished to load pics in to my project. so the targets appear will be from a pic file loaded from my hard disk and can change it's position ...
can some one tell me a simple code to do this.. bec. all the codes i found are hard to understand...
This is my sample code that i am using in my project. not any thing else
"
void main (int argc, char** argv)
{
srand(time(0));
glutInit(&argc,argv);
glutInitWindowSize(W,H);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutCreateWindow("Shooting Targets");
init();
glutDisplayFunc(display);
glutMainLoop();
}
//*************************************************************************
// Functions Definition
//*************************************************************************
void init (void)
{
glClearColor(1.0, 1.0 , 1.0, 1.0);
glColor3f(1.0, 0.0, 0.0);
glPointSize(5.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D (0, W, 0, H);
}
////////////////////////////////////////////////////////////////////////////
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Want to load and draw a picture in this function :)) ..
glFlush();
glutSwapBuffers();
}
"
Thanks you all for ur time ...