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

Thread: small question answer fast plz

Hybrid View

  1. #1
    Junior Member Regular Contributor
    Join Date
    Dec 2002
    Posts
    155

    small question answer fast plz

    is this (the parameters) correct ?

    Code :
        public void setArrays() {
            if (hasVerticles) {
                gl.glVertexPointer(3,gl.GL_FLOAT,0,vertex);
            } else {
                return;
            }
            if (hasNormals) {
                gl.glNormalPointer(gl.GL_FLOAT,0,normal);
            }
            if (hasTexCoords) {
                gl.glTexCoordPointer(2,gl.GL_FLOAT,0,texCoord);
            }
            if (hasColors) {
                gl.glColorPointer(4,gl.GL_FLOAT,0,color);
            }
        }
    go vegan

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

    Re: small question answer fast plz

    Can't say, because I don't know how you store your data.

    Assuming everything is stored unpadded, vertices has three components, texture coordinates has two components and color has four components, all floats, then it looks correct.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Dec 2002
    Posts
    155

    Re: small question answer fast plz

    what is unpadded ?
    yes, i use 3 floats per vertex (x,y,z), 2 for texcoord (x,y), and 4 for color (r,g,b,a)

    is there a situation where you need 4 floats per vertex or 3 per texcoord ?
    go vegan

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

    Re: small question answer fast plz

    Unpadded means there's no "empty" data between two consecutive elements.

    You can use the W-component of a vertex to easily extend a shadow volume towards infinity, and three texture coordinates is used with cubemaps and 3D textures.

  5. #5
    Junior Member Regular Contributor
    Join Date
    Oct 2002
    Location
    King George, Virginia
    Posts
    138

    Re: small question answer fast plz

    you didn't tell us how you defined your functions, so ther's no way for us to know if the arguments are valid

    jebus

  6. #6
    Junior Member Regular Contributor
    Join Date
    Dec 2002
    Posts
    155

    Re: small question answer fast plz

    define my functions ?
    vertex is a floatarray [x,y,z,x2,y2,z2....]
    normal is a floatarray [x,y,t,x2,y2,z2...]
    etc.
    etc.
    what do you mean by define ?
    go vegan

  7. #7
    Advanced Member Frequent Contributor
    Join Date
    Jan 2003
    Location
    Virginia
    Posts
    601

    Re: small question answer fast plz

    Not sure exactly what you are looking for, but it looks right except for the first if(hasVerticles) which I assume should be if (hasVertices). Are you actually having a problem of some kind?

Posting Permissions

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