Example usage for org.lwjgl.opengl GL11 glTexCoordPointer

List of usage examples for org.lwjgl.opengl GL11 glTexCoordPointer

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glTexCoordPointer.

Prototype

public static void glTexCoordPointer(@NativeType("GLint") int size, @NativeType("GLenum") int type,
        @NativeType("GLsizei") int stride, @NativeType("void const *") FloatBuffer pointer) 

Source Link

Document

Specifies the location and organization of a texture coordinate array.

Usage

From source file:org.jtrfp.mtmx.draw.TerrainDrawer.java

License:Open Source License

private void bindBuffers() {
    // normals//from w  ww  .j  av a 2 s.com
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, normalBufferId);
    GL11.glNormalPointer(GL_FLOAT, 0, 0);

    // vertexes
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexBufferId);
    glVertexPointer(3, GL_FLOAT, 0, 0);

    // textures
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, texCoordBufferId);
    GL11.glTexCoordPointer(2, GL_FLOAT, 0, 0);

    // indexes
    glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexBufferId);
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glTexCoordPointer(int a, int b, int c, long d) {
    GL11.glTexCoordPointer(a, b, c, d);
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glTexCoordPointer(int a, int b, int c, ByteBuffer d) {
    GL11.glTexCoordPointer(a, b, c, d);
}

From source file:voxicity.ChunkNode.java

License:Open Source License

public void render(Frustum camera) {
    if (empty)/* w  ww. j ava 2  s.c o  m*/
        return;

    AABB chunk_box = new AABB(Constants.Chunk.side_length, Constants.Chunk.side_length,
            Constants.Chunk.side_length);

    chunk_box.center_on(chunk.get_x() + chunk_box.dimensions().x, chunk.get_y() + chunk_box.dimensions().y,
            chunk.get_z() + chunk_box.dimensions().z);

    if (!camera.collides(chunk_box))
        return;

    Renderer.draw_calls++;

    if (shader_prog != 0)
        GL20.glUseProgram(shader_prog);

    // Bind VBO to vertex pointer
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vert_buf);
    GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);

    // Bind the texture coord VBO to texture pointer
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, tex_buf);
    GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0);

    int tex_bak = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);

    for (Batch batch : batches) {
        // Bind the texture for this batch
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, batch.tex);

        // Bind index array
        GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, batch.indices);

        // Draw the block
        GL12.glDrawRangeElements(GL11.GL_QUADS, 0, Constants.Chunk.block_number * 24 - 1, batch.num_elements,
                GL11.GL_UNSIGNED_INT, 0);

        Renderer.batch_draw_calls++;
        Renderer.quads += batch.num_elements;
    }

    // Unbind the texture
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex_bak);

    // Unbind all buffers
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

    // Disable the shader once more
    if (shader_prog != 0)
        GL20.glUseProgram(0);
}

From source file:voxicity.Renderer.java

License:Open Source License

private void render_batch(ChunkNode.Batch batch) {
    if (!camera.collides(batch.box))
        return;//  w w w .j  a  v a 2  s.co  m

    Renderer.draw_calls++;

    // Use the shader the batch needs
    GL20.glUseProgram(batch.shader);

    // Bind VBO to vertex pointer
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, batch.vert_buf);
    GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);

    // Bind the texture coord VBO to texture pointer
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, batch.tex_buf);
    GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0);

    // Bind the texture for this batch
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, batch.tex);

    // Bind index array
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, batch.indices);

    // Draw the block
    GL12.glDrawRangeElements(GL11.GL_QUADS, 0, Constants.Chunk.block_number * 24 - 1, batch.num_elements,
            GL11.GL_UNSIGNED_INT, 0);

    Renderer.batch_draw_calls++;
    Renderer.quads += batch.num_elements;

    // Unbind the texture
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

    // Unbind all buffers
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

    GL20.glUseProgram(0);
}

From source file:zildo.fwk.opengl.compatibility.VBOHardware.java

License:Open Source License

@Override
public void draw(VBOBuffers p_bufs) {
    ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, p_bufs.vertexBufferId);
    GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);

    ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, p_bufs.normalBufferId);
    GL11.glNormalPointer(GL11.GL_FLOAT, 0, 0);

    ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, p_bufs.textureBufferId);
    GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0);
}

From source file:zildo.platform.opengl.compatibility.VBOHardware.java

License:Open Source License

@Override
public void draw(VBOBuffers p_bufs, int start, int count) {
    preDraw();/* w  ww .ja  va2  s. co m*/

    int stride = 4 * 4;
    ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, p_bufs.vertexBufferId);
    GL11.glVertexPointer(2, GL11.GL_FLOAT, stride, 0);
    GL11.glTexCoordPointer(2, GL11.GL_FLOAT, stride, 2 * 4);

    //GL12.glDrawRangeElements(GL11.GL_TRIANGLES, 0, count, count, GL11.GL_UNSIGNED_SHORT, 0);
    GL11.glDrawArrays(GL11.GL_TRIANGLES, start, count);
}