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: MDL and GLSL

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    4

    MDL and GLSL

    Well I'm now working with MDL (Half-Life Model) in GLSL programs,
    but I'm perplexed as to why the texture of MDL doesn't be mapped.
    Here're some codes...

    /* Render MDL by using the fixed pipelines. */
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_TEXTURE_2D);
    DrawMDL();
    glDisable(GL_TEXTURE_2D);
    glDisable(GL_LIGHT0);
    glDisable(GL_LIGHTING);

    /* Render bump-mapped walls by shaders */
    glUseProgramObjectARB(g_PrgObj);
    glUniform1iARB(g_Loc_Texture0, g_BaseTex);
    glUniform1iARB(g_Loc_Texture1, g_BumpTex);
    DrawWalls();
    glUseProgramObjectARB(NULL);

    Do you have any ideas or hints? Please help me...

    Thanks.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Jan 2001
    Location
    NVIDIA, Austin, TX
    Posts
    555

    Re: MDL and GLSL

    You don't pass a texture object to glUniform1iARB when setting samplers, you pass in an integer that specifies which texture unit you want that sampler to fetch from.

    So assuming you bound g_BaseTex to texture unit 0, and g_BumpTex to texture unit 1, you would do this:

    Code :
    glUniform1iARB(g_Loc_Texture0, 0);
    glUniform1iARB(g_Loc_Texture1, 1);

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    4

    Re: MDL and GLSL

    Well I have no problem with GLSL.
    But when I use MDL textures and GLSL textures at the same time, the former fails.

    Is it possible to use both textures at the same time?

  4. #4
    Intern Contributor
    Join Date
    Sep 2001
    Location
    Lewisville, TX
    Posts
    93

    Re: MDL and GLSL

    assuming your using multitexturing extension

  5. #5
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    4

    Re: MDL and GLSL

    Yep, I'm using multitexturing.

    Code :
    glActiveTextureARB(GL_TEXTURE0_ARB);
    glBindTexture(GL_TEXTURE_2D, g_Texture[g_BaseTex]);
     
    glActiveTextureARB(GL_TEXTURE1_ARB);
    glBindTexture(GL_TEXTURE_2D, g_Texture[g_BumpTex]);
    MDL textures would be mapped correctly when I turn off multitexturing.
    So maybe that is the problem, but I don't understand how to cook that off...

  6. #6
    Advanced Member Frequent Contributor
    Join Date
    Oct 2000
    Location
    Belgium
    Posts
    807

    Re: MDL and GLSL

    This is getting off topic... Are you setting the active texture back to GL_TEXTURE0 before binding your MDL's texture?

    -- Tom

Posting Permissions

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