Results 1 to 2 of 2

Thread: Attribute not active.

  1. #1
    Junior Member
    Join Date
    Nov 2010

    Attribute not active.


    In reading the book: OpenGL ES 2.0 Programming Guide (Addison-Wesley). And I have read the following:

    "Attribute names that do not exist or are not active in a vertex shader attached to the program object are ignored."

    When an attribute is not active?


  2. #2
    Senior Member
    Join Date
    May 2010

    Re: Attribute not active.

    When the code that uses it is optimized away by the compiler...

    attribute float x ;
    float y, z ;
    y = 6 - (1+2+3) ;
    z = x * y ;

    ...the compiler might manage to optimize that to:

    float y, z ;
    y = z = 0 ;

    ...and now 'x' isn't needed - so it "does not exist" in the compiled binary of the shader.

    Hence a variable that you might have declared and even used throughout the shader may simply not exist at run time. That's why "inactive" variables are treated as if they don't exist...because at the level of the binary shader, they literally don't exist. But you don't want it to be an error to pass a value for that attribute into the shader because very often you run the same mesh data through multiple shaders - some of which may use the attribute and others may not.

Similar Threads

  1. EGL attribute
    By Newbie in forum OpenGL ES
    Replies: 1
    Last Post: 06-27-2011, 04:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean