C Graphics using OpenGL - BunksAllowed

BunksAllowed is an effort to facilitate Self Learning process through the provision of quality tutorials.

Community

C Graphics using OpenGL

Share This
Red Hat does not ship native OpenGL libraries but does ship the Mesa libraries: an MIT licensed implementation of the OpenGL specification. You can add the Mesa OpenGL run-time libraries to your system by installing the following package

[root@host ~]# yum install mesa-libGL

To add the Mesa development packages, install the following package:

[root@host ~]# yum install mesa-libGL-devel

Here is a sample Code (Test.c):


#include <GL/glut.h> #include <GL/gl.h> void display() { glClearColor(1,0,0,0); glClear(GL_COLOR_BUFFER_BIT); glFlush(); } void main(int argc, char**argv) { glutInit(&argc, argv); glutInitWindowPosition(100,100); glutInitWindowSize(500,500); glutCreateWindow("Hello World"); glutDisplayFunc(display); glutMainLoop(); }

Compile the program using the following syntax:

#gcc -lGL -lglut -lGLU Test.c -o Test

Finally, run the program:

#./Test

Happy Exploring!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.