@Override public boolean useVertexPointAttrib(DrawContext dc, int attribLocation) { boolean bufferBound = (this.vertexPoints != null && this.vertexPoints.bindBuffer(dc)); if (bufferBound) { GLES20.glVertexAttribPointer(attribLocation, 3, GLES20.GL_FLOAT, false, 0, 0); } return bufferBound; }
@Override public boolean useVertexTexCoordAttrib(DrawContext dc, int attribLocation) { boolean bufferBound = (this.vertexTexCoords != null && this.vertexTexCoords.bindBuffer(dc)); if (bufferBound){ GLES20.glVertexAttribPointer(attribLocation, 2, GLES20.GL_FLOAT, false, 0, 0); } return bufferBound; }
@Override public boolean drawTriangles(DrawContext dc) { boolean bufferBound = (this.elements != null && this.elements.bindBuffer(dc)); if (bufferBound) { GLES20.glDrawElements(GLES20.GL_TRIANGLE_STRIP, this.triStripElementRange.length(), GLES20.GL_UNSIGNED_SHORT, this.triStripElementRange.lower * 2); } return bufferBound; }
@Override public boolean drawLines(DrawContext dc) { boolean bufferBound = (this.elements != null && this.elements.bindBuffer(dc)); if (bufferBound) { GLES20.glDrawElements(GLES20.GL_LINES, this.lineElementRange.length(), GLES20.GL_UNSIGNED_SHORT, this.lineElementRange.lower * 2); } return bufferBound; }
if (this.vertexPoints == null || !this.vertexPoints.bindBuffer(dc)) { return; // vertex buffer unspecified or failed to bind if (this.triStripElements == null || !this.triStripElements.bindBuffer(dc)) { return; // element buffer unspecified or failed to bind
if (shape.drawState.vertexBuffer == null || !shape.drawState.vertexBuffer.bindBuffer(dc)) { continue; // vertex buffer unspecified or failed to bind if (shape.drawState.elementBuffer == null || !shape.drawState.elementBuffer.bindBuffer(dc)) { continue; // element buffer unspecified or failed to bind
@Override public void draw(DrawContext dc) { if (this.program == null || !this.program.useProgram(dc)) { return; // program unspecified or failed to build } if (!dc.unitSquareBuffer().bindBuffer(dc)) { return; // vertex buffer failed to bind } // Use the draw context's pick mode and use the drawable's color. this.program.enablePickMode(dc.pickMode); // Make multi-texture unit 0 active. dc.activeTextureUnit(GLES20.GL_TEXTURE0); // Disable writing to the depth buffer. GLES20.glDepthMask(false); // Use a unit square as the vertex point and vertex tex coord attributes. GLES20.glEnableVertexAttribArray(1 /*vertexTexCoord*/); // only vertexPoint is enabled by default GLES20.glVertexAttribPointer(0 /*vertexPoint*/, 2, GLES20.GL_FLOAT, false, 0, 0); GLES20.glVertexAttribPointer(1 /*vertexTexCoord*/, 2, GLES20.GL_FLOAT, false, 0, 0); // Draw this DrawableScreenTextures. this.doDraw(dc, this); // Draw all DrawableScreenTextures adjacent in the queue that share the same GLSL program. Drawable next; while ((next = dc.peekDrawable()) != null && this.canBatchWith(next)) { // check if the drawable at the front of the queue can be batched DrawableScreenTexture drawable = (DrawableScreenTexture) dc.pollDrawable(); // take it off the queue this.doDraw(dc, drawable); } // Restore the default WorldWind OpenGL state. GLES20.glDepthMask(true); GLES20.glDisableVertexAttribArray(1 /*vertexTexCoord*/); // only vertexPoint is enabled by default }
if (this.drawState.vertexBuffer == null || !this.drawState.vertexBuffer.bindBuffer(dc)) { return; // vertex buffer unspecified or failed to bind if (this.drawState.elementBuffer == null || !this.drawState.elementBuffer.bindBuffer(dc)) { return; // element buffer unspecified or failed to bind