Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: OpenGL Shader Builder, Lion, and GLSL 1.50

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2011
    Posts
    11

    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.

  2. #2
    Intern Contributor
    Join Date
    Oct 2002
    Posts
    81

    Re: OpenGL Shader Builder, Lion, and GLSL 1.50

    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.

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2011
    Posts
    11

    Re: OpenGL Shader Builder, Lion, and GLSL 1.50

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

    Thanks for your help.

  4. #4
    Junior Member Newbie
    Join Date
    Jun 2011
    Posts
    11

    Re: OpenGL Shader Builder, Lion, and GLSL 1.50

    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:

    Code :
    #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:
    Code :
    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.

  5. #5
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    676

    Re: OpenGL Shader Builder, Lion, and GLSL 1.50

    Perhaps your shader loader is broken?

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

  6. #6
    Junior Member Newbie
    Join Date
    Jun 2011
    Posts
    11

    Re: OpenGL Shader Builder, Lion, and GLSL 1.50

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •