Hi
I tried to run a very simple test program (example 1.2 from the red book). It compiles fine and falls flat on its face once run complaining about memory overflow.
This same program run fine in Mandriva 2009. To elimionate typos I transferred the source file from Mandriva to Suse and it compiled fine and died the same way. Mandriva uses different GLUT (MesaGLUT or something, but not freeglut).
Code is very simple
#include <GL/glut.h>
#include <stdlib.h>
void display(void)
{
/* clear all pixels */
glClear(GL_COLOR_BUFFER_BIT);
/*draw white polygon (rectangle) with corner at
* (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)
*/
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.75, 0.25, 0.0);
glVertex3f(0.75, 0.75, 0.0);
glVertex3f(0.25, 0.75, 0.0);
glEnd();
/* Don't wait
* start processing buffered OpenGL routines
*/
glFlush();
}
void init(void)
{
/* select clearing (background) color */
glClearColor(0.0, 0.0, 0.0, 0.0);
/* initialize viewing values */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
/*
* Declare initial window size, position and display mode
* (single buffer and RGBA). Open window with "Hello"
* in its title bar. Call initialization routines.
* Register callback function to display graphics.
* Enter main loop and process events.
*/
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);
glutCreateWindow("Hello");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
Compilation was done with this command
gcc helloMd.c -lglut -Wall -g -o helloMd
The backtrace of it points to libGL:
#0 0xb7de7f72 in ?? () from /usr/lib/libGL.so.1
#1 0xb7dc76cc in glXMakeCurrentReadSGI () from /usr/lib/libGL.so.1
#2 0xb7f9a386 in fgOpenWindow () from /usr/lib/libglut.so.3
#3 0xb7f985ef in fgCreateWindow () from /usr/lib/libglut.so.3
#4 0xb7f99ae5 in glutCreateWindow () from /usr/lib/libglut.so.3
#5 0x08048a84 in main (argc=-1214448324, argv=0x1) at helloMd.c:51
I have pretty vanilla Suse 11.1. Hardware is AMD 64X2 4400+, 4 GB RAM, Ati 3650 graphics card with 512 MB DDR2.
Now I’ve seen others complaining about it, but (I think) all got their problem solved by installing graphics card drivers and (probably) afterwards using different OpenGL-implementation by their graphics card manufacturer (nVidia at least). So is this default libGL-library broken or something? Or am I supposed to load Ati-drivers? I would like to continue to use these open source things.
Thanks in advance for any information.