Silicon
Graphics, Inc. (SGI) began developing OpenGL in 1991 and released it on June
30, 1992; applications use it extensively in the fields of computer-aided
design (CAD), virtual reality, scientific visualization, information
visualization, flight simulation, and video games. Since 2006, OpenGL has been
managed by the non-profit technology consortium Khronos Group.
The OpenGL
specification describes an abstract API for drawing 2D and 3D graphics.
Although it is possible for the API to be implemented entirely in software, it
is designed to be implemented mostly or entirely in hardware. The API is
defined as a set of functions which may be called by the client program,
alongside a set of named integer constants (for example, the constant
GL_TEXTURE_2D, which corresponds to the decimal number 3553). Although the
function definitions are superficially similar to those of the programming
language C, they are language-independent. As such, OpenGL has many language
bindings, some of the most noteworthy being the JavaScript binding WebGL (API,
based on OpenGL ES 2.0, for 3D rendering from within a web browser); the C
bindings WGL, GLX and CGL; the C binding provided by iOS; and the Java and C
bindings provided by Android.
An OpenGL Project:
Solution:#include <gl/glut.h>
void Draw() {
glClearColor(0.98, 0.5, 0.45, 1);
glClear(GL_COLOR_BUFFER_BIT);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glBegin(GL_TRIANGLES);
glColor3f(0.56, 0.56, 0.73);
glVertex2f(0.4, 0.5);
glVertex2f(-0.5, -0.5);
glVertex2f(0.6,
-0.3);
glEnd();
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glBegin(GL_TRIANGLES);
glColor3f(0,0,0);
glVertex2f(0.4, 0.5);
glVertex2f(-0.5, -0.5);
glVertex2f(0.6, -0.3);
glEnd();
glFlush();
}
int main(int iArgc, char** cppArgv) {
glutInit(&iArgc,
cppArgv);
glutInitDisplayMode(GLUT_SINGLE
| GLUT_RGB);
glutInitWindowSize(700,
400);
glutInitWindowPosition(660,
0);
glutCreateWindow("Triangle
With Outline");
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}