Respected SIr / Maam
After Running the given Code on Linux,the following issues Arises.kindly Give solution for these
1: after compiling,the executed window is transparent
this is the code ==>
#include <GL/glut.h>
#include <math.h>
void Soccer_Field (void)
{
float x, y, ang, radius = 0.05;
static float RAD_DEG = 57.296;
glBegin (GL_QUADS);
glColor3f (0.20, 0.60, 0.20); // GreenYard
glVertex2f (0.10, 0.10); glVertex2f (0.90, 0.10);
glVertex2f (0.90, 0.90); glVertex2f (0.10, 0.90);
glColor3f (1.0, 1.0, 1.0);
glVertex2f (0.90, 0.35); glVertex2f (0.83, 0.35); // Inner White Quad - Right
glVertex2f (0.83, 0.65); glVertex2f (0.90, 0.65);
glVertex2f (0.10, 0.35); glVertex2f (0.17, 0.35); // Inner White Quad - Left
glVertex2f (0.17, 0.65); glVertex2f (0.10, 0.65);
glEnd ();
glColor3f (0.0, 0.0, 0.0); // Change color to black
glBegin (GL_LINES);
glVertex2f (0.50, 0.10); glVertex2f (0.50, 0.90); // Mid Line
// Left side of the Ground
glVertex2f (0.25, 0.25); glVertex2f (0.25, 0.75); // Goal keeper front line
glVertex2f (0.10, 0.75); glVertex2f (0.25, 0.75); // Goal keeper left line
glVertex2f (0.10, 0.25); glVertex2f (0.25, 0.25); // Goal keeper right line
// Right Side of the Ground
glVertex2f (0.75, 0.25); glVertex2f (0.75, 0.75); // Goal keeper front line
glVertex2f (0.75, 0.25); glVertex2f (0.90, 0.25); // Goal keeper left Line
glVertex2f (0.75, 0.75); glVertex2f (0.90, 0.75); // Goal keeper right line
glEnd ();
glBegin (GL_LINE_LOOP); // Circle at center of field
for (ang = 0.0; ang < 360.0; ang += 10.0) {
x = radius * cos(ang/RAD_DEG) + 1.0;
y = radius * sin(ang/RAD_DEG) + 0.5;
glVertex2f (x/2.0, y);
}
glEnd ();
}
void Initialize()
{
glClearColor(0.60, 0.40, 0.12, 0.20);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-100, 100, -50, 50, -1, 1);
}
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(Soccer_Field);
glutMainLoop();
return 0;
}