Please help me… i want to draw a star in opengl…im have a basic with opengl…im try to do by myself…but…the result is disapointed for me…please check my source code…where part im wrong for this code??..this is the code…
#include <GL/glut.h>
void display (void)
{
glClear (GL_COLOR_BUFFER_BIT);
glLoadIdentity ();
gluLookAt (0.0,0.0,0.5,0.0,0.0,0.0,0.0,1.0,0.0);
glBegin (GL_LINES);
glVertex3f(0.0,0.2,0.0);
glVertex3f(0.1,0.1,0.0);
glVertex3f(0.2,0.05,0.0);
glVertext3f(0.1,0.0,0.0);
glVertex3f(0.2,-0.1,0.0);
glVertex3f(0.0,0.0,0.0);
glVertex3f(-0.2,-0.1,0.0);
glVertex3f(-0.1,0.0,0.0);
glVertex3f(-0.2,0.05,0.0);
glVertex3f(-0.1,0.1,0.0);
glEnd();
glFlush();
}
void keyboard (unsigned char key, int x, int y)
{
if(key == 27)
{
exit(0);
}
}
void reshape (int width, int height)
{
glViewport(0, 0, (GLsizei) width, (GLsizei) height);
glMatrixMode (GL_PROJECTION) ;
glLoadIdentity ();
glOrtho (-1.0,1.0,-1.0,1.0,-1.0,1.0);
glMatrixMode (GL_MODELVIEW);
}
int main(int argc, char **argv)
{
glutInit (&argc, argv);
glutInitWindowSize (800,600);
glutInitWindowPosition (100,100);
glutCreateWindow (“ex4”);
glutDisplayFunc (display);
glutReshapeFunc (reshape);
glutKeyboardFunc (keyboard);
glutMainLoop ();
return 0;
}