public void draw(DrawContext dc) { if (this.drawState.program == null || !this.drawState.program.useProgram(dc)) { return; // program unspecified or failed to build
if (this.program == null || !this.program.useProgram(dc)) { return; // program unspecified or failed to build
@Override public void draw(DrawContext dc) { if (this.program == null || !this.program.useProgram(dc)) { return; // program unspecified or failed to build } // Configure the program to draw the specified color. this.program.enableTexture(false); this.program.loadColor(this.color); for (int idx = 0, len = dc.getDrawableTerrainCount(); idx < len; idx++) { // Get the drawable terrain associated with the draw context. DrawableTerrain terrain = dc.getDrawableTerrain(idx); // Use the terrain's vertex point attribute. if (!terrain.useVertexPointAttrib(dc, 0 /*vertexPoint*/)) { continue; // vertex buffer failed to bind } // Use the draw context's modelview projection matrix, transformed to terrain local coordinates. Vec3 terrainOrigin = terrain.getVertexOrigin(); this.mvpMatrix.set(dc.modelviewProjection); this.mvpMatrix.multiplyByTranslation(terrainOrigin.x, terrainOrigin.y, terrainOrigin.z); this.program.loadModelviewProjection(this.mvpMatrix); // Draw the terrain as triangles. terrain.drawTriangles(dc); } } }
@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 }
@Override public void draw(DrawContext dc) { if (this.program == null || !this.program.useProgram(dc)) { return; // program unspecified or failed to build
@Override public void draw(DrawContext dc) { if (this.drawState.program == null || !this.drawState.program.useProgram(dc)) { return; // program unspecified or failed to build