Using GCC (MinGW) to compile OpenGL on Windows

Posted by Casey on Stack Overflow See other posts from Stack Overflow or by Casey
Published on 2010-04-02T17:19:05Z Indexed on 2010/04/02 17:23 UTC
Read the original article Hit count: 313

Filed under:
|
|

I've searched on google and haven't been able to come up with a solution.

I would like to compile some OpenGL programming using GCC. In the GL folder in GCC I have the following headers:

gl.h
glext.h
glu.h

Then in my system32 file I have the following .dll

opengl32.dll
glu32.dll
glut32.dll

If I wanted to write a simple OpenGL "Hello World" and link and compile with GCC, what is the correct process?

I'm attempting to use this code:

#include <GL/gl.h>
#include <GL/glut.h>

void display() {
    glClear(GL_COLOR_BUFFER_BIT);
    glFlush();
}
int main(int argc, char **argv) {
    glutInit(&argc, argv);
    glutInitWindowSize(512,512);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutCreateWindow("The glut hello world program");
    glutDisplayFunc(display);
    glClearColor(0.0, 0.0, 0.0, 1.0);
    glutMainLoop(); // Infinite event loop
    return 0;
 }

Thank you in advance for the help.

© Stack Overflow or respective owner

Related posts about gcc

Related posts about c