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

Thread: matrix from gl to glsl

  1. #1
    Intern Newbie
    Join Date
    Apr 2004
    Posts
    45

    matrix from gl to glsl

    .. i'm using gl_TextureMatrix[0] to catch a matrix from gl .. its working pretty well, but the index correnponds on the bound texture .. thats sucks .. any ideas ???

  2. #2
    Intern Newbie
    Join Date
    Apr 2004
    Posts
    45

    Re: matrix from gl to glsl

    ok .. i'm using gl_modelviewmatrix .. a little bit stupid .. but it works ..

  3. #3
    Junior Member Regular Contributor
    Join Date
    May 2003
    Location
    Germany
    Posts
    229

    Re: matrix from gl to glsl

    Is it so hard to take a look at the glsl-specs? There are plenty of matrices predefined (although there could be some more like in ARB_VP/ARB_FP) :
    • mat4 gl_ModelViewMatrix
    • mat4 gl_ModelViewMatrix
    • mat4 gl_ProjectionMatrix
    • mat4 gl_ModelViewProjectionMatrix
    • mat3 gl_NormalMatrix
    • mat4 gl_TextureMatrix[gl_MaxTextureCoordsARB]

    P.S. : Why is using gl_ModelViewMatrix stupid?

  4. #4
    Intern Newbie
    Join Date
    Apr 2004
    Posts
    45

    Re: matrix from gl to glsl

    because i'm using a two pass shader and need the matrix in both passes. when i'm using the modelMatrix i have to pop after my first pass for drawing my scenen .. if i could store in textureMatrix and haven't this problems .. but i'm not sure, how i can maniuplate the index of gl_TextureMatrix[0] ..

    is the index equal to the bound name of the bound texture ??

    .. to write to the textureMatrix i'm just calling glMatrixMode(GL_TEXTURE); how do i know the right index for gl_TextureMatrix[] and gl_MultiTexCoord0 in my shader?? oi read a lot about textures in the read, orange and blue book, but i didn't found the answer ..

  5. #5
    Member Regular Contributor
    Join Date
    Apr 2004
    Location
    UK
    Posts
    420

    Re: matrix from gl to glsl

    textures in GLSL dont refer to 'texture objects' but 'texture units', so if you bind a texture object to texture unit 0 and change its matrix then gl_TextureMatrix[0] refers to the matrix of that texture unit
    You know what texture it refers to because you bound the texture to that texture unit before calling the shader.

Posting Permissions

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