Hello,
I am having a problem with a Glut function which is messed up, either by GCC or by OpenMP.
I have GCC 4.3.1 20080626.
The problem is, that I do not know which of the three is causing the "Segmentation fault" at the glVertex2f() function. The proggie works perfectly when in single-core mode.
I have written a testcase for this:
#include <stdlib.h>
#include <GL/glut.h>
#include <math.h>
#include <omp.h>
void render(void)
{
int loop;
#pragma omp parallel shared(loop)
{
#pragma omp for
for (loop = 0; loop < 100; loop++)
{
printf("DIE\n");
_flushlbf ();
glVertex2f(loop/50.0,loop/50.0);
}
}
glEnd();
glFlush();
}
int main (int *argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition(50,50);
glutInitWindowSize(800,800);
glutCreateWindow("Fallzorz");
glutDisplayFunc(render);
glutMainLoop();
}
Compile with:
gcc -o test test.c -lm -lglut -fopenmp -ggdb
Thanks for any replies.