Example usage for org.lwjgl.opengl ARBVertexProgram glVertexAttribPointerARB

List of usage examples for org.lwjgl.opengl ARBVertexProgram glVertexAttribPointerARB

Introduction

In this page you can find the example usage for org.lwjgl.opengl ARBVertexProgram glVertexAttribPointerARB.

Prototype

public static void glVertexAttribPointerARB(@NativeType("GLuint") int index, @NativeType("GLint") int size,
        @NativeType("GLenum") int type, @NativeType("GLboolean") boolean normalized,
        @NativeType("GLsizei") int stride, @NativeType("void const *") float[] pointer) 

Source Link

Document

Array version of: #glVertexAttribPointerARB VertexAttribPointerARB

Usage

From source file:com.ardor3d.scene.state.lwjgl.shader.LwjglShaderUtil.java

License:Open Source License

private static void updateShaderAttribute(final ShaderVariablePointerFloat variable,
        final ShaderObjectsStateRecord record, final boolean useVBO) {
    enableVertexAttribute(variable, record);
    if (useVBO) {
        final RenderContext context = ContextManager.getCurrentContext();
        final int vboId = LwjglRenderer.setupVBO(variable.data, context);
        LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
        ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, GL11.GL_FLOAT,
                variable.normalized, variable.stride, 0);
    } else {/*from   w  ww  .j  a  v a 2  s .  com*/
        variable.data.getBuffer().rewind();
        ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, variable.normalized,
                variable.stride, variable.data.getBuffer());
    }
}

From source file:com.ardor3d.scene.state.lwjgl.shader.LwjglShaderUtil.java

License:Open Source License

private static void updateShaderAttribute(final ShaderVariablePointerFloatMatrix variable,
        final ShaderObjectsStateRecord record, final boolean useVBO) {
    final int size = variable.size;
    final int length = variable.data.getBuffer().capacity() / size;
    final RenderContext context = ContextManager.getCurrentContext();
    int pos = 0;/*from  w w w. j  ava  2 s  .c o m*/
    enableVertexAttribute(variable, record);
    for (int i = 0; i < size; i++) {
        pos = (i * length);
        if (useVBO) {
            final int vboId = LwjglRenderer.setupVBO(variable.data, context);
            LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
            ARBVertexProgram.glVertexAttribPointerARB(variable.variableID + i, size, GL11.GL_FLOAT,
                    variable.normalized, 0, pos);
        } else {
            variable.data.getBuffer().limit(pos + length - 1);
            variable.data.getBuffer().position(pos);
            ARBVertexProgram.glVertexAttribPointerARB(variable.variableID + i, size, variable.normalized, 0,
                    variable.data.getBuffer());
        }
    }
}

From source file:com.ardor3d.scene.state.lwjgl.shader.LwjglShaderUtil.java

License:Open Source License

private static void updateShaderAttribute(final ShaderVariablePointerByte variable,
        final ShaderObjectsStateRecord record, final boolean useVBO) {
    enableVertexAttribute(variable, record);
    if (useVBO) {
        final RenderContext context = ContextManager.getCurrentContext();
        final int vboId = LwjglRenderer.setupVBO(variable.data, context);
        LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
        ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size,
                variable.unsigned ? GL11.GL_UNSIGNED_BYTE : GL11.GL_BYTE, variable.normalized, variable.stride,
                0);//www  .  ja v a 2  s  . c  o m
    } else {
        variable.data.getBuffer().rewind();
        ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, variable.unsigned,
                variable.normalized, variable.stride, variable.data.getBuffer());
    }
}

From source file:com.ardor3d.scene.state.lwjgl.shader.LwjglShaderUtil.java

License:Open Source License

private static void updateShaderAttribute(final ShaderVariablePointerInt variable,
        final ShaderObjectsStateRecord record, final boolean useVBO) {
    enableVertexAttribute(variable, record);
    if (useVBO) {
        final RenderContext context = ContextManager.getCurrentContext();
        final int vboId = LwjglRenderer.setupVBO(variable.data, context);
        LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
        ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size,
                variable.unsigned ? GL11.GL_UNSIGNED_INT : GL11.GL_INT, variable.normalized, variable.stride,
                0);//from  w w w . j  a va 2 s .  com
    } else {
        variable.data.getBuffer().rewind();
        ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, variable.unsigned,
                variable.normalized, variable.stride, variable.data.getBuffer());
    }
}

From source file:com.ardor3d.scene.state.lwjgl.shader.LwjglShaderUtil.java

License:Open Source License

private static void updateShaderAttribute(final ShaderVariablePointerShort variable,
        final ShaderObjectsStateRecord record, final boolean useVBO) {
    enableVertexAttribute(variable, record);
    if (useVBO) {
        final RenderContext context = ContextManager.getCurrentContext();
        final int vboId = LwjglRenderer.setupVBO(variable.data, context);
        LwjglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId);
        ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size,
                variable.unsigned ? GL11.GL_UNSIGNED_SHORT : GL11.GL_SHORT, variable.normalized,
                variable.stride, 0);//  w  w w . j av  a  2  s. c o  m
    } else {
        variable.data.getBuffer().rewind();
        ARBVertexProgram.glVertexAttribPointerARB(variable.variableID, variable.size, variable.unsigned,
                variable.normalized, variable.stride, variable.data.getBuffer());
    }
}