Hey Sir/Maam,
I am a beginner at openGL and have facing a problem in my project.Project is about to make a Football Ground in OpenGL.after a very hardworking i just made 80% of it.
Center Circle in the field and center filled circles in front of each goals is missing.Kindly help me to draw these stuff.Bundles Of Thanks!
Here is the Code:
==> check this is the Project
#include <GL/glut.h>
void Draw()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.33, 1.0, 0.50);
glBegin(GL_QUAD_STRIP);
glVertex3f(0.1, 0.1, 0.0);
glVertex3f(0.1, 0.9, 0.0);
glVertex3f(0.9, 0.1, 0.0); //GreenYard Vertex
glVertex3f(0.9, 0.9, 0.0);
glEnd();
glFlush();
glBegin(GL_LINES);
glColor3f(0.0, 0.0, 0.0);
glVertex3f(0.5, 0.1, 0.0); //Mid Line ( Ground Divider )
glVertex3f(0.5, 0.9, 0.0);
glEnd();
glFlush();
// left side of the Ground
glBegin(GL_LINES);
glColor3f(0.0, 0.0, 0.0);
glVertex3f(0.25, 0.25, 0.0); // Goal keeper Front line
glVertex3f(0.25, 0.75, 0.0);
glEnd();
glFlush();
glBegin(GL_LINES);
glColor3f(0.0, 0.0, 0.0);
glVertex3f(0.1, 0.75, 0.0); //Goal Keeper left Line
glVertex3f(0.25, 0.75, 0.0);
glEnd();
glFlush();
glBegin(GL_LINES);
glColor3f(0.0, 0.0, 0.0);
glVertex3f(0.1, 0.25, 0.0); //Goal Keeper Right Line
glVertex3f(0.25, 0.25, 0.0);
glEnd();
glFlush();
glBegin(GL_QUAD_STRIP);
glColor3f(1, 1, 1);
glVertex3f(0.1, 0.35, 0.0);
glVertex3f(0.1, 0.65, 0.0); //Inner White Quad
glVertex3f(0.17, 0.35, 0.0);
glVertex3f(0.17, 0.65, 0.0);
glEnd();
glFlush();
// Right Side of the Ground
glBegin(GL_LINES);
glColor3f(0.0, 0.0, 0.0);
glVertex3f(0.75, 0.25, 0.0); //Goal Keeper front line
glVertex3f(0.75, 0.75, 0.0);
glEnd();
glFlush();
glBegin(GL_LINES);
glColor3f(0.0, 0.0, 0.0);
glVertex3f(0.75, 0.25, 0.0); //Goal Keeper Left Line
glVertex3f(0.9, 0.25, 0.0);
glEnd();
glFlush();
glBegin(GL_LINES);
glColor3f(0.0, 0.0, 0.0);
glVertex3f(0.75, 0.75, 0.0); //Goal Keeper ki Right wali line
glVertex3f(0.9, 0.75, 0.0);
glEnd();
glFlush();
glBegin(GL_QUAD_STRIP);
glColor3f(1, 1, 1);
glVertex3f(0.9, 0.35, 0.0);
glVertex3f(0.9, 0.65, 0.0);
glVertex3f(0.83, 0.35, 0.0); //Inner White Quad
glVertex3f(0.83, 0.65, 0.0);
glEnd();
glFlush();
}
void Initialize()
{
glClearColor(0.60, 0.40, 0.12, 0.20);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
int main(int iArgc, char** cppArgv)
{
glutInit(&iArgc, cppArgv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(900, 450);
glutInitWindowPosition(200, 200);
glutCreateWindow(“Football Ground OpenGL”);
Initialize();
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}