Reputation: 1153
I'm trying to create a simple OpenGL 3.2 core profile application on OS X. I'm using SDL2 via Macports, but I doubt that matters. My understanding is that I should be using GLSL #version 150
and my trivial fragment shader currently looks like this:
#version 150
out vec4 outputF;
void main() {
outputF = vec4(1.0, 0.0, 0.0, 1.0);
}
Now I believe I need to tell OpenGL that the fragment color is being set in outputF
via the glBindFragDataLocation
function. The problem is that it doesn't seem to be declared anywhere. Is this function not available in the 3.2 core profile (contrary to my searching), or am I missing a header file, or what?
Upvotes: 1
Views: 2127
Reputation: 22358
If you're on OS X, you include the <OpenGL/gl3.h>
header for the GL 3.2 (core) profile. As part of the OpenGL framework, it is to be found in:
/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h
If you are writing the fragment to the default framebuffer, you don't need this call. That is, outputF
will be bound to the 'color number' (0)
by default. IIRC, you can call this out
variable anything you please, so long as it doesn't begin with the reserved gl_
prefix.
I'm haven't tried out SDL2 yet - but you might want to add #define GL3_PROTOTYPES
first, e.g.,
#define GL3_PROTOTYPES
#if defined (__APPLE_CC__)
#include <OpenGL/gl3.h>
#else
#include <GL/glcorearb.h> // assert GL 3.2 core profile available...
#endif
Upvotes: 4