PDA

View Full Version : a freeglut error: Unable to create direct context



Jay I
02-05-2008, 10:43 AM
Hi, guys!

I recieve the following error from freeglut each time i run a very simple program:


Unable to create direct context rendering for window 'My First OpenGL Application For Linux'

I'm new to linux and i just set up all things needed for development with OpenGL. The program i mentioned has the following code:



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

void display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}

int main(int argc, char **argv) {
glutInit(&amp;argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGBA);
glutInitWindowPosition((1280-500)/2,(1024-500)/2);
glutInitWindowSize(500,500);
glutCreateWindow("My First OpenGL Application For Linux");
glutDisplayFunc(display);

glClearColor(0.0f,0.0f,1.0f,1.0f);

glutMainLoop();
return 0;
}


Despite the error message the program works fine but i guess it would work slow if it makes something more complex))

I hope you know how to work around this and will share your knowledge with me.

best reguards
Jay I

ZbuffeR
02-05-2008, 12:23 PM
looks like you don't have a hardware accelerated OpenGL driver.
For nvidia, go to their website, they have a good driver for linux.
For ATI/AMD, they should have one too.
Intel is said to be easily included in linux distribs.

What is your video card ?

Jay I
02-05-2008, 02:01 PM
thanks for your advice. now i'm downloading source files for my kernel to compile kernel interface for the driver. it's about 150 Mb so i need to wait before i can get some result)). I'll post my results here when i'm done. So just wait.

P.S. my video card is a built-in GeForce 6150

Jay I
02-06-2008, 06:00 AM
well, i tried to run the intaller but it told me that the kernel sources it found are not for my kernel or version of gcc is defferent from that used to compile my kernel. I checked gcc version - it's 4.2.2, the same that was used to compile my kernel. I set up kernel-source package exactly for my kernel so the sources are valid too. I also pointed to the directory with the sources via --kernel-source option but recieved the same error message. I read nvidia-installer.log and found a message telling that kernel module 'nvidia.ko' has invalid format. Seems that installer still uses sources in /usr/include/linux. I've got no idea how to work around this problem.