More trouble with Mesa3d
Well I finaly got my src code to compile w/o errors, but now I can't execute my binary.
my src:
//glInit.cpp
#include <SDL/SDL.h>
#include <stdio.h>
#include <stdlib.h>
#include <GL/gl.h>
int main()
{
int i;
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
printf("Error %s\n", SDL_GetError());
return 1;
}
atexit(SDL_Quit);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 6);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
if(SDL_SetVideoMode(640, 480, 16, SDL_OPENGL) == NULL)
{
printf("Error: %s\n", SDL_GetError());
return 1;
}
SDL_WM_SetCaption("OpenGL with SDL!", "OpenGL");
glViewport(80, 0, 480, 480);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 100.0);
glClearColor(0, 0, 0, 0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(1.0, 0, 0);
glVertex3f(0.0, 1.0, -2.0);
glColor3f(0, 1.0, 0);
glVertex3f(1.0, -1.0, -2.0);
glColor3f(0, 0, 1.0);
glVertex3f(-1.0, -1.0, -2.0);
glEnd();
glFlush();
SDL_GL_SwapBuffers();
SDL_Delay(5000);
return 0;
}
[fatherg@localhost gl]$ g++ -o glInit glInit.cpp -l GL -l GLU `sdl-config --cflags --libs`
[fatherg@localhost gl]$ ./glInit
Error: Couldn't find matching GLX visual
I'm still researching the error msg, but if anyone knows whats wrong and can just tell me that'd be even better.
thx
specs:
Redhat 9
Celeron 2.8Ghz
768MB DDR
nVidia GeForce FX 5900 128MB
|