List of usage examples for org.lwjgl.opengl GL11 glEnd
public static native void glEnd();
From source file:com.irr310.i3d.scene.I3dCamera.java
License:Open Source License
public void display(float width, float height) { this.currentWidth = width; this.currentHeight = height; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();/*www. ja va 2s . c o m*/ GL11.glOrtho(0, width, 0, height, -2000.0, 2000.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); backgroundScene.display(this); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); initPerspective(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glPushMatrix(); configureView(glu); if (!configured) { configured = true; if (cameraInitialisation != null) { cameraInitialisation.run(); cameraInitialisation = null; } } GL11.glColor3f(1, 0, 0); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3d(0, 0, 0); GL11.glVertex3d(100, 100, 100); GL11.glEnd(); preDisplayScene(); if (currentScene != null) { currentScene.display(this); } postDisplayScene(); preDisplayGui(); postDisplayGui(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, width, 0, height, -2000.0, 2000.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); hudScene.display(this); GL11.glPopMatrix(); }
From source file:com.irr310.i3d.scene.I3dEye3DCamera.java
License:Open Source License
private void displayTarget() { GL11.glColor4f(1.0f, 0.5f, 0.5f, 0.8f); GL11.glLineWidth(1.2f);/*from ww w . j a v a 2 s . c om*/ GL11.glBegin(GL11.GL_LINES); { GL11.glColor4f(1.0f, 0.0f, 0.0f, 0.8f); GL11.glVertex3d(-1, 0, 0); GL11.glVertex3d(1, 0, 0); GL11.glVertex3d(0.9, 0.1, 0); GL11.glVertex3d(1, 0, 0); GL11.glVertex3d(0.9, -0.1, 0); GL11.glVertex3d(1, 0, 0); // y GL11.glColor4f(0.0f, 1.0f, 0.0f, 0.8f); GL11.glVertex3d(0, -1, 0); GL11.glVertex3d(0, 1, 0); GL11.glVertex3d(0.1, 0.9, 0); GL11.glVertex3d(0, 1, 0); GL11.glVertex3d(-0.1, 0.9, 0); GL11.glVertex3d(0, 1, 0); // z GL11.glColor4f(0.0f, 0.0f, 1.0f, 0.8f); GL11.glVertex3d(0, 0, -1); GL11.glVertex3d(0, 0, 1); GL11.glVertex3d(0.1, 0, 0.9); GL11.glVertex3d(0, 0, 1); GL11.glVertex3d(-0.1, 0, 0.9); GL11.glVertex3d(0, 0, 1); } GL11.glEnd(); GL11.glPointSize(1.2f); GL11.glBegin(GL11.GL_POINTS); { GL11.glVertex3d(position.x, position.y, position.z); } GL11.glEnd(); }
From source file:com.jmex.bui.background.TintedBackground.java
License:Open Source License
public void render(Renderer renderer, int x, int y, int width, int height, float alpha) { super.render(renderer, x, y, width, height, alpha); BComponent.applyDefaultStates();//from ww w .j a va 2 s . co m BImage.blendState.apply(); GL11.glColor4f(_color.r, _color.g, _color.b, _color.a * alpha); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(x, y); GL11.glVertex2f(x + width, y); GL11.glVertex2f(x + width, y + height); GL11.glVertex2f(x, y + height); GL11.glEnd(); }
From source file:com.jmex.bui.border.LineBorder.java
License:Open Source License
@Override // from BBorder/*w w w.j a v a 2 s . c om*/ public void render(Renderer renderer, int x, int y, int width, int height, float alpha) { super.render(renderer, x, y, width, height, alpha); BComponent.applyDefaultStates(); BImage.blendState.apply(); if (_width > 0) { RenderContext ctx = DisplaySystem.getDisplaySystem().getCurrentContext(); GL11.glColor4f(_color.r, _color.g, _color.b, _color.a * alpha); // First draw the bottom line. if (_bottom > 0) { ((LineRecord) ctx.getLineRecord()).applyLineWidth(_bottom); float offset = _bottom / 2f; GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex2f(x - offset, y); GL11.glVertex2f(x + width, y); GL11.glEnd(); } // Next draw the right hand side. if (_right > 0) { ((LineRecord) ctx.getLineRecord()).applyLineWidth(_right); float offset = _right / 2f; GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex2f(x + width - offset, y); GL11.glVertex2f(x + width - offset, y + height); GL11.glEnd(); } // Next draw the top line. if (_top > 0) { ((LineRecord) ctx.getLineRecord()).applyLineWidth(_top); float offset = _top / 2f; GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex2f(x + width, y + height - offset); GL11.glVertex2f(x - offset, y + height - offset); GL11.glEnd(); } // Last draw the left hand side. if (_left > 0) { ((LineRecord) ctx.getLineRecord()).applyLineWidth(_left); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex2f(x, y + height); GL11.glVertex2f(x, y); GL11.glEnd(); } } }
From source file:com.jmex.bui.BRootNode.java
License:Open Source License
protected void renderModalShade() { BComponent.applyDefaultStates();//www .j a v a 2 s . c om BImage.blendState.apply(); int width = DisplaySystem.getDisplaySystem().getWidth(); int height = DisplaySystem.getDisplaySystem().getHeight(); GL11.glColor4f(_modalShade.r, _modalShade.g, _modalShade.b, _modalShade.a); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, 0); GL11.glVertex2f(width, 0); GL11.glVertex2f(width, height); GL11.glVertex2f(0, height); GL11.glEnd(); }
From source file:com.jmex.bui.BTextField.java
License:Open Source License
@Override // documentation inherited protected void renderComponent(Renderer renderer) { super.renderComponent(renderer); Insets insets = getInsets();// w w w . ja v a2 s. co m // render our text if (_glyphs != null) { // clip the text to our visible text region boolean scissored = intersectScissorBox(_srect, getAbsoluteX() + insets.left, getAbsoluteY() + insets.bottom, _width - insets.getHorizontal(), _height - insets.getVertical()); try { _glyphs.render(renderer, insets.left - _txoff, insets.bottom, _alpha); } finally { restoreScissorState(scissored, _srect); } } // render the cursor if we have focus if (_showCursor) { int cx = insets.left - _txoff + _cursx; BComponent.applyDefaultStates(); ColorRGBA c = getColor(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex2f(cx, insets.bottom); int cheight = getTextFactory().getHeight(); GL11.glVertex2f(cx, insets.bottom + cheight); GL11.glEnd(); } }
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
/** * Basic quad/*from w w w . j a va 2 s . c o m*/ * * @param g * @param h * @param i * @param j * @param col1 */ public static void drawRect(float g, float h, float i, float j, int col1) { float f = ((col1 >> 24) & 0xFF) / 255F; float f1 = ((col1 >> 16) & 0xFF) / 255F; float f2 = ((col1 >> 8) & 0xFF) / 255F; float f3 = (col1 & 0xFF) / 255F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glPushMatrix(); GL11.glColor4f(f1, f2, f3, f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2d(i, h); GL11.glVertex2d(g, h); GL11.glVertex2d(g, j); GL11.glVertex2d(i, j); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
/** * Gradient quad/*from ww w. j ava 2 s .c o m*/ * * @param x * @param y * @param x2 * @param y2 * @param col1 * @param col2 */ public static void drawGradientRect(int x, int y, int x2, int y2, int col1, int col2) { float f = ((col1 >> 24) & 0xFF) / 255F; float f1 = ((col1 >> 16) & 0xFF) / 255F; float f2 = ((col1 >> 8) & 0xFF) / 255F; float f3 = (col1 & 0xFF) / 255F; float f4 = ((col2 >> 24) & 0xFF) / 255F; float f5 = ((col2 >> 16) & 0xFF) / 255F; float f6 = ((col2 >> 8) & 0xFF) / 255F; float f7 = (col2 & 0xFF) / 255F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(f1, f2, f3, f); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y); GL11.glColor4f(f5, f6, f7, f4); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glShadeModel(GL11.GL_FLAT); }
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
/** * Sideways gradient quad/*from w w w .j a v a2s . c o m*/ * * @param x * @param y * @param x2 * @param y2 * @param col1 * @param col2 */ public static void drawSideGradientRect(float x, float y, float x2, float y2, int col1, int col2) { float f = ((col1 >> 24) & 0xFF) / 255F; float f1 = ((col1 >> 16) & 0xFF) / 255F; float f2 = ((col1 >> 8) & 0xFF) / 255F; float f3 = (col1 & 0xFF) / 255F; float f4 = ((col2 >> 24) & 0xFF) / 255F; float f5 = ((col2 >> 16) & 0xFF) / 255F; float f6 = ((col2 >> 8) & 0xFF) / 255F; float f7 = (col2 & 0xFF) / 255F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(f1, f2, f3, f); GL11.glVertex2d(x2, y); GL11.glColor4f(f5, f6, f7, f4); GL11.glVertex2d(x, y); GL11.glVertex2d(x, y2); GL11.glColor4f(f1, f2, f3, f); GL11.glVertex2d(x2, y2); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glShadeModel(GL11.GL_FLAT); }
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
/** * Bordered quad/*from w ww . j a va 2 s . c om*/ * * @param x * @param y * @param x2 * @param y2 * @param l1 * @param col1 * @param col2 */ public static void drawBorderedRect(int x, int y, int x2, int y2, float l1, int col1, int col2) { drawRect(x, y, x2, y2, col2); float f = ((col1 >> 24) & 0xFF) / 255F; float f1 = ((col1 >> 16) & 0xFF) / 255F; float f2 = ((col1 >> 8) & 0xFF) / 255F; float f3 = (col1 & 0xFF) / 255F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glPushMatrix(); GL11.glColor4f(f1, f2, f3, f); GL11.glLineWidth(l1); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2d(x, y); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }