List of usage examples for org.lwjgl.opengl GL11 glEnd
public static native void glEnd();
From source file:com.telinc1.rpjg.util.DrawingUtils.java
License:Apache License
/** * Stops drawing.//from w w w .ja va2s. co m */ public static void stopDrawing() { if (DrawingUtils.drawMode != -1) { GL11.glEnd(); DrawingUtils.drawMode = -1; } }
From source file:com.timvisee.voxeltex.architecture.component.drawable.line.AxisDrawComponent.java
License:Open Source License
@Override public synchronized void onDraw() { // Set the thickness of the axis drawn GL11.glLineWidth(this.lineWidth); // Enable line drawing mode GL11.glBegin(GL11.GL_LINES);/*from ww w.ja v a 2 s . co m*/ // Green for X GL11.glColor3f(1.0f, 0.0f, 0.0f); GL11.glVertex3f(0.0f, 0.0f, 0.0f); GL11.glVertex3f(1.0f, 0.0f, 0.0f); // Green for Y GL11.glColor3f(0.0f, 1.0f, 0.0f); GL11.glVertex3f(0.0f, 0.0f, 0.0f); GL11.glVertex3f(0.0f, 1.0f, 0.0f); // Green for Z GL11.glColor3f(0.0f, 0.0f, 1.0f); GL11.glVertex3f(0.0f, 0.0f, 0.0f); GL11.glVertex3f(0.0f, 0.0f, 1.0f); // Finish drawing GL11.glEnd(); }
From source file:com.timvisee.voxeltex.architecture.component.drawable.line.GridDrawComponent.java
License:Open Source License
@Override public synchronized void onDraw() { // Set the thickness of the axis drawn GL11.glLineWidth(this.lineWidth); // Enable line drawing mode GL11.glBegin(GL11.GL_LINES);// w ww .j a v a 2 s . c o m // Set the grid color GL11.glColor3f(0.2f, 0.2f, 0.2f); // Draw the grid for (int i = -20; i <= 20; i++) { GL11.glVertex3f(-20.0f, 0.0f, i); GL11.glVertex3f(20.0f, 0.0f, i); GL11.glVertex3f(i, 0.0f, -20.0f); GL11.glVertex3f(i, 0.0f, 20.0f); } // Finish drawing GL11.glEnd(); }
From source file:com.timvisee.voxeltex.module.render.RenderOverlayHelper.java
License:Open Source License
/** * Render a rectangle at the given position. * * @param x Rectangle X position./*from www .j a v a 2 s. c om*/ * @param y Rectangle Y position. * @param w Rectangle width. * @param h Rectangle height. */ public static void renderRectangle(float x, float y, float w, float h) { // Enable line drawing mode GL11.glBegin(GL11.GL_QUADS); // Draw the grid GL11.glVertex3f(x, y, 0f); GL11.glTexCoord2f(1, 1); GL11.glVertex3f(x + w, y, 0f); GL11.glTexCoord2f(1, 0); GL11.glVertex3f(x + w, y + h, 0f); GL11.glTexCoord2f(0, 0); GL11.glVertex3f(x, y + h, 0f); GL11.glTexCoord2f(0, 1); // Finish drawing GL11.glEnd(); }
From source file:com.timvisee.voxeltex.module.render.RenderOverlayHelper.java
License:Open Source License
/** * Render a line at the given position.//from w w w. j a v a 2 s . c o m * * @param x Line X position. * @param y Line Y position. * @param w Line width. * @param h Line height. */ public static void renderLine(float x, float y, float w, float h) { // Enable line drawing mode GL11.glBegin(GL11.GL_LINES); // Draw the grid GL11.glVertex3f(x, y, 0f); GL11.glVertex3f(x + w, y + h, 0f); // Finish drawing GL11.glEnd(); }
From source file:com.wicpar.sinkingsimulatorclassic.Ground.java
License:Open Source License
@Override public void draw() { GL11.glEnable(GL11.GL_DEPTH_TEST);/*from www . j a va2s . c om*/ GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(FloorColor.r, FloorColor.g, FloorColor.b, FloorColor.a); double h = Main.ClassicSinkingSim.getInstance().getCam().transformY(this.h); GL11.glVertex3d(-1, h, -0.8); GL11.glVertex3d(-1, -1, -0.8); GL11.glVertex3d(1, -1, -0.8); GL11.glVertex3d(1, h, -0.8); GL11.glEnd(); GL11.glDisable(GL11.GL_DEPTH_TEST); }
From source file:com.wicpar.sinkingsimulatorclassic.Sea.java
License:Open Source License
@Override public void draw() { GL11.glEnable(GL11.GL_DEPTH_TEST);/*from ww w .ja v a 2 s. c o m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_POLYGON_SMOOTH); time = Base.getTimePassed(); GL11.glBegin(GL11.GL_QUAD_STRIP); GL11.glColor4f(SeaColor.r, SeaColor.g, SeaColor.b, SeaColor.a); for (int i = 0; i <= divisions; i++) { double pos = ((double) (i) / (divisions)) * 2 - 1; GL11.glVertex3d(pos, -1, -0.07); GL11.glVertex3d(pos, cam.transformY(getHeight(cam.untransformX(pos), time)), -0.07); } GL11.glEnd(); GL11.glEnable(GL11.GL_POLYGON_SMOOTH); GL11.glLineWidth(2); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glColor4f(SeaColor.r, SeaColor.g, SeaColor.b, 1); for (int i = 0; i <= divisions; i++) { double pos = ((double) (i) / (divisions)) * 2 - 1; GL11.glVertex3d(pos, cam.transformY(getHeight(cam.untransformX(pos), time)), -0.07); } GL11.glEnd(); GL11.glLineWidth(1); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glLineWidth(1); }
From source file:com.wicpar.sinkingsimulatorclassic.Ship.java
License:Open Source License
@Override public void draw() { final Camera cam = Main.ClassicSinkingSim.getInstance().getCam(); GL11.glEnable(GL11.GL_DEPTH_TEST);/*from w ww . j av a 2 s .c om*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPointSize((float) Main.ClassicSinkingSim.getInstance().getCam().scaleSize(0.1)); GL11.glBegin(GL11.GL_POINTS); for (Shipsel[] s : shipsels) { if (s != null) for (Shipsel shipsel : s) { if (shipsel != null) { Color c = shipsel.getColor(); Vector3d pos = shipsel.getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.8); } } } GL11.glEnd(); GL11.glPointSize(1); GL11.glLineWidth((float) Main.ClassicSinkingSim.getInstance().getCam().scaleSize(0.1)); boolean t, b, l, r, e, f; Color c; Vector3d pos; GL11.glBegin(GL11.GL_LINES); for (int y = 0; y < springs[1].length; y++) { for (int x = 0; x < springs[1][y].length; x++) { t = springs[0][y][x]; l = springs[2][y][x]; e = springs[1][y][x]; f = springs[3][y][x]; if (t && (shipsels[y][x] == null || shipsels[y][x + 1] == null)) { springs[0][y][x] = false; } if (l && (shipsels[y][x] == null || shipsels[y + 1][x] == null)) { springs[2][y][x] = false; } if (e && (shipsels[y][x] == null || shipsels[y + 1][x + 1] == null)) { springs[1][y][x] = false; } if (f && (shipsels[y][x + 1] == null || shipsels[y + 1][x] == null)) { springs[3][y][x] = false; } t = springs[0][y][x]; b = springs[0][y + 1][x]; l = springs[2][y][x]; r = springs[2][y][x + 1]; e = springs[1][y][x]; f = springs[3][y][x]; if (t && b && l && r && e && f) continue; if (t && r && e) continue; if (b && l && e) continue; if (t && l && f) continue; if (b && r && f) continue; if (t) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); } if (l) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); } if (e) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); c = shipsels[y + 1][x + 1].getColor(); pos = shipsels[y + 1][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); } if (f) { c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); } } } GL11.glEnd(); GL11.glBegin(GL11.GL_TRIANGLES); for (int y = 0; y < springs[1].length; y++) { for (int x = 0; x < springs[1][y].length; x++) { t = springs[0][y][x]; b = springs[0][y + 1][x]; l = springs[2][y][x]; r = springs[2][y][x + 1]; e = springs[1][y][x]; f = springs[3][y][x]; if (t && b && l && r && e && f) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x + 1].getColor(); pos = shipsels[y + 1][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); } else { if (t && r && e) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x + 1].getColor(); pos = shipsels[y + 1][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); } if (b && l && e) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x + 1].getColor(); pos = shipsels[y + 1][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); } if (t && l && f) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); } if (b && r && f) { c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x + 1].getColor(); pos = shipsels[y + 1][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); } } } } GL11.glEnd(); GL11.glLineWidth(1); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST); }
From source file:com.wicpar.sinkingsimulatorclassic.Sky.java
License:Open Source License
@Override public void draw() { GL11.glEnable(GL11.GL_DEPTH_TEST);/*from www. j a v a2s .co m*/ GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(SkyColor.r, SkyColor.g, SkyColor.b, SkyColor.a); GL11.glVertex3d(-1, -1, -0.9); GL11.glVertex3d(-1, 1, -0.9); GL11.glVertex3d(1, 1, -0.9); GL11.glVertex3d(1, -1, -0.9); GL11.glEnd(); GL11.glDisable(GL11.GL_DEPTH_TEST); }
From source file:de.keyle.dungeoncraft.editor.editors.world.render.Renderer.java
License:Open Source License
/** * Renders a nonstandard vertical rectangle (nonstandard referring primarily to * the texture size (ie: when we're not pulling a single element out of a 16x16 * grid). This differs from renderVertical also in that we specify two full * (x, y, z) coordinates for the bounds, instead of passing in y and a height. * Texture coordinates are passed in as the usual float from 0 to 1. * * @param tx X index within the texture * @param ty Y index within the texture * @param tdx Width of texture/*from w w w . j av a 2 s . c om*/ * @param tdy Height of texture * @param x1 * @param y1 * @param z1 * @param x2 * @param y2 * @param z2 */ public static void renderNonstandardVertical(float tx, float ty, float tdx, float tdy, float x1, float y1, float z1, float x2, float y2, float z2) { GL11.glBegin(GL11.GL_TRIANGLE_STRIP); GL11.glTexCoord2f(tx, ty + tdy); GL11.glVertex3f(x1, y1, z1); GL11.glTexCoord2f(tx + tdx, ty + tdy); GL11.glVertex3f(x2, y1, z2); GL11.glTexCoord2f(tx, ty); GL11.glVertex3f(x1, y2, z1); GL11.glTexCoord2f(tx + tdx, ty); GL11.glVertex3f(x2, y2, z2); // unflipped textures /* GL11.glTexCoord2f(tx, ty); GL11.glVertex3f(x1, y1, z1); GL11.glTexCoord2f(tx + tdx, ty); GL11.glVertex3f(x2, y1, z2); GL11.glTexCoord2f(tx, ty + tdy); GL11.glVertex3f(x1, y2, z1); GL11.glTexCoord2f(tx + tdx, ty + tdy); GL11.glVertex3f(x2, y2, z2); */ GL11.glEnd(); }