Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

How can I enable OpenGL 3.x functionality via extensions? I'm new to OpenGL development under Linux. Currently I have:

#define GL_GLEXT_PROTOTYPES
#include <GL/osmesa.h>
#include <GL/glu.h>

My problem with Mesa and OpenGL 2.x is that I get an OpenGL "invalid value" error here:

glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, width, height, 0, GL_RGBA, GL_FLOAT, NULL );

because of GL_RGBA32F_ARB, it seems.

Background: I need the texture for a framebuffer object, and GL_RGBA32F_ARB for float data without clamping. My program works well using OpenGL 3.0 if I create the context with GLX.

share|improve this question

1 Answer 1

I think that it's better to use GLEW to export all the extensions functionality. It's cross platform and allows you to write conditional code for different configurations.

share|improve this answer
    
I tried glew now: #include <GL/glew.h> #ifndef GLAPI #define GLAPI extern #endif #include <GL/osmesa.h> #include <GL/glu.h> | I have to (re-)define GLAPI because glew undefines it at the end of the header and gl.h it not included again in the osmesa.h. I found that in a forum post. | Result: still not successfull with GL_RGBA32F_ARB. Additionally, my shaders now do not compile successfully. If relevant: I have Debian Wheezy with Mesa 8.0.5 and Glew 1.7. –  dmohr Aug 1 '14 at 11:45
    
Have you initialized glew as shows glew's homepage? –  Adrián Arroyo Calle Aug 1 '14 at 18:02
    
I did. I already use glew for the windows version of my application. I just removed the #ifdef WIN32 line(s). I can recheck on monday if there is something different on linux. –  dmohr Aug 2 '14 at 16:59
    
According to the glew homepage, there is no difference between windows and linux. So glew initialization/usage should not be the problem. :( –  dmohr Aug 5 '14 at 8:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.