Results 1 to 4 of 4

Thread: multitexturing and vertex arrays (solved)

  1. #1
    Member Newbie
    Join Date
    Jun 2005
    Posts
    42

    multitexturing and vertex arrays (solved)

    EDIT: SOLVED. Both glClientActiveTextureARB and glActiveTextureARB need to be called to set the current texture environment for the texCoord array.

    I'm trying to put my heightmap in a vertex array instead of a display list but I can't get the multitexture to work. Any ideas?

    Code :
        glColor4f(1,1,1,1);
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     
        glVertexPointer(3,GL_SHORT,0,&mesh_s[0][0][0]);
        glEnable(GL_VERTEX_ARRAY);
     
        glActiveTextureARB(GL_TEXTURE0_ARB);
        glClientActiveTextureARB(GL_TEXTURE0_ARB);
        glEnable(GL_TEXTURE_2D); 
        glTexCoordPointer(2,GL_FLOAT,0,&texcoords[0]);
        glEnable(GL_TEXTURE_COORD_ARRAY);
        glBindTexture(GL_TEXTURE_2D, tex2d[4]);
     
        glActiveTextureARB(GL_TEXTURE1_ARB);
        glClientActiveTextureARB(GL_TEXTURE1_ARB);
        glEnable(GL_TEXTURE_2D); 
        glTexCoordPointer(2,GL_FLOAT,0,&texcoords[1]);
        glEnable(GL_TEXTURE_COORD_ARRAY);
        glBindTexture(GL_TEXTURE_2D, tex2d[2]); 
     
        glDrawElements(GL_TRIANGLE_STRIP, 512*2, GL_UNSIGNED_SHORT, &mesh_index[0]);
     
        glDisable(GL_TEXTURE_2D);
        glActiveTextureARB(GL_TEXTURE0_ARB);
        glClientActiveTextureARB(GL_TEXTURE0_ARB);
        glDisable(GL_TEXTURE_2D);
        glDisable(GL_TEXTURE_COORD_ARRAY);
        glDisable(GL_VERTEX_ARRAY);

  2. #2
    Guest

    Re: multitexturing and vertex arrays (solved)

    Use glActiveTexture with glEnable(GL_TEXTURE_2D).

    The client stuff is for, well, client stuff.

  3. #3
    Guest

    Re: multitexturing and vertex arrays (solved)

    Something kinda like this

    Code :
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);   
    glEnable(GL_BLEND);    
     
    glClientActiveTextureARB(GL_TEXTURE0_ARB);    
    glTexCoordPointer(2,GL_FLOAT,0,&texcoords[0]);    
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);    
     
    glClientActiveTextureARB(GL_TEXTURE1_ARB);    
    glTexCoordPointer(2,GL_FLOAT,0,&texcoords[1]);    
    glEnableClientState(GL_TEXTURE_COORD_ARRAY); 
     
    glEnableClientState(GL_VERTEX_ARRAY); 
     
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, tex2d[0]);     
    glEnable(GL_TEXTURE_2D);   
     
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, tex2d[1]); 
    glEnable(GL_TEXTURE_2D);

  4. #4
    Member Newbie
    Join Date
    Jun 2005
    Posts
    42

    Re: multitexturing and vertex arrays (solved)

    Thanks Hlz. I reordered it like that but it didn't change what's happening. Texture0 is getting the texture coordinates from the second glTexCoordPointer which is intended for texture1. Multitexturing is working now (since I removed the clienstate calls) though because texture0 is visible but tinted by what I think is a single pixel from texture1.

Similar Threads

  1. Multitexturing and vertex arrays
    By Ganymede in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 08-15-2002, 11:07 AM
  2. Vertex Arrays mit Multitexturing
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-11-2002, 06:39 AM
  3. multitexturing with vertex arrays
    By sbennett in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 01-25-2002, 04:34 AM
  4. Multitexturing with Vertex Arrays
    By JK in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 06-02-2001, 12:16 AM
  5. Multitexturing and Vertex Arrays
    By DrakanFyr in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 03-04-2001, 06:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean