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: Shader and texture coordinates computation

Hybrid View

  1. #1
    Intern Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    51

    Shader and texture coordinates computation

    Hello,

    I am discovering that fixed functions concerning textures are not used with shaders...
    I replicated glTexGen using the orange book to test : it works.

    But I have some beginner questions :

    1- Are gl_EyePlane* and gl_ObjectPlane* initialized by glTexGenfv(GL_*, GL_EYE_PLANE, vector) ?
    2- Do I have to send the GLenums used with GlTexEnv and GlTexGen to the shader to know how to manage the texture ?
    3- And a more general question : what are the fixed functions I can use with the shaders ?

    I did not find a simple answer to these questions.
    So I am interested in your advices or good links to read.

    Thanks

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    The general trend in shaders is away from any automatically defined variables. I would recommend loading down the lastest glsl specs (http://www.opengl.org/documentation/glsl/) and having a look at what variables are still defined. Other variables may still be defined for legacy reasons but if you are just starting stick to thoses defined in the specs. You have to load all others in uniforms or shared buffers for yourself.

  3. #3
    Intern Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    51
    Hello Tonyo,

    When you say "having a look at what variables are still defined" you mean the "built-in variables" excluding the "Compatibility Profile Built-In Variables" ? And the built-in variables can be intialized by OpenGl because they still exist. Did I well understand ?

    I think I have to use "compatibility profile variables" because my module have to use an old opengl library... And I am also using GLSL version 110 or 120 so that it works on old graphic cards.

    But here's an example of what is not clear for me :
    uniform mat4 gl_ModelViewMatrix;
    uniform vec4 gl_EyePlaneS[gl_MaxTextureCoords];
    [Edit] These 2 variables are read-only built-in uniforms.[/Edit]
    But my shader receives gl_ModelViewMatrix well initialized and gl_EyePlaneS is not initialized...

    If it is not a bug in my code, how to know which variables can be initialized with fixed functions ?
    Last edited by AllForum; 01-04-2013 at 06:19 AM.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    When you say "having a look at what variables are still defined" you mean the "built-in variables"
    yes

    You still should be able to find the old glsl spec somewhere on www.opengl.org to know what is valid for each version. What "version" are defining in your shaders. That may be effecting the built-in variables since on a modern graphics card there is no fixed pipeline and opengl has to emulate it by loading the variables for you.

  5. #5
    Intern Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    51
    The links on the specs are on the GLSL wiki ( http://en.wikipedia.org/wiki/GLSL ).

    I wrote something wrong in my previous post : the 2 variables are built-in in version 110. Therefore they may be initialized both. So there is something wrong in my code...

    Thanks for your explanations.

  6. #6
    Intern Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    51
    I have a small related question :
    When using shaders the fixed functions are ignored.
    Does it mean that the functions are not run or that the functions are run but the results deleted before calling the shaders ?
    I.e. must I disable a function with a define :
    #ifndef Use_Shader
    glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
    #endif

    or will it done automatically ?

    Thanks


    NB : concerning the previous post the 2 variables were well defines. It was my error...

Posting Permissions

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