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 8 of 8

Thread: About GLSL shader compile error

  1. #1
    Intern Contributor
    Join Date
    May 2007
    Posts
    52

    About GLSL shader compile error

    I used cgc 2.0 to compile glsl vertex shader,and return the down information:
    multiTex.glslv(25) : error C7506: OpenGL does not define the global function dot
    multiTex.glslv(25) : error C7506: OpenGL does not define the global function max

    I dont know why the error occured.
    help!!!
    My code as down:

    Code :
    #version 120
    varying vec3 normal;
    varying vec3 V;
    uniform vec4 ambientDiffuse;
    uniform vec4 lightDiffuse;
     
    void main()
    {
        vec4 texCoord[]={gl_MultiTexCoord0,gl_MultiTexCoord1,
                         gl_MultiTexCoord2,gl_MultiTexCoord3,
                         gl_MultiTexCoord4,gl_MultiTexCoord5,
                         gl_MultiTexCoord6,gl_MultiTexCoord7};
     
        gl_Position=gl_ModelViewProjectionMatrix*gl_Vertex;
     
        for(int i=0;i<gl_MaxTextureCoords;i++)
        {
            gl_TexCoord[i]=texCoord[i];
        }
     
        normal=normalize(gl_NormalMatrix*gl_Normal);
     
        V=normalize((gl_ModelViewMatrix*gl_Vertex-gl_LightSource[0].position).xyz);
     
        gl_FrontColor=max(dot(normal,V),0.0)*ambientDiffuse*lightDiffuse;
    }
    and I set the *.bat file like this:
    Code :
    cgc -profile glslv -entry main -oglsl -o asm.txt -l cInfo.txt multiTex.glslv

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,575

    Re: About GLSL shader compile error

    cgc is a Cg tool.
    According to this :
    http://lists.apple.com/archives/Mac-.../msg00068.html
    it is not very robust.

    You may try GLSL Validate :
    http://developer.3dlabs.com/download...date/index.htm

  3. #3
    Intern Contributor
    Join Date
    May 2007
    Posts
    52

    Re: About GLSL shader compile error

    Thanks ,but cgc 2.0 supported leave context(background) compiler for GLSL.I used it compile many GLSL shader and all passed through before I reinstalled system.

  4. #4
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Jul 2000
    Location
    S41.16.25 E173.16.21
    Posts
    2,407

    Re: About GLSL shader compile error

    are u parsing it correctly?

    also nvidia cards (not sure about the nv80)
    only allow 32varying floats

    gl_TexCoord[i]=texCoord[i]; equals 4 floats
    (4*8 texture units = 32 + then add the normal + V + youll run into the message max varyings exceeded)

  5. #5
    Intern Contributor
    Join Date
    May 2007
    Posts
    52

    Re: About GLSL shader compile error

    Varying floats?Not problem with it.See the compiler error:
    Code :
    multiTex.glslv(25) : error C7506: OpenGL does not define the global function dot
    multiTex.glslv(25) : error C7506: OpenGL does not define the global function max

  6. #6
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,453

    Re: About GLSL shader compile error

    cgc -profile glslv -entry main -oglsl -o asm.txt -l cInfo.txt multiTex.glslv
    Why are you compiling a GLSL source to a GLSL profile?
    I would have expected arbvp1, vp30, or vp40 as profile.

    And you should really not use your texCoord array this way.
    It would break if gl_MaxTexCoords > 8 because you hardcoded eight MultiTexCoord into the array. Just assign them manually, that's the simplest way to get it right.
    And when compiling this to an assembly profile you will see that you will run out of varyings with eight gl_TexCoords plus two vec3 varyings.

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Sep 2004
    Location
    Prombaatu
    Posts
    1,386

    Re: About GLSL shader compile error

    "also nvidia cards (not sure about the nv80)
    only allow 32varying floats"

    G80 reports a whopping 60.

  8. #8
    Intern Contributor
    Join Date
    May 2007
    Posts
    52

    Re: About GLSL shader compile error

    It not passed through also after I changed the number of gl_MultiTexCoord form 8 to 4 and return the same error that:the function "dot" and "max" not defined in GL

Posting Permissions

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