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

Thread: Bitmap Texturing

  1. #1
    Guest

    Bitmap Texturing

    How do I apply bitmap texture to some objects and not to the others

  2. #2
    Member Regular Contributor
    Join Date
    Apr 2001
    Location
    Fort Collins, Colorado
    Posts
    447

    Re: Bitmap Texturing

    OpenGL is a state machine, so once you've bound a texture and enabled texturing, it is going to texture your objects until you either bind a new texture, or disable texturing. So, you should:
    glEnable(GL_TEXTURE_2D);
    and then draw the object that you want the texture on, and then:
    glDisable(GL_TEXTURE_2D);
    and then draw the object that you do not want to have a texture.

    Hope that helps!

  3. #3
    Intern Contributor
    Join Date
    Jul 2001
    Location
    Camarillo, CA, USA
    Posts
    54

    Re: Bitmap Texturing

    After you load the bitmap, you want to apply the bitmap to objects as textures.

    I will assume that you know how to load the bitmap and generate the texture.

    When you draw the object that you want texture-mapped, you need to call the following:

    glBindTexture(GL_TEXTURE_2D, textureID);
    glEnable(GL_TEXTURE_2D);
    Draw_My_Textured_Object();
    glDisable(GL_TEXTURE_2D);

    Remember to enable GL_TEXTURE_2D somewhere during your PreRender code, also.

    One thing you might try is to just disable texturing when you want to draw normal textures.

    ex:

    glDisable(GL_TEXTURE_2D);
    Draw_nonTextured_Object();
    glEnable(GL_TEXTURE_2D);


    Hope that helps,
    ~Jesse
    PROGRAMMERS SHALL RULE THE WORLD

Posting Permissions

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