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

Thread: glbindtexture

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Preston, lancs, Uk
    Posts
    2

    glbindtexture

    How do I use glBindTexture? - all the source code I can find is hopelessly unreadable and the OpenGL help file I have skips over most of it conveniantly. Simple examples preferred with some doc. if poss

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Posts
    569

    Re: glbindtexture

    After you first loaded a texture in opengl and assigned a number to it(using glGenTextures or else) you call glBindTexture(GL_TEXTURE_*, NUMBER_OF_YOUR_TEXTURE).
    (the * stand for 1D, 2D, 3D

    This will make your texture object active or "waiting to be called".

    example :

    struct{
    GLuint texnum;
    //other texture info
    } texture;

    texture texobj[MAX_TEX_OBJECT]

    //create texture one
    glGenTexture(1,texobj[0].texnum);
    //Set color in filter and etc.
    glBindTexture(texobj[0].texnum);

    //create the other textures with the same template.

    After, when you get to the actual scene rendering and want to render using the first texture you call glBindTexture again(this time it will says to opengl use that texture for the next textures mapping if the number you pass to glBindTexture is one that has an active texture(that mean you already called glBind for it)).

    glBindTexture(GL_TEXTURE_*, texobj[0]);
    //render stuff that use the first texture

    glBindTexture(GL_TEXTURE_*, texobj[1];
    //render stuff using the second texture.

Posting Permissions

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