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

Thread: Shader Objects Types

  1. #1
    Advanced Member Frequent Contributor
    Join Date
    May 2001
    Posts
    573

    Shader Objects Types

    Do shader objects attached to the same program have to be of the same type only vertex or fragment shaders exclusively?

    I got a working/compiled vertex shader, but when i attach even an empty trivial fragment shader i get a link error, with no specific log info.

  2. #2
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,119

    Re: Shader Objects Types

    Shader program can bind many shaders of different types.
    Make sure you matched varying variables between shaders at different stages.
    Furthermore make sure you do not use too many varying variables.

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    May 2001
    Posts
    573

    Re: Shader Objects Types

    Then what could be wrong with this crashing at program link with no specific error from log info???

    Code :
    uniform sampler2D baseTexSamp;
    uniform sampler2D bumpTexSamp;
     
    //varying vec3 fragNormal;
    //varying vec3 lightDir;
     
    void main() 
    {
        //float f = dot(normalize(lightDir), normalize(fragNormal));
     
    	//gl_FragData[0] = vec4(clamp(f, 0.0, 1.0) * texture2D(baseTexSamp, vec2(gl_TexCoord[0])));
     
    	gl_FragColor = vect4(texture2D(baseTexSamp, gl_TexCoord[0].st));
    }

    No vertex shader assigned, only this fragment.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Dec 2007
    Location
    Brighton, UK
    Posts
    156

    Re: Shader Objects Types

    from a quick view : you have a typo , vect4 -> vec4.

    And you don't need to wrap it around vec4 at all since texture2D returns a vec4.

Posting Permissions

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