Advertisement

I need OpenGL 1.4, but only 1.3 available?

Started by October 31, 2006 03:01 PM
2 comments, last by erissian 18 years, 2 months ago
Hi, first fglrxinfo: OpenGL vendor string: ATI Technologies Inc. OpenGL renderer string: RADEON 9600 XT Generic OpenGL version string: 2.0.6065 (8.29.6) My graphics card should be OpenGL 2.0 capable (?) (I am not sure what that version string already tells). But I get only OpenGL 1.3. I am currently using D lanugage and Derelict, I ask this here because I think it is not Derelict issue. As I understand Derelict tries to load all functions and if it succeeds it gives 1.4 status. But when it tries to load 1.4 it throws exception inside: Failed to load proc glBlendFuncSeparate from shared library libGL.so That exception I captured above says that function was not found from libGL.so.. I am not sure who provides this libGL.so and if so where can I get update? I am using Ubuntu Edgy. Not sure if this is driver or dev file issue. As I see it, what I need (GLSL) are available as EXT or ARB extensions, but I need to use official functions (without ARB I mean). And you cannot get official funtions as extensions? Or are they only available as ARB extensions on Linux? Would NVIDIA provide better on Linux? If someone can actually use OpenGL 2.0 (or at least 1.4) and has simple c++ test or advice, I would really appreciate any help. Thank you in advance.
Three things:

1. Your video card manufacturer likely provides OpenGL along with its drivers. If you have NVIDIA, then you're in luck. Download the latest driver, and run it with the flag --help to see the options. One of them should be something like --with-opengl

2. Failing that, you can get the libraries as part of mesalib. Download both the OpenGL and GLUT packages, and untar them both before building.

3. Make sure that you don't have two versions installed. This has screwed me up in the past. Check both /usr and /usr/local for OpenGL installations.
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)
Advertisement
Thanks, it was a mess.

Finally I think it is derelict problem, because I get OpenGL 2.0 with glew. So I need to consider using c++ instead.

But another problem with this simple attempt to complile shader. Linux totally freezes on glCompileShader call! Need to reset mecanichally.

If anyone could test this source, I think it should be ok, it is mostly from ATI example. This uses ARB extensions but it was same with 2.0 functions.

#include <SDL/SDL.h>#include <GL/glew.h>bool loadShader( GLhandleARB shader, char* fn){   FILE *fp;   GLubyte *buf;   int length;   bool ret = true;   if (!(fp = fopen(fn,"rb")))   {      return false;   }   fseek(fp, 0, SEEK_END);   length = ftell(fp);   fseek(fp, 0, SEEK_SET);   buf = new GLubyte[length+1];   fread( buf, 1, length, fp);   buf[length] = '\0'; // make it a regular C string so str* functions work   glShaderSourceARB( shader, 1, (const char**)&buf, &length);   if (glGetError() != 0)   {      ret = false;   }   fclose(fp);   delete []buf;   return ret;}GLboolean compileShader( GLhandleARB shader){   GLcharARB *infoLog;   GLint      infoLogLength;   GLint      compileStatus;      glCompileShaderARB(shader); // This freezes computer!!    glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &compileStatus);   glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &infoLogLength);    printf("Compile status:\n%d\n\n", compileStatus);   if (infoLogLength)   {       infoLog = (GLcharARB *) malloc(infoLogLength);       glGetInfoLogARB(shader, infoLogLength, NULL, infoLog);       printf("Info Log:\n%s\n\n", infoLog);       free(infoLog);   }   return compileStatus;}GLboolean linkProgram( GLhandleARB program){   GLcharARB *infoLog;   GLint      infoLogLength;   GLint      linkStatus;   glLinkProgramARB(program);   glGetObjectParameterivARB(program, GL_OBJECT_LINK_STATUS_ARB, &linkStatus);   glGetObjectParameterivARB(program, GL_OBJECT_INFO_LOG_LENGTH_ARB, &infoLogLength);   printf("Link status:\n%d\n\n", linkStatus);   if (infoLogLength)   {       infoLog = (GLcharARB *) malloc(infoLogLength);       glGetInfoLogARB(program, infoLogLength, NULL, infoLog);       printf("Info Log:\n%s\n\n", infoLog);       free(infoLog);   }   return linkStatus;}int main(int argc, char **argv){  SDL_Init(SDL_INIT_VIDEO);  atexit(SDL_Quit);    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );    int videoFlags  = SDL_OPENGL | SDL_GL_DOUBLEBUFFER | SDL_HWSURFACE | SDL_HWACCEL;    SDL_SetVideoMode(800, 600, 32, videoFlags);  SDL_WM_SetCaption("OpenGL 2.0 Test", NULL);  SDL_ShowCursor(true);    GLenum err = glewInit();  if (GLEW_OK != err)  {    fprintf(stderr, "Error: %s\n", glewGetErrorString(err));    return 0;  }  fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));    if (GLEW_VERSION_2_0)     fprintf(stdout, "Yay! OpenGL 2.0 is supported!\n");  else {    fprintf(stdout, "Yay! OpenGL 2.0 is not supported!\n");    return 0;  }    GLchar* vsFile = "brick.vert";  GLchar* fsFile = "brick.frag";  GLuint vShad;  GLuint fShad;  GLuint gl2Program;  GLint gl2ProgramStatus;  vShad = glCreateShaderObjectARB( GL_VERTEX_SHADER_ARB );  fShad = glCreateShaderObjectARB( GL_FRAGMENT_SHADER_ARB );  gl2Program = glCreateProgramObjectARB();  glAttachObjectARB( gl2Program, vShad );  glAttachObjectARB( gl2Program, fShad );  if (!loadShader( vShad, vsFile)) {     printf("Warning: unable to load vertex shader file \"%s\"", vsFile);  }  if (!loadShader( fShad, fsFile)){     printf("Warning: unable to load fragment shader file \"%s\"", fsFile);  };  printf("Compiling vertex shader: '%s'\n", vsFile);  compileShader( vShad );  printf("Compiling fragment shader: '%s'\n", fsFile);  compileShader( fShad );  printf("Linking program\n");  gl2ProgramStatus = linkProgram( gl2Program );    return 0;}


To build (requires SDL and GLEW):
g++ -c -o gl2test.o gl2test.cppgcc -g -o gl2test gl2test.o -lm -lGL -lGLU -lSDL -lGLEW

Sorry, shaders are beyond my experience.

You may want to consider opening a new thread in the OpenGL forum.
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)

This topic is closed to new replies.

Advertisement