@Override public void drawOnlyImageAt(GLDrawContext gl, float x, float y, float z, Color torsoColor, float fow) { TextureHandle texture = map.getTexture(gl); try { if(settlerGeometry == null) { settlerGeometry = SharedGeometry.addGeometry(gl, settlerFloats); if(torsoFloats != null) torsoGeometry = SharedGeometry.addGeometry(gl, torsoFloats); } gl.draw2D(settlerGeometry.geometry, texture, EGeometryType.Quad, settlerGeometry.index, 4, x, y, z, 1, 1, 1, null, fow); if(torsoFloats == null || torsoColor == null) return; gl.draw2D(torsoGeometry.geometry, texture, EGeometryType.Quad, torsoGeometry.index, 4, x, y, z, 1, 1, 1, torsoColor, fow); } catch (IllegalBufferException e) { e.printStackTrace(); } }
@Override public void drawImageAtRect(GLDrawContext gl, float x, float y, float width, float height) { try { if(rectHandle == null) { rectHandle = SharedGeometry.addGeometry(gl, settlerRectFloats); settlerRectFloats = null; } gl.draw2D(rectHandle.geometry, map.getTexture(gl), EGeometryType.Quad, rectHandle.index, 4, x, y, 0, width, height, 0, null, 1); } catch (IllegalBufferException e) { handleIllegalBufferException(e); } }
@Override public void drawImageAtRect(GLDrawContext gl, float x, float y, float width, float height) { try { if(imageRectHandle == null) imageRectHandle = SharedGeometry.addGeometry(gl, SharedGeometry.createQuadGeometry(0,1, 1, 0, umin, vmin, umax, vmax)); draw(gl, imageRectHandle, x, y, 0, width, height, 0, null, 1); } catch (IllegalBufferException e) { e.printStackTrace(); } if (torso != null) { torso.drawImageAtRect(gl, x, y, width, height); } }
protected void checkHandles(GLDrawContext gl) throws IllegalBufferException { if (texture == null || !texture.isValid()) { texture = gl.generateTexture(twidth, theight, tdata, name); } if(geometryIndex == null || SharedGeometry.isInvalid(gl, geometryIndex)) { geometryIndex = SharedGeometry.addGeometry(gl, getGeometry()); } }
private void checkStaticHandles(GLDrawContext gl) throws IllegalBufferException { checkHandles(gl); if(buildHandle == null || !buildHandle.isValid()) { buildHandle = gl.generateGeometry(3, EGeometryFormatType.Texture2D, true, "building-progress"); } if(rectHandle == null || SharedGeometry.isInvalid(gl, rectHandle)) { rectHandle = SharedGeometry.addGeometry(gl, SharedGeometry.createQuadGeometry(0, 1, 1, 0, 0, 0, 1, 1)); } }
private void draw(GLDrawContext gl, SharedGeometry.SharedGeometryHandle handle, float x, float y, float z, float sx, float sy, float sz, Color color, float fow) { try { if(handle == null) geometryIndex = handle = SharedGeometry.addGeometry(gl, geometry); gl.draw2D(handle.geometry, texture.getTextureIndex(gl), EGeometryType.Quad, handle.index, 4, x, y, z, sx, sy, sz, color, fow); } catch (IllegalBufferException e) { try { texture.recreateTexture(); gl.draw2D(handle.geometry, texture.getTextureIndex(gl), EGeometryType.Quad, handle.index, 4, x, y, z, sx, sy, sz, color, fow); } catch (IllegalBufferException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }