A freeglut error: Unable to create direct context

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(&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

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 ?

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

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.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.