Please Help Me With Basic OpenGL Runtime Issues

I just bought myself a new computer (from ZaReason) for graduate school courses which teach OpenGL. But I can’t get even a basic “Draw Square” program to run correctly. The source code for this simple program was downloaded from my professor’s web site, so I know it should work unmodified. It compiles and links without error, but it gives the following error upon execution:

freeglut (square): ERROR: Internal error <FBConfig with necessary capabilities not found> in function fgOpenWindow
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 4 (X_DestroyWindow)
Resource id in failed request: 0x0
Serial number of failed request: 33
Current serial number in output stream: 36

I’m using Linux Mint 11, with an Nvidia GTS 450 GPU. All GPU drivers were installed by the computer manufacturer, and I installed the following software suggested by my professor:

g++
libglut3-dev 3.7-25
libglew1.5
libglew1.5-dev

The build command I’m using is:

gcc square.cpp -o square -I/usr/include -L/usr/lib -lglut -lGL -lGLU -lX11

The source code for the program is:

////////////////////////////////////////////////////

// square.cpp

//

// Stripped down OpenGL program that draws a square.

//

// Sumanta Guha.

////////////////////////////////////////////////////

#include <iostream>

#ifdef APPLE

include <GLUT/glut.h>

#else

include <GL/glut.h>

#endif

using namespace std;

// Drawing (display) routine.

void drawScene(void)

{

// Clear screen to background color.

glClear(GL_COLOR_BUFFER_BIT);

// Set foreground (or drawing) color.

glColor3f(0.0, 0.0, 0.0);

// Draw a polygon with specified vertices.

glBegin(GL_POLYGON);

  glVertex3f(20.0, 20.0, 0.0);

  glVertex3f(80.0, 20.0, 0.0);

  glVertex3f(80.0, 80.0, 0.0);

  glVertex3f(20.0, 80.0, 0.0);

glEnd();

// Flush created objects to the screen, i.e., force rendering.

glFlush();

}

// Initialization routine.

void setup(void)

{

// Set background (or clearing) color.

glClearColor(1.0, 1.0, 1.0, 0.0);

}

// OpenGL window reshape routine.

void resize(int w, int h)

{

// Set viewport size to be entire OpenGL window.

glViewport(0, 0, (GLsizei)w, (GLsizei)h);

// Set matrix mode to projection.

glMatrixMode(GL_PROJECTION);

// Clear current projection matrix to identity.

glLoadIdentity();

// Specify the orthographic (or perpendicular) projection,

// i.e., define the viewing box.

glOrtho(0.0, 100.0, 0.0, 100.0, -1.0, 1.0);

// Set matrix mode to modelview.

glMatrixMode(GL_MODELVIEW);

// Clear current modelview matrix to identity.

glLoadIdentity();

}

// Keyboard input processing routine.

void keyInput(unsigned char key, int x, int y)

{

switch(key)

{

  // Press escape to exit.

  case 27:

     exit(0);

     break;

  default:

     break;

}

}

// Main routine: defines window properties, creates window,

// registers callback routines and begins processing.

int main(int argc, char **argv)

{

// Initialize GLUT.

glutInit(&argc, argv);

// Set display mode as single-buffered and RGB color.

glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);

// Set OpenGL window size.

glutInitWindowSize(500, 500);

// Set position of OpenGL window upper-left corner.

glutInitWindowPosition(100, 100);

// Create OpenGL window with title.

glutCreateWindow(“square.cpp”);

// Initialize.

setup();

// Register display routine.

glutDisplayFunc(drawScene);

// Register reshape routine.

glutReshapeFunc(resize);

// Register keyboard routine.

glutKeyboardFunc(keyInput);

// Begin processing.

glutMainLoop();

return 0;

}

this sounds like your gpu driver is not instsalled correctly or was not updated with a linux mint kernel update.

does glxgears fail withthe same error?

to debug the problem and give more info please run


glewinfo | less

and post the top few lines that tell about your gpu.

i am on ubuntu so these instruction may not apply to linux mint but what i do to update the nvidia driver is


download from nvidia.com latestdriver foo.run
sudo service gdm stop
sudo sh foo.run
sudo service gdm start

But for you I would read linux mint forum on how to reinstall nvidia driver. Above would probably work but if you are not comfortable with the command line then it is better to do it the “linux mint way” which i am not familiar with . . .

ps foo.run is to be replaced by actual name of current nvidia driver file name presenty available

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