System.err.println("ShaderState: glVertexAttribPointer: "+data); gl.glVertexAttribPointer(data); return true;
@Override public final void syncData(final GL gl, final Object ext) { final GL2ES2 glsl = gl.getGL2ES2(); if( null != ext ) { ((ShaderState)ext).vertexAttribPointer(glsl, ad); } else { if( 0 <= ad.getLocation() ) { glsl.glVertexAttribPointer(ad); } } /** * Due to probable application VBO switching, this might not make any sense .. * if(!written) { st.vertexAttribPointer(glsl, ad); } else if(st.getAttribLocation(glsl, ad) >= 0) { final int[] qi = new int[1]; glsl.glGetVertexAttribiv(ad.getLocation(), GL2ES2.GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, qi, 0); if(ad.getVBOName() != qi[0]) { System.err.println("XXX1: "+ad.getName()+", vbo ad "+ad.getVBOName()+", gl "+qi[0]+", "+ad); st.vertexAttribPointer(glsl, ad); } else { System.err.println("XXX0: "+ad.getName()+", vbo ad "+ad.getVBOName()+", gl "+qi[0]+", "+ad); } }*/ }
private final void relocateAttribute(final GL2ES2 gl, final GLArrayData attribute) { // get new location .. note: 'activeAttribLocationMap' is cleared before final String name = attribute.getName(); final int loc = attribute.setLocation(gl, shaderProgram.program()); if(0<=loc) { activeAttribLocationMap.put(name, Integer.valueOf(loc)); if(DEBUG) { System.err.println("ShaderState: relocateAttribute: "+name+", loc: "+loc); } if(isVertexAttribArrayEnabled(name)) { // enable attrib, VBO and pass location/data gl.glEnableVertexAttribArray(loc); } if( attribute.isVBO() ) { gl.glBindBuffer(GL.GL_ARRAY_BUFFER, attribute.getVBOName()); gl.glVertexAttribPointer(attribute); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); } else { gl.glVertexAttribPointer(attribute); } } }
public void prepare() { buffer.bind(); GL2ES2 gl = gc.getGL().getGL2ES2(); for (AttributConfig ac : configs) { gl.glEnableVertexAttribArray(ac.index); gl.glVertexAttribPointer(ac.index, ac.size, ac.glconst, false, ac.stride, ac.offset); } buffer.disable(); }
private final void setAttribute(final GL2ES2 gl, final GLArrayData attribute) { // get new location .. final String name = attribute.getName(); final int loc = attribute.getLocation(); if(0<=loc) { bindAttribLocation(gl, loc, name); if(isVertexAttribArrayEnabled(name)) { // enable attrib, VBO and pass location/data gl.glEnableVertexAttribArray(loc); } if( attribute.isVBO() ) { gl.glBindBuffer(GL.GL_ARRAY_BUFFER, attribute.getVBOName()); gl.glVertexAttribPointer(attribute); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); } else { gl.glVertexAttribPointer(attribute); } } }
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 = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); GLContext .getCurrentGL() .getGL2ES2() .glVertexAttribPointer(variable.variableID, variable.size, variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride, 0); } else { variable.data.getBuffer().rewind(); GLContext .getCurrentGL() .getGL2ES2() .glVertexAttribPointer(variable.variableID, variable.size, variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride, variable.data.getBuffer()); } }
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 = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); GLContext .getCurrentGL() .getGL2ES2() .glVertexAttribPointer(variable.variableID, variable.size, variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized, variable.stride, 0); } else { variable.data.getBuffer().rewind(); GLContext .getCurrentGL() .getGL2ES2() .glVertexAttribPointer(variable.variableID, variable.size, variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized, variable.stride, variable.data.getBuffer()); } }
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 = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); GLContext .getCurrentGL() .getGL2ES2() .glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT, variable.normalized, variable.stride, 0); } else { variable.data.getBuffer().rewind(); GLContext .getCurrentGL() .getGL2ES2() .glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT, variable.normalized, variable.stride, variable.data.getBuffer()); } }
private static void updateShaderAttribute(final ShaderVariablePointerFloatMatrix variable, final ShaderObjectsStateRecord record, final boolean useVBO) { final GL gl = GLContext.getCurrentGL(); final int size = variable.size; final int length = variable.data.getBuffer().capacity() / size; final RenderContext context = ContextManager.getCurrentContext(); int pos = 0; enableVertexAttribute(variable, record); for (int i = 0; i < size; i++) { pos = (i * length); if (useVBO) { final int vboId = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); gl.getGL2ES2().glVertexAttribPointer(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized, 0, pos); } else { variable.data.getBuffer().limit(pos + length - 1); variable.data.getBuffer().position(pos); gl.getGL2ES2().glVertexAttribPointer(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized, 0, variable.data.getBuffer()); } } }
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 = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); GLContext .getCurrentGL() .getGL2ES2() .glVertexAttribPointer(variable.variableID, variable.size, variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized, variable.stride, 0); } else { variable.data.getBuffer().rewind(); GLContext .getCurrentGL() .getGL2ES2() .glVertexAttribPointer(variable.variableID, variable.size, variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized, variable.stride, variable.data.getBuffer()); } } }
if(enable) { glsl.glEnableVertexAttribArray(vArrayData.getLocation()); glsl.glVertexAttribPointer(vArrayData); } else { glsl.glDisableVertexAttribArray(vArrayData.getLocation()); if(enable) { glsl.glEnableVertexAttribArray(cArrayData.getLocation()); glsl.glVertexAttribPointer(cArrayData); } else { glsl.glDisableVertexAttribArray(cArrayData.getLocation()); if(enable) { glsl.glEnableVertexAttribArray(nArrayData.getLocation()); glsl.glVertexAttribPointer(nArrayData); } else { glsl.glDisableVertexAttribArray(nArrayData.getLocation()); if(enable) { glsl.glEnableVertexAttribArray(tArrayData.getLocation()); glsl.glVertexAttribPointer(tArrayData); } else { glsl.glDisableVertexAttribArray(tArrayData.getLocation());
gl.glVertexAttribPointer( handles.inAreaVertex, coordsPerRenderTriangleVertex, GL_FLOAT, false, 0, group.trianglesCoordFirst * SIZEOF_FLOAT ); gl.glVertexAttribPointer( handles.inLineVertex, coordsPerRenderLineVertex, GL_FLOAT, false, 0, group.linesCoordFirst * SIZEOF_FLOAT ); gl.glVertexAttribPointer( handles.inIconVertex, coordsPerRenderIconVertex, GL_FLOAT, false, 0, group.iconsCoordFirst * SIZEOF_FLOAT ); gl.glVertexAttribPointer( handles.inLabelVertex, coordsPerRenderLabelVertex, GL_FLOAT, false, 0, group.labelsCoordFirst * SIZEOF_FLOAT ); gl.glVertexAttribPointer( handles.inImageAlign, coordsPerLabelAtlasAlign, GL_FLOAT, false, 0, group.labelFirst * coordsPerLabelAtlasAlign * SIZEOF_FLOAT ); gl.glVertexAttribPointer( handles.inImageBounds, coordsPerLabelAtlasBounds, GL_FLOAT, false, 0, group.labelFirst * coordsPerLabelAtlasBounds * SIZEOF_FLOAT );
glsl.glVertexAttribPointer(ad); glsl.glBindBuffer(ad.getVBOTarget(), 0); } else { if(ad.getVBOName() != tempI[0]) { glsl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName()); glsl.glVertexAttribPointer(ad); glsl.glBindBuffer(ad.getVBOTarget(), 0); glsl.glVertexAttribPointer(ad);