OpenGL Shader Builder, Lion, and GLSL 1.50

Howdy,
Has anyone figured out how to get OpenGL Shader Builder to accept GLSL 1.5 syntax under Lion? If not, what do people use to develop and test shaders on the mac side? I could always use something like Text Wrangler, but I would miss the real-time code checking.

OpenGL Shader Builder has been deprecated for some time. It probably hasn’t been updated to acquire an OpenGL 3.2 context under Lion.

GLSLEditorSample is the replacement AFAIK.

Great, I’ll see if I can track that utility down.

Thanks for your help.

So it looks like GLSLEditorSample no longer exists in Apple’s sample code repository; I doubt it has support for post Opengl 2 shader syntax anyway. For now I will just write the shaders in something like Xcode or TextWrangler and debug them manually during the compile stage.

Which leads me to my next problem. Here is the basic Fragment shader I am trying to compile:


#version 140

uniform vec3    MortarColor, BrickColor;
uniform vec2    BrickSize;
uniform vec2    BrickPct;

in vec2         MCposition;
in float        LightIntensity;

out vec4 FragColor;

void main()
{
    vec3 color;
    vec2 position, useBrick;
    
    position = MCposition / BrickSize;
    
    if(fract(position.y * 0.5) > 0.5)
        position.x+=0.5;
    
    position=fract(position);
    
    useBrick = step(position, BrickPct);
    
    color = mix(MortarColor, BrickColor, useBrick.x * useBrick.y);
    color *= LightIntensity;
    
    FragColor = vec4(color,1.0);
}

Compilation fails with the following log output:

ERROR: 0:4: 'premature EOF' : syntax error syntax error

I don’t see any syntax errors, nor any errant EOF characters. Is there anybody out there who might know why I keep getting this error?

Thanks.

Perhaps your shader loader is broken?

Set a breakpoint on glShaderSource, then inspect **string (note: pointer to char *).

No, I’ve traced the problem to how I’m deriving cStrings from Cocoa. I’ve got a separate loader in C++ that handles the files just fine. I was using a Cocoa setup until I had gotten SDL 1.3 to properly initialize OpenGL 3.2 for Lion, which I have just figured out.

My guess is that I did something improperly with the text encoding when I pulled the cString from the NSString. I did a memory dump of the cString (as you suggested above), and didn’t see anything out of the ordinary (no strange byte codes or anything).

Thank you for your suggestion. Now that I have my preferred solution, I’ll put the cocoa-based loader on the back burner.

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