List of usage examples for org.lwjgl.opengl GL11 glLineWidth
public static void glLineWidth(@NativeType("GLfloat") float width)
From source file:net.malisis.advert.gui.manager.AdvertList.java
License:Open Source License
@Override public void drawElementBackground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick, ClientAdvert advert, boolean isHovered) { if (!isSelected(advert)) return;/*from w w w . j ava 2 s . co m*/ renderer.disableTextures(); int color = /*selected ? 0xBBBBFF :*/0xBBBBEE; rp.colorMultiplier.set(color); shape.resetState(); shape.setSize(getWidth(), getElementHeight(advert)); renderer.drawShape(shape, rp); renderer.next(GL11.GL_LINE_LOOP); GL11.glLineWidth(2); shape.resetState(); shape.setSize(getWidth(), getElementHeight(advert)); rp.colorMultiplier.set(0x000000); renderer.drawShape(shape, rp); renderer.next(GL11.GL_QUADS); renderer.enableTextures(); }
From source file:net.malisis.mdt.gui.component.DebugWindow.java
License:Open Source License
@Override public void drawBackground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick) { GL11.glDisable(GL11.GL_TEXTURE_2D);// ww w. ja v a 2 s. com rp.colorMultiplier.set(0); // black rp.alpha.set(200); renderer.drawShape(shape, rp); renderer.next(GL11.GL_LINE_STRIP); GL11.glLineWidth(2F); shape.resetState(); shape.setSize(getWidth(), getHeight()); //rp.alpha.set(255); renderer.drawShape(shape, rp); renderer.next(GL11.GL_QUADS); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:net.smert.frameworkgl.opengl.OpenGL1.java
License:Apache License
public OpenGL1 setLineWidth(float lineWidth) { GL11.glLineWidth(lineWidth); return this; }
From source file:net.wurstclient.features.mods.BowAimbotMod.java
License:Open Source License
@Override public void onRender(float partialTicks) { if (target == null) return;/*w w w . j av a 2 s . c om*/ // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(2); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glTranslated(-mc.getRenderManager().renderPosX, -mc.getRenderManager().renderPosY, -mc.getRenderManager().renderPosZ); // set position GL11.glTranslated(target.posX, target.posY, target.posZ); // set size double boxWidth = target.width + 0.1; double boxHeight = target.height + 0.1; GL11.glScaled(boxWidth, boxHeight, boxWidth); // move to center GL11.glTranslated(0, 0.5, 0); double v = 1 / velocity; GL11.glScaled(v, v, v); // draw outline GL11.glColor4d(1, 0, 0, 0.5F * velocity); RenderUtils.drawOutlinedBox(TARGET_BOX); // draw box GL11.glColor4d(1, 0, 0, 0.25F * velocity); RenderUtils.drawSolidBox(TARGET_BOX); GL11.glPopMatrix(); // GL resets GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
From source file:OpenGLEngine.RenderGrid.java
public static void RenderGridProposedGhostAtoms(NICS_Grid GridToRender, Object GhastlyLock) { float X, Y, Z; synchronized (GhastlyLock) { // should only render a grid assert (GridToRender.GhostSetType() == 3); //faces points for a full cube: 1,2,3,4; 6,2,3,7; 5,6,7,8; 1,5,8,4; 1,2,6,5; 8,7,3,4; // for only a z-plane: 8,7,3,4 // for only a y plane: 1,5,8,4 // for only an x-plane: 1,2,3,4 // render highlighted planes / cubes if (GridToRender.IsHighlighted()) { if (GridToRender.X_Plane) { // Render Highlight of Bounding plane GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y, RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd();// w w w . j a v a 2 s . c om // render outline GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x, RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glEnd(); // render the grid points if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } //ArrayList<Vector3f[]> QuadPoints } else if (GridToRender.Y_Plane) { // Render Highlight of Bounding plane GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y, RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x, RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glEnd(); // render the grid points if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } else if (GridToRender.Z_Plane) { // Render Highlight of Bounding plane GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y, RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x, RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glEnd(); // render the grid points if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } else { // Render Highlight of Bounding Box //faces points for a full cube: 1,2,3,4; 6,2,3,7; 5,6,7,8; 1,5,8,4; 1,2,6,5; 8,7,3,4; GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y, RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubeSelectedPoints[1].x, GridToRender.CubeSelectedPoints[1].y, GridToRender.CubeSelectedPoints[1].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[2].x, GridToRender.CubeSelectedPoints[2].y, GridToRender.CubeSelectedPoints[2].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[3].x, GridToRender.CubeSelectedPoints[3].y, GridToRender.CubeSelectedPoints[3].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[4].x, GridToRender.CubeSelectedPoints[4].y, GridToRender.CubeSelectedPoints[4].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[6].x, GridToRender.CubeSelectedPoints[6].y, GridToRender.CubeSelectedPoints[6].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[2].x, GridToRender.CubeSelectedPoints[2].y, GridToRender.CubeSelectedPoints[2].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[3].x, GridToRender.CubeSelectedPoints[3].y, GridToRender.CubeSelectedPoints[3].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[7].x, GridToRender.CubeSelectedPoints[7].y, GridToRender.CubeSelectedPoints[7].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[5].x, GridToRender.CubeSelectedPoints[5].y, GridToRender.CubeSelectedPoints[5].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[6].x, GridToRender.CubeSelectedPoints[6].y, GridToRender.CubeSelectedPoints[6].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[7].x, GridToRender.CubeSelectedPoints[7].y, GridToRender.CubeSelectedPoints[7].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[8].x, GridToRender.CubeSelectedPoints[8].y, GridToRender.CubeSelectedPoints[8].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[1].x, GridToRender.CubeSelectedPoints[1].y, GridToRender.CubeSelectedPoints[1].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[5].x, GridToRender.CubeSelectedPoints[5].y, GridToRender.CubeSelectedPoints[5].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[8].x, GridToRender.CubeSelectedPoints[8].y, GridToRender.CubeSelectedPoints[8].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[4].x, GridToRender.CubeSelectedPoints[4].y, GridToRender.CubeSelectedPoints[4].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[1].x, GridToRender.CubeSelectedPoints[1].y, GridToRender.CubeSelectedPoints[1].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[2].x, GridToRender.CubeSelectedPoints[2].y, GridToRender.CubeSelectedPoints[2].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[6].x, GridToRender.CubeSelectedPoints[6].y, GridToRender.CubeSelectedPoints[6].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[5].x, GridToRender.CubeSelectedPoints[5].y, GridToRender.CubeSelectedPoints[5].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[8].x, GridToRender.CubeSelectedPoints[8].y, GridToRender.CubeSelectedPoints[8].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[7].x, GridToRender.CubeSelectedPoints[7].y, GridToRender.CubeSelectedPoints[7].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[3].x, GridToRender.CubeSelectedPoints[3].y, GridToRender.CubeSelectedPoints[3].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[4].x, GridToRender.CubeSelectedPoints[4].y, GridToRender.CubeSelectedPoints[4].z); GL11.glEnd(); // render the internal cube as well GL11.glColor4f(RenderSettings.GridCubeProposedColor.x, RenderSettings.GridCubeProposedColor.y, RenderSettings.GridCubeProposedColor.z, RenderSettings.GridCubeProposedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline of the cube GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x, RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render the grid points if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } // render 'non-highlighted' planes/cubes } else { if (GridToRender.X_Plane) { // Render Bounding plane GL11.glColor4f(RenderSettings.GridCubeProposedColor.x, RenderSettings.GridCubeProposedColor.y, RenderSettings.GridCubeProposedColor.z, RenderSettings.GridCubeProposedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineProposedColor.x, RenderSettings.GridOutlineProposedColor.y, RenderSettings.GridOutlineProposedColor.z, RenderSettings.GridOutlineProposedColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glEnd(); // render the grid points if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x, RenderSettings.GridSurfacePointProposedColor.y, RenderSettings.GridSurfacePointProposedColor.z, RenderSettings.GridOutlineProposedColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x, RenderSettings.GridSurfacePointProposedColor.y, RenderSettings.GridSurfacePointProposedColor.z, RenderSettings.GridOutlineProposedColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } else if (GridToRender.Y_Plane) { // Render Bounding plane GL11.glColor4f(RenderSettings.GridCubeProposedColor.x, RenderSettings.GridCubeProposedColor.y, RenderSettings.GridCubeProposedColor.z, RenderSettings.GridCubeProposedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineProposedColor.x, RenderSettings.GridOutlineProposedColor.y, RenderSettings.GridOutlineProposedColor.z, RenderSettings.GridOutlineProposedColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glEnd(); // render the grid points if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x, RenderSettings.GridSurfacePointProposedColor.y, RenderSettings.GridSurfacePointProposedColor.z, RenderSettings.GridOutlineProposedColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x, RenderSettings.GridSurfacePointProposedColor.y, RenderSettings.GridSurfacePointProposedColor.z, RenderSettings.GridOutlineProposedColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } else if (GridToRender.Z_Plane) { // Render Bounding plane GL11.glColor4f(RenderSettings.GridCubeProposedColor.x, RenderSettings.GridCubeProposedColor.y, RenderSettings.GridCubeProposedColor.z, RenderSettings.GridCubeProposedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineProposedColor.x, RenderSettings.GridOutlineProposedColor.y, RenderSettings.GridOutlineProposedColor.z, RenderSettings.GridOutlineProposedColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glEnd(); // render the grid points if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x, RenderSettings.GridSurfacePointProposedColor.y, RenderSettings.GridSurfacePointProposedColor.z, RenderSettings.GridOutlineProposedColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x, RenderSettings.GridSurfacePointProposedColor.y, RenderSettings.GridSurfacePointProposedColor.z, RenderSettings.GridOutlineProposedColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } else { // Render Bounding Box //faces points for a full cube: 1,2,3,4; 6,2,3,7; 5,6,7,8; 1,5,8,4; 1,2,6,5; 8,7,3,4; GL11.glColor4f(RenderSettings.GridCubeProposedColor.x, RenderSettings.GridCubeProposedColor.y, RenderSettings.GridCubeProposedColor.z, RenderSettings.GridCubeProposedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline of the cube GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineProposedColor.x, RenderSettings.GridOutlineProposedColor.y, RenderSettings.GridOutlineProposedColor.z, RenderSettings.GridOutlineProposedColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render the grid points if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x, RenderSettings.GridSurfacePointProposedColor.y, RenderSettings.GridSurfacePointProposedColor.z, RenderSettings.GridOutlineProposedColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x, RenderSettings.GridSurfacePointProposedColor.y, RenderSettings.GridSurfacePointProposedColor.z, RenderSettings.GridOutlineProposedColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } } } }
From source file:OpenGLEngine.RenderGrid.java
public static void RenderGridGhostAtoms(NICS_Grid GridToRender, Object GhastlyLock) { float X, Y, Z; synchronized (GhastlyLock) { // should only render a grid assert (GridToRender.GhostSetType() == 3); //faces points for a full cube: 1,2,3,4; 6,2,3,7; 5,6,7,8; 1,5,8,4; 1,2,6,5; 8,7,3,4; // for only a z-plane: 8,7,3,4 // for only a y plane: 1,5,8,4 // for only an x-plane: 1,2,3,4 // render highlighted planes / cubes if (GridToRender.IsHighlighted()) { if (GridToRender.X_Plane) { // Render Highlight of Bounding plane GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y, RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd();//from ww w . j a v a 2s .c o m // render outline GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x, RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glEnd(); // render grid points if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } else if (GridToRender.Y_Plane) { // Render Highlight of Bounding plane GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y, RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x, RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glEnd(); if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } else if (GridToRender.Z_Plane) { // Render Highlight of Bounding plane GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y, RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x, RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glEnd(); if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } else { // Render Highlight of Bounding Box //faces points for a full cube: 1,2,3,4; 6,2,3,7; 5,6,7,8; 1,5,8,4; 1,2,6,5; 8,7,3,4; GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y, RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubeSelectedPoints[1].x, GridToRender.CubeSelectedPoints[1].y, GridToRender.CubeSelectedPoints[1].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[2].x, GridToRender.CubeSelectedPoints[2].y, GridToRender.CubeSelectedPoints[2].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[3].x, GridToRender.CubeSelectedPoints[3].y, GridToRender.CubeSelectedPoints[3].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[4].x, GridToRender.CubeSelectedPoints[4].y, GridToRender.CubeSelectedPoints[4].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[6].x, GridToRender.CubeSelectedPoints[6].y, GridToRender.CubeSelectedPoints[6].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[2].x, GridToRender.CubeSelectedPoints[2].y, GridToRender.CubeSelectedPoints[2].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[3].x, GridToRender.CubeSelectedPoints[3].y, GridToRender.CubeSelectedPoints[3].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[7].x, GridToRender.CubeSelectedPoints[7].y, GridToRender.CubeSelectedPoints[7].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[5].x, GridToRender.CubeSelectedPoints[5].y, GridToRender.CubeSelectedPoints[5].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[6].x, GridToRender.CubeSelectedPoints[6].y, GridToRender.CubeSelectedPoints[6].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[7].x, GridToRender.CubeSelectedPoints[7].y, GridToRender.CubeSelectedPoints[7].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[8].x, GridToRender.CubeSelectedPoints[8].y, GridToRender.CubeSelectedPoints[8].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[1].x, GridToRender.CubeSelectedPoints[1].y, GridToRender.CubeSelectedPoints[1].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[5].x, GridToRender.CubeSelectedPoints[5].y, GridToRender.CubeSelectedPoints[5].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[8].x, GridToRender.CubeSelectedPoints[8].y, GridToRender.CubeSelectedPoints[8].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[4].x, GridToRender.CubeSelectedPoints[4].y, GridToRender.CubeSelectedPoints[4].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[1].x, GridToRender.CubeSelectedPoints[1].y, GridToRender.CubeSelectedPoints[1].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[2].x, GridToRender.CubeSelectedPoints[2].y, GridToRender.CubeSelectedPoints[2].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[6].x, GridToRender.CubeSelectedPoints[6].y, GridToRender.CubeSelectedPoints[6].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[5].x, GridToRender.CubeSelectedPoints[5].y, GridToRender.CubeSelectedPoints[5].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[8].x, GridToRender.CubeSelectedPoints[8].y, GridToRender.CubeSelectedPoints[8].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[7].x, GridToRender.CubeSelectedPoints[7].y, GridToRender.CubeSelectedPoints[7].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[3].x, GridToRender.CubeSelectedPoints[3].y, GridToRender.CubeSelectedPoints[3].z); GL11.glVertex3f(GridToRender.CubeSelectedPoints[4].x, GridToRender.CubeSelectedPoints[4].y, GridToRender.CubeSelectedPoints[4].z); GL11.glEnd(); // render the internal cube as well GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y, RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(RenderSettings.GridCubeColor.x, RenderSettings.GridCubeColor.y, RenderSettings.GridCubeColor.z, RenderSettings.GridCubeColor.w); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline of the cube GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x, RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x, RenderSettings.GridSurfacePointSelectedColor.y, RenderSettings.GridSurfacePointSelectedColor.z, RenderSettings.GridOutlineSelectedColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } // render 'non-highlighted' planes/cubes } else { if (GridToRender.X_Plane) { // Render Bounding plane GL11.glColor4f(RenderSettings.GridCubeColor.x, RenderSettings.GridCubeColor.y, RenderSettings.GridCubeColor.z, RenderSettings.GridCubeColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineColor.x, RenderSettings.GridOutlineColor.y, RenderSettings.GridOutlineColor.z, RenderSettings.GridOutlineColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glEnd(); if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointColor.x, RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z, RenderSettings.GridOutlineColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointColor.x, RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z, RenderSettings.GridOutlineColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } else if (GridToRender.Y_Plane) { // Render Bounding plane GL11.glColor4f(RenderSettings.GridCubeColor.x, RenderSettings.GridCubeColor.y, RenderSettings.GridCubeColor.z, RenderSettings.GridCubeColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineColor.x, RenderSettings.GridOutlineColor.y, RenderSettings.GridOutlineColor.z, RenderSettings.GridOutlineColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glEnd(); if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointColor.x, RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z, RenderSettings.GridOutlineColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointColor.x, RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z, RenderSettings.GridOutlineColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } else if (GridToRender.Z_Plane) { // Render Bounding plane GL11.glColor4f(RenderSettings.GridCubeColor.x, RenderSettings.GridCubeColor.y, RenderSettings.GridCubeColor.z, RenderSettings.GridCubeColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineColor.x, RenderSettings.GridOutlineColor.y, RenderSettings.GridOutlineColor.z, RenderSettings.GridOutlineColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glEnd(); if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointColor.x, RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z, RenderSettings.GridOutlineColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointColor.x, RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z, RenderSettings.GridOutlineColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } else { // Render Bounding Box //faces points for a full cube: 1,2,3,4; 6,2,3,7; 5,6,7,8; 1,5,8,4; 1,2,6,5; 8,7,3,4; GL11.glColor4f(RenderSettings.GridCubeColor.x, RenderSettings.GridCubeColor.y, RenderSettings.GridCubeColor.z, RenderSettings.GridCubeColor.w); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); // render outline of the cube GL11.glLineWidth(RenderSettings.OutlineLineWidth); GL11.glColor4f(RenderSettings.GridOutlineColor.x, RenderSettings.GridOutlineColor.y, RenderSettings.GridOutlineColor.z, RenderSettings.GridOutlineColor.w); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y, GridToRender.CubePoints[2].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y, GridToRender.CubePoints[3].z); GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y, GridToRender.CubePoints[6].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y, GridToRender.CubePoints[7].z); GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y, GridToRender.CubePoints[5].z); GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y, GridToRender.CubePoints[1].z); GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y, GridToRender.CubePoints[8].z); GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y, GridToRender.CubePoints[4].z); GL11.glEnd(); if (!RenderSettings.RenderPointsAsQuad) { GL11.glPointSize(RenderSettings.GridPointSize); GL11.glColor4f(RenderSettings.GridSurfacePointColor.x, RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z, RenderSettings.GridOutlineColor.w); GL11.glBegin(GL11.GL_POINTS); for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) { GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x, GridToRender.SurfaceAtomCoordinates.get(itor).y, GridToRender.SurfaceAtomCoordinates.get(itor).z); } GL11.glEnd(); // render the points as a quad } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) { GL11.glColor4f(RenderSettings.GridSurfacePointColor.x, RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z, RenderSettings.GridOutlineColor.w); GL11.glBegin(GL11.GL_TRIANGLES); for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) { // rendered as a triangle instead X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[1].x; Y = GridToRender.QuadPoints.get(itor)[1].y; Z = GridToRender.QuadPoints.get(itor)[1].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[0].x; Y = GridToRender.QuadPoints.get(itor)[0].y; Z = GridToRender.QuadPoints.get(itor)[0].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[2].x; Y = GridToRender.QuadPoints.get(itor)[2].y; Z = GridToRender.QuadPoints.get(itor)[2].z; GL11.glVertex3f(X, Y, Z); X = GridToRender.QuadPoints.get(itor)[3].x; Y = GridToRender.QuadPoints.get(itor)[3].y; Z = GridToRender.QuadPoints.get(itor)[3].z; GL11.glVertex3f(X, Y, Z); } GL11.glEnd(); } } } } }
From source file:org.craftmania.world.World.java
License:Apache License
private void renderOverlay() { Configuration conf = Game.getInstance().getConfiguration(); Game.getInstance().initOverlayRendering(); GL11.glColor3f(1, 1, 1);/*ww w . jav a 2s. c om*/ if (Game.RENDER_INFORMATION_OVERLAY) { GLFont infoFont = FontStorage.getFont("Monospaced_20"); /* Down Left Info */ infoFont.print(4, 4, "CraftMania"); infoFont.print(4, 30, _player.coordinatesToString()); infoFont.print(4, 45, "Visible Chunks: " + _visibleChunks.size()); infoFont.print(4, 60, "Updading Blocks: " + _updatingBlocks); infoFont.print(4, 75, "Total Chunks in RAM: " + _chunkManager.getTotalChunkCount()); infoFont.print(4, 90, "Local Chunks: " + _localChunks.size()); infoFont.print(4, 105, "Total Local Blocks: " + _localBlockCount); infoFont.print(4, 120, "Time: " + _time); infoFont.print(4, 135, "Sunlight: " + _sunlight); } /** RENDER **/ if (_activatedInventory != null) { Game.getInstance().renderTransculentOverlayLayer(); _activatedInventory.renderInventory(); } else { int width = conf.getWidth(); int height = conf.getHeight(); // Center Cross GL11.glDisable(GL11.GL_TEXTURE_2D); if (CENTER_CROSS_CALL_LIST == 0) { CENTER_CROSS_CALL_LIST = GL11.glGenLists(1); GL11.glNewList(CENTER_CROSS_CALL_LIST, GL11.GL_COMPILE_AND_EXECUTE); int crossSize = 10; int crossHole = 5; GL11.glLineWidth(2.5f); GL11.glColor3f(0, 0, 0); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(width / 2f - crossSize - crossHole, height / 2f, 0); GL11.glVertex3f(width / 2f - crossHole, height / 2f, 0); GL11.glVertex3f(width / 2f + crossSize + crossHole, height / 2f, 0); GL11.glVertex3f(width / 2f + crossHole, height / 2f, 0); GL11.glVertex3f(width / 2f, height / 2f - crossSize - crossHole, 0); GL11.glVertex3f(width / 2f, height / 2f - crossHole, 0); GL11.glVertex3f(width / 2f, height / 2f + crossSize + crossHole, 0); GL11.glVertex3f(width / 2f, height / 2f + crossHole, 0); GL11.glEnd(); GL11.glEndList(); } else { GL11.glCallList(CENTER_CROSS_CALL_LIST); } GL11.glEnable(GL11.GL_TEXTURE_2D); // Inventory bar GL11.glPushMatrix(); Texture texGui = TextureStorage.getTexture("gui.gui"); texGui.bind(); float tileSize = 20.0f / texGui.getImageWidth(); if (INVENTORY_BAR_CALL_LIST == 0) { INVENTORY_BAR_CALL_LIST = GL11.glGenLists(2); /* Bar */ GL11.glNewList(INVENTORY_BAR_CALL_LIST, GL11.GL_COMPILE_AND_EXECUTE); GL11.glTranslatef(width / 2.0f - 9 * 20, 10, 0); GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2f(0, 40); GL11.glTexCoord2f(tileSize * 9, 0); GL11.glVertex2f(9 * 40, 40); GL11.glTexCoord2f(tileSize * 9, tileSize); GL11.glVertex2f(9 * 40, 0); GL11.glTexCoord2f(0, tileSize); GL11.glVertex2f(0, 0); GL11.glEnd(); GL11.glEndList(); /* Little frame around selected item */ float frameTileSize = 24.0f / texGui.getImageWidth(); float frameTileY = 22.0f / texGui.getImageHeight(); GL11.glNewList(INVENTORY_BAR_CALL_LIST + 1, GL11.GL_COMPILE); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, frameTileY); GL11.glVertex2f(0, 48); GL11.glTexCoord2f(frameTileSize, frameTileY); GL11.glVertex2f(48, 48); GL11.glTexCoord2f(frameTileSize, frameTileY + frameTileSize); GL11.glVertex2f(48, 0); GL11.glTexCoord2f(0, frameTileY + frameTileSize); GL11.glVertex2f(0, 0); GL11.glEnd(); GL11.glEndList(); } else { GL11.glCallList(INVENTORY_BAR_CALL_LIST); } /* Content */ GL11.glPushMatrix(); GL11.glTranslatef(20, 20, 0); for (int i = 0; i < 9; ++i) { InventoryPlace place = getActivePlayer().getInventory().getInventoryPlace(i); if (place != null) place.render(); GL11.glTranslatef(40, 0, 0); } texGui.bind(); GL11.glPopMatrix(); GL11.glTranslatef(getActivePlayer().getSelectedInventoryItemIndex() * 40.0f - 4, -4, 0); GL11.glCallList(INVENTORY_BAR_CALL_LIST + 1); GL11.glPopMatrix(); } }
From source file:org.eclipse.swt.opengl.examples.LWJGLExample.java
License:Open Source License
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Composite comp = new Composite(shell, SWT.NONE); comp.setLayout(new FillLayout()); GLData data = new GLData(); data.doubleBuffer = true;// w ww. ja va 2 s.c o m final GLCanvas canvas = new GLCanvas(comp, SWT.NONE, data); canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } canvas.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { Rectangle bounds = canvas.getBounds(); float fAspect = (float) bounds.width / (float) bounds.height; canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } GL11.glViewport(0, 0, bounds.width, bounds.height); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); } }); GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); GL11.glColor3f(1.0f, 0.0f, 0.0f); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glClearDepth(1.0); GL11.glLineWidth(2); GL11.glEnable(GL11.GL_DEPTH_TEST); shell.setText("SWT/LWJGL Example"); shell.setSize(640, 480); shell.open(); display.asyncExec(new Runnable() { int rot = 0; public void run() { if (!canvas.isDisposed()) { canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glClearColor(.3f, .5f, .8f, 1.0f); GL11.glLoadIdentity(); GL11.glTranslatef(0.0f, 0.0f, -10.0f); float frot = rot; GL11.glRotatef(0.15f * rot, 2.0f * frot, 10.0f * frot, 1.0f); GL11.glRotatef(0.3f * rot, 3.0f * frot, 1.0f * frot, 1.0f); rot++; GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); GL11.glColor3f(0.9f, 0.9f, 0.9f); drawTorus(1, 1.9f + ((float) Math.sin((0.004f * frot))), 15, 15); canvas.swapBuffers(); display.asyncExec(this); } } }); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet195.java
License:Open Source License
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Composite comp = new Composite(shell, SWT.NONE); comp.setLayout(new FillLayout()); GLData data = new GLData(); data.doubleBuffer = true;//from w w w . j a v a 2 s. c o m final GLCanvas canvas = new GLCanvas(comp, SWT.NONE, data); canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } canvas.addListener(SWT.Resize, new Listener() { @Override public void handleEvent(Event event) { Rectangle bounds = canvas.getBounds(); float fAspect = (float) bounds.width / (float) bounds.height; canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } GL11.glViewport(0, 0, bounds.width, bounds.height); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); } }); GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); GL11.glColor3f(1.0f, 0.0f, 0.0f); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glClearDepth(1.0); GL11.glLineWidth(2); GL11.glEnable(GL11.GL_DEPTH_TEST); shell.setText("SWT/LWJGL Example"); shell.setSize(640, 480); shell.open(); final Runnable run = new Runnable() { int rot = 0; @Override public void run() { if (!canvas.isDisposed()) { canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glClearColor(.3f, .5f, .8f, 1.0f); GL11.glLoadIdentity(); GL11.glTranslatef(0.0f, 0.0f, -10.0f); float frot = rot; GL11.glRotatef(0.15f * rot, 2.0f * frot, 10.0f * frot, 1.0f); GL11.glRotatef(0.3f * rot, 3.0f * frot, 1.0f * frot, 1.0f); rot++; GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); GL11.glColor3f(0.9f, 0.9f, 0.9f); drawTorus(1, 1.9f + ((float) Math.sin((0.004f * frot))), 15, 15); canvas.swapBuffers(); display.asyncExec(this); } } }; canvas.addListener(SWT.Paint, new Listener() { @Override public void handleEvent(Event event) { run.run(); } }); display.asyncExec(run); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet341.java
License:Open Source License
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); GLData data = new GLData(); data.doubleBuffer = true;/*from w w w . ja v a2 s . c o m*/ final GLCanvas canvas = new GLCanvas(shell, SWT.NONE, data); canvas.setLayoutData(new GridData(640, 480)); canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } canvas.addListener(SWT.Resize, new Listener() { @Override public void handleEvent(Event event) { Rectangle bounds = canvas.getBounds(); float fAspect = (float) bounds.width / (float) bounds.height; canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } GL11.glViewport(0, 0, bounds.width, bounds.height); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); } }); GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); GL11.glColor3f(1.0f, 0.0f, 0.0f); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glClearDepth(1.0); GL11.glLineWidth(2); GL11.glEnable(GL11.GL_DEPTH_TEST); Button button = new Button(shell, SWT.PUSH); button.setText("Capture"); button.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { capture(canvas); } }); shell.pack(); shell.open(); display.asyncExec(new Runnable() { int rot = 0; @Override public void run() { if (!canvas.isDisposed()) { canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glClearColor(.3f, .5f, .8f, 1.0f); GL11.glLoadIdentity(); GL11.glTranslatef(0.0f, 0.0f, -10.0f); float frot = rot; GL11.glRotatef(0.15f * rot, 2.0f * frot, 10.0f * frot, 1.0f); GL11.glRotatef(0.3f * rot, 3.0f * frot, 1.0f * frot, 1.0f); rot++; GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); GL11.glColor3f(0.9f, 0.9f, 0.9f); drawTorus(1, 1.9f + ((float) Math.sin((0.004f * frot))), 15, 15); canvas.swapBuffers(); display.asyncExec(this); } } }); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }