/** * Creates a crash report. This should not happen if we check that the texture is valid every time. * * @param e * The exception. */ protected void handleIllegalBufferException(IllegalBufferException e) { // TODO Create crash report e.printStackTrace(); }
private void drawViewMark(GLDrawContext context, float x, float y) { try { context.draw2D(lineGeometry, null, EGeometryType.LineLoop, 0, 6, x, y, 0, 1, 1, 1, null, 1); } catch (IllegalBufferException e) { e.printStackTrace(); } }
private boolean gl2Draw(GLDrawContext gl, float x, float y, float z, Color torsoColor, float fow, boolean settler, boolean shadow) { try { checkHandles(gl); if(!gl2) return false; ((GL2DrawContext)gl).drawUnified2D(geometryIndex.geometry, texture, EGeometryType.Quad, geometryIndex.index, 4, settler, shadow, x, y, z, 1, 1, 1, torsoColor, fow); } catch(IllegalBufferException e) { e.printStackTrace(); } return true; }
private void drawSelectionHint(GLDrawContext gl) { if (this.currentSelectionAreaStart != null && this.currentSelectionAreaEnd != null) { if(selectionArea == null || !selectionArea.isValid()) { selectionArea = gl.generateGeometry(4, EGeometryFormatType.VertexOnly2D, true, "selection-area"); } if(updateSelectionArea) { updateSelectionArea(); try { gl.updateGeometryAt(selectionArea, 0, selectionAreaBuffer); } catch (IllegalBufferException e) { e.printStackTrace(); } updateSelectionArea = false; } try { gl.draw2D(selectionArea, null, EGeometryType.LineLoop, 0, 4, 0, 0, 0, 1, 1, 1, null, 1); } catch (IllegalBufferException e) { e.printStackTrace(); } } }
@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); } }
@Override public void drawOnlyImageAt(GLDrawContext gl, float x, float y, float z, Color torsoColor, float fow) { try { if(nullGeometry == null || !nullGeometry.isValid()) nullGeometry = gl.storeGeometry(nullData, EGeometryFormatType.VertexOnly2D, false, "placeholder/null"); gl.draw2D(nullGeometry, null, EGeometryType.Quad, 0, 4, x, y, z, 1, 1, 1, null, NULL_IMAGE_ALPHA); gl.draw2D(nullGeometry, null, EGeometryType.LineLoop, 0, 4, x, y, z, 1, 1, 1, Color.RED, 1); } catch (IllegalBufferException e) { e.printStackTrace(); } }
@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 drawAt(GLDrawContext gl) { super.drawAt(gl); TextDrawer drawer = gl.getTextDrawer(EFontSize.NORMAL); float textHeight = drawer.getHeight(inputString.toString() + "X"); float y = getPosition().getCenterY() - textHeight / 2; float x = getPosition().getMinX() + 2; drawer.drawString(x, y, inputString.toString()); if(geometry == null || !geometry.isValid()) geometry = gl.storeGeometry(new float[] {0, 0, 0, 1}, EGeometryFormatType.VertexOnly2D, false, "uiinput-line"); float carretX = x + drawer.getWidth(inputString.substring(0, carret) + "X") - drawer.getWidth("X"); try { gl.draw2D(geometry, null, EGeometryType.LineStrip, 0, 2, carretX, y, 0, 0, textHeight, 0, null, 1); } catch (IllegalBufferException e) { e.printStackTrace(); } }
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(); } } }
if (imageWasCreatedJustNow) { e.printStackTrace(); } else {
@Override public void drawAt(GLDrawContext gl) { FloatRectangle position = getPosition(); float fillX = barFillPercentage < .01f ? 0 : barFillPercentage > .99f ? 1 : EMPTY_X * (1 - barFillPercentage) + FULL_X * barFillPercentage; float maxX = position.getMinX() * (1 - fillX) + position.getMaxX() * fillX; try { if (geometry == null || !geometry.isValid()) geometry = gl.generateGeometry(4, EGeometryFormatType.VertexOnly2D, false, name); if (!position.equals(writtenPosition) || writtenMaxX != maxX) { writtenPosition = position; writtenMaxX = maxX; geometryBfr.asFloatBuffer().put(new float[]{ maxX, position.getMinY(), position.getMinX(), position.getMinY(), position.getMinX(), position.getMaxY(), maxX, position.getMaxY()}); gl.updateGeometryAt(geometry, 0, geometryBfr); } gl.draw2D(geometry, null, EGeometryType.Quad, 0, 4, 0, 0, 0, 1, 1, 1, barColor, 1); } catch(IllegalBufferException ex) { ex.printStackTrace(); } super.drawBackground(gl); }
} catch (IllegalBufferException e) { e.printStackTrace();