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

Thread: glTexCoordPointer

  1. #1
    Intern Contributor
    Join Date
    May 2002
    Location
    AUSTRIA
    Posts
    83

    glTexCoordPointer

    Hi there!
    I want to display a texture, which is calculated based on a vertex value. That means i have one value on each vertex between 0-1.0. Therfore i made the following:
    Init:
    tripeImage=new float[4*stripeImageWidth];//filled with RGBA values
    glGenTextures(1,&texResult);
    glBindTexture( GL_TEXTURE_1D, texResult );
    glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, 130, 0, GL_RGBA, GL_UNSIGNED_BYTE,stripeImage);
    glEnable(GL_TEXTURE_1D);
    In my Draw:
    glBindTexture( GL_TEXTURE_1D, texResult );
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glTexCoordPointer(1, GL_FLOAT, 0, result_damage);
    But nothing is shown. Whats wrang??
    Juergen

  2. #2
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: glTexCoordPointer

    Dimension of a 1D image must be
    (power of 2 number ) * 1

    That's the first problem.
    The second is that you need to enable GL_VERTEX_ARRAY, and also give the glVertexPointer a pointer and use the appropriate command (glDrawArray, glDrawElements, ...)
    You aren't using glVertex are you?

    V-man
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  3. #3
    Intern Contributor
    Join Date
    May 2002
    Location
    AUSTRIA
    Posts
    83

    Re: glTexCoordPointer

    I did not print the following lines:
    glEnableClientState (GL_VERTEX_ARRAY);
    glVertexPointer (3, GL_FLOAT, 0, vertices);
    glDrawElements (GL_QUADS, numQuads*4, GL_UNSIGNED_INT, elements_quad);
    Which dimension should be power 2*1?

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: glTexCoordPointer

    The size of your texture must be a power of two. 130 is not a power of two.

Posting Permissions

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