Hello MinGW users,
I'm trying some program sample.
Compile script:
---
rem Compilation: opengl_test.c -> opengl_test.exe
rem 05/12/2012
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o GL01Hello.exe GL01Hello.cpp
---
/*
* GL01Hello.cpp: Test OpenGL C/C++ Setup
*/
#include <windows.h> // For MS Windows
#include <GL/glut.h> // GLUT, includes glu.h and gl.h
/* Handler for window-repaint event. Call back when the window first
appears and
whenever the window needs to be re-painted. */
void display() {
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set background color to
black and opaque
glClear(GL_COLOR_BUFFER_BIT); // Clear the color buffer
// Draw a Red 1x1 Square centered at origin
glBegin(GL_QUADS); // Each set of 4 vertices form a quad
glColor3f(1.0f, 0.0f, 0.0f); // Red
glVertex2f(-0.5f, -0.5f); // x, y
glVertex2f( 0.5f, -0.5f);
glVertex2f( 0.5f, 0.5f);
glVertex2f(-0.5f, 0.5f);
glEnd();
glFlush(); // Render now
}
/* Main function: GLUT runs as a console application starting at main() */
int main(int argc, char** argv) {
glutInit(&argc, argv); // Initialize GLUT
glutCreateWindow("OpenGL Setup Test"); // Create a window with the
given title
glutInitWindowSize(320, 320); // Set the window's initial width &
height
glutInitWindowPosition(50, 50); // Position the window's initial
top-left corner
glutDisplayFunc(display); // Register display callback handler for
window re-paint
glutMainLoop(); // Enter the infinitely event-processing loop
return 0;
}
I have copied:
- GL/glut.h -> C:\MinGW\include
- opengl.lib -> C:\MinGW\lib
- opengl.dll -> app directory
What I see at runtime:
"opengl_test.exe is not a valid Win32 application"
"opengl_test.exe n'est pas une application Win32 valide"
--
*DAHMEN Manuel* manuel.dahmen@... <mailto:manuel.dahmen@...>
http://www.ibiiztera.be
|