Java Code Examples for org.lwjgl.opengl.GL11#glColor3f()
The following examples show how to use
org.lwjgl.opengl.GL11#glColor3f() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GDataCSG.java From ldparteditor with MIT License | 6 votes |
public synchronized static void drawSelectionCSG(Composite3D c3d, final boolean modifiedManipulator) { final HashSet<GData3> selectedTriangles = selectedTrianglesMap.putIfAbsent(c3d.getLockableDatFileReference(), new HashSet<GData3>()); if (!selectedTriangles.isEmpty()) { GL11.glColor3f(View.vertex_selected_Colour_r[0], View.vertex_selected_Colour_g[0], View.vertex_selected_Colour_b[0]); GL11.glBegin(GL11.GL_LINES); for (GData3 tri : selectedTriangles) { GL11.glVertex3f(tri.x1, tri.y1, tri.z1); GL11.glVertex3f(tri.x2, tri.y2, tri.z2); GL11.glVertex3f(tri.x2, tri.y2, tri.z2); GL11.glVertex3f(tri.x3, tri.y3, tri.z3); GL11.glVertex3f(tri.x3, tri.y3, tri.z3); GL11.glVertex3f(tri.x1, tri.y1, tri.z1); } GL11.glEnd(); } }
Example 2
Source File: GUIRoot.java From tribaltrouble with GNU General Public License v2.0 | 6 votes |
protected final void renderGeometry() { getDelegate().render2D(); Skin.getSkin().bindTexture(); GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE); GL11.glColor3f(1f, 1f, 1f); GL11.glBegin(GL11.GL_QUADS); // MUST END IN POSTRENDER! // render forced delegates for (int i = 0; i < delegate_stack.size() - 1; i++) { CameraDelegate delegate = (CameraDelegate)delegate_stack.get(i); if (delegate.forceRender()) { delegate.render(); } } }
Example 3
Source File: NotificationDisplay.java From Cyberware with MIT License | 6 votes |
@Override public void render(int x, int y) { Minecraft.getMinecraft().getTextureManager().bindTexture(HudHandler.HUD_TEXTURE); GL11.glPushMatrix(); float[] color = CyberwareAPI.getHUDColor(); GL11.glColor3f(color[0], color[1], color[2]); ClientUtils.drawTexturedModalRect(x, y + 1, 0, 25, 15, 14); GL11.glPopMatrix(); GL11.glColor3f(1F, 1F, 1F); if (light) { ClientUtils.drawTexturedModalRect(x + 9, y + 1 + 7, 15, 25, 7, 9); } else { ClientUtils.drawTexturedModalRect(x + 8, y + 1 + 7, 22, 25, 8, 9); } }
Example 4
Source File: SelectionDelegate.java From tribaltrouble with GNU General Public License v2.0 | 6 votes |
public final void render2D() { if (selection) { GL11.glColor3f(.3f, 1f, 0f); GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE); GL11.glPolygonMode(GL11.GL_BACK, GL11.GL_LINE); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(selection_x1, selection_y1, 0f); GL11.glVertex3f(selection_x2, selection_y1, 0f); GL11.glVertex3f(selection_x2, selection_y2, 0f); GL11.glVertex3f(selection_x1, selection_y2, 0f); GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL); GL11.glPolygonMode(GL11.GL_BACK, GL11.GL_FILL); } }
Example 5
Source File: PathTracker.java From tribaltrouble with GNU General Public License v2.0 | 5 votes |
public final void debugRender() { HeightMap heightmap = unit_grid.getHeightMap(); bezier_path.debugRender(heightmap); final float OFFSET = 2f; float next_node_x = UnitGrid.coordinateFromGrid(next_unit_grid_x); float next_node_y = UnitGrid.coordinateFromGrid(next_unit_grid_y); float next_x = next_node_x; float next_y = next_node_y; float z = heightmap.getNearestHeight(next_x, next_y) + OFFSET; GridPathNode node = grid_path; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(1f, 0f, 0f); GL11.glLineWidth(2f); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex3f(next_x, next_y, z); while (node != null) { next_x += HeightMap.METERS_PER_UNIT_GRID*node.getDirection().getDirectionX(); next_y += HeightMap.METERS_PER_UNIT_GRID*node.getDirection().getDirectionY(); z = heightmap.getNearestHeight(next_x, next_y) + OFFSET; GL11.glVertex3f(next_x, next_y, z); node = (GridPathNode)node.getParent(); } GL11.glEnd(); GL11.glColor3f(0f, 0f, 1f); GL11.glLineWidth(5f); GL11.glBegin(GL11.GL_LINE_STRIP); RegionNode region_node = region_path; while (region_node != null) { float x = UnitGrid.coordinateFromGrid(region_node.getRegion().getGridX()); float y = UnitGrid.coordinateFromGrid(region_node.getRegion().getGridY()); z = heightmap.getNearestHeight(x, y) + OFFSET; GL11.glVertex3f(x, y, z); region_node = (RegionNode)region_node.getParent(); } GL11.glEnd(); GL11.glLineWidth(1f); GL11.glEnable(GL11.GL_TEXTURE_2D); }
Example 6
Source File: WidgetFluidTank.java From ExtraCells1 with MIT License | 5 votes |
public void draw(int guiX, int guiY, int mouseX, int mouseY) { if (tank == null || 73 < 31) return; GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor3f(1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/gui/fluidtank.png")); drawTexturedModalRect(posX, posY, 0, 0, 18, 73); int iconHeightRemainder = (73 - 4) % 16; FluidStack fluid = tank.getFluid(); if (fluid != null && fluid.amount > 0) { Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); Icon fluidIcon = fluid.getFluid().getStillIcon(); if (iconHeightRemainder > 0) { drawTexturedModelRectFromIcon(posX + 1, posY + 2, fluidIcon, 16, iconHeightRemainder); } for (int i = 0; i < (73 - 6) / 16; i++) { drawTexturedModelRectFromIcon(posX + 1, posY + 2 + i * 16 + iconHeightRemainder, fluidIcon, 16, 16); } Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/gui/fluidtank.png")); drawTexturedModalRect(posX + 2, posY + 1, 1, 1, 15, 72 - ((int) ((73) * ((float) fluid.amount / tank.getCapacity())))); } Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/gui/fluidtank.png")); drawTexturedModalRect(posX + 1, posY + 1, 19, 1, 16, 73); GL11.glEnable(GL11.GL_LIGHTING); }
Example 7
Source File: TargetRespondRenderer.java From tribaltrouble with GNU General Public License v2.0 | 5 votes |
public final void renderShadows(LandscapeRenderer renderer) { setupShadows(); GL11.glColor3f(0f, 1f, 0f); for (int i = 0; i < target_list.size(); i++) { LandscapeTargetRespond target = (LandscapeTargetRespond)target_list.get(i); target_list.set(i, null); GL11.glBindTexture(GL11.GL_TEXTURE_2D, ring.getHandle()); renderShadow(renderer, SHADOW_SIZE*target.getProgress(), target.getPositionX(), target.getPositionY()); } resetShadows(); target_list.clear(); }
Example 8
Source File: SpriteRenderer.java From tribaltrouble with GNU General Public License v2.0 | 5 votes |
public final void renderNoDetail(ModelState model) { float[] color = model.getTeamColor(); GL11.glColor3f(color[0], color[1], color[2]); GL11.glBegin(GL11.GL_QUADS); float x = model.getModel().getPositionX(); float y = model.getModel().getPositionY(); float z = model.getModel().getPositionZ(); float r = model.getModel().getNoDetailSize(); GL11.glVertex3f(x - r, y - r, z); GL11.glVertex3f(x + r, y - r, z); GL11.glVertex3f(x + r, y + r, z); GL11.glVertex3f(x - r, y + r, z); GL11.glEnd(); }
Example 9
Source File: BW_GUIContainer_RotorBlock.java From bartworks with MIT License | 5 votes |
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor3f(0.5f, 0.25f, 0.07f); this.mc.getTextureManager().bindTexture(new ResourceLocation(MainMod.MOD_ID, "textures/GUI/GUIPrimitiveKUBox.png")); int j = (this.width - this.xSize) / 2; int k = (this.height - this.ySize) / 2; this.drawTexturedModalRect(j, k, 0, 0, this.xSize, this.ySize); if (this.container.base.guiisoverload() && this.container.base.checkrotor()) { this.drawTexturedModalRect(j + 44, k + 20, 176, 0, 30, 26); this.drawTexturedModalRect(j + 102, k + 20, 176, 0, 30, 26); } }
Example 10
Source File: BlendLighting.java From tribaltrouble with GNU General Public License v2.0 | 5 votes |
public final void setup() { GLState.activeTexture(GL13.GL_TEXTURE1); GL11.glColor3f(r, b, g); GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE); GL11.glEnable(GL11.GL_TEXTURE_2D); bindAlpha(); GLState.activeTexture(GL13.GL_TEXTURE0); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_ONE); }
Example 11
Source File: BezierPath.java From tribaltrouble with GNU General Public License v2.0 | 5 votes |
public final void debugRender(HeightMap heightmap) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(1f, 1f, 1f); GL11.glBegin(GL11.GL_LINE_STRIP); for (float t = 0f; t < 1f; t += .01f) { computeCurvePointFromTime(t, debug_point, debug_dir); GL11.glVertex3f(debug_point[0], debug_point[1], heightmap.getNearestHeight(debug_point[0], debug_point[1]) + 0.5f); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); }
Example 12
Source File: OffscreenBuffer.java From LWJGUI with MIT License | 4 votes |
public void render(Context context, int x, int y, int w, int h) { if (quadShader == null) { quadShader = new GenericShader(); } float pixelRatio = LWJGUI.getThreadWindow().getPixelRatio(); x *= pixelRatio; y *= pixelRatio; GL11.glViewport(x, y,(int) (w*pixelRatio),(int) (h*pixelRatio)); quadShader.bind(); quadShader.projectOrtho(0, 0, w, h); if (quadDirty) { quadDirty = false; if (quad != null) { quad.cleanup(); } quad = new TexturedQuad(0, 0, w, h, texId); } if ( context.isCoreOpenGL() ) { if ( quad != null ) { quad.render(); } } else { GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texId); GL11.glBegin(GL11.GL_QUADS); GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glTexCoord2f(0, 0); GL11.glVertex2f(0, 0); GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glTexCoord2f(1, 0); GL11.glVertex2f(w, 0); GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glTexCoord2f(1, 1); GL11.glVertex2f(w, h); GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glTexCoord2f(0, 1); GL11.glVertex2f(0, h); GL11.glEnd(); } }
Example 13
Source File: OpenGLHelper.java From Et-Futurum with The Unlicense | 4 votes |
public static void colour(float r, float g, float b) { GL11.glColor3f(r, g, b); }
Example 14
Source File: ModuleOreMapper.java From AdvancedRocketry with MIT License | 4 votes |
@Override public void renderForeground(int guiOffsetX, int guiOffsetY, int mouseX, int mouseY, float zLevel, GuiContainer gui, FontRenderer font) { super.renderForeground(guiOffsetX, guiOffsetY, mouseX, mouseY, zLevel, gui, font); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); //Draw fancy things GlStateManager.disableTexture2D(); buffer.color(0f, 0.8f, 0f, 1f); buffer.begin(GL11.GL_QUADS, buffer.getVertexFormat()); buffer.pos(-21, 82 + fancyScanOffset, (double)zLevel).endVertex(); buffer.pos(0, 84 + fancyScanOffset, (double)zLevel).endVertex(); buffer.pos(0, 81 + fancyScanOffset, (double)zLevel).endVertex(); buffer.pos(-21, 81 + fancyScanOffset, (double)zLevel).endVertex(); buffer.finishDrawing(); buffer.begin(GL11.GL_QUADS, buffer.getVertexFormat()); buffer.pos(-21, 82 - fancyScanOffset + FANCYSCANMAXSIZE, (double)zLevel).endVertex(); buffer.pos(0, 84 - fancyScanOffset + FANCYSCANMAXSIZE, (double)zLevel).endVertex(); buffer.pos(0, 81 - fancyScanOffset + FANCYSCANMAXSIZE, (double)zLevel).endVertex(); buffer.pos(-21, 81 - fancyScanOffset + FANCYSCANMAXSIZE, (double)zLevel).endVertex(); buffer.finishDrawing(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA); buffer.color(0.5f, 0.5f, 0.0f,0.3f + ((float)Math.sin(Math.PI*(fancyScanOffset/(float)FANCYSCANMAXSIZE))/3f)); buffer.begin(GL11.GL_QUADS, buffer.getVertexFormat()); RenderHelper.renderNorthFace(buffer, (double)zLevel, 173, 82, 194, 141); buffer.finishDrawing(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); if(world.getTotalWorldTime() - prevWorldTickTime >= 1 ) { prevWorldTickTime = world.getTotalWorldTime(); if(fancyScanOffset >= FANCYSCANMAXSIZE) fancyScanOffset = 0; else fancyScanOffset++; } //If a slot is selected draw an indicator int slot; if((slot = tile.getSelectedSlot()) != -1) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0f, 0.8f, 0f); buffer.begin(GL11.GL_QUADS, buffer.getVertexFormat()); RenderHelper.renderNorthFaceWithUV(buffer, zLevel, 13 + (18*slot), 155, 13 + 16 + (18*slot), 155 + 16, 0, 1, 0, 1); buffer.finishDrawing(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
Example 15
Source File: RenderTerraformerAtm.java From AdvancedRocketry with MIT License | 4 votes |
@Override public void render(TileEntity tile, double x, double y, double z, float f, int damage, float a) { TileMultiBlock multiBlockTile = (TileMultiBlock)tile; if(!multiBlockTile.canRender()) return; GL11.glPushMatrix(); //Initial setup //Rotate and move the model into position GL11.glTranslated(x + 0.5, y, z + 0.5); EnumFacing front = RotatableBlock.getFront(tile.getWorld().getBlockState(tile.getPos())); //tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord)); GL11.glRotatef((front.getFrontOffsetX() == 1 ? 180 : 0) + front.getFrontOffsetZ()*90f, 0, 1, 0); GL11.glTranslated(1f, 0, 0f); bindTexture(TextureResources.fan); model.renderOnly("Fan"); bindTexture(TextureResources.metalPlate); model.renderOnly("Body"); float col = .4f; GL11.glColor3f(col, col, col); model.renderOnly("DarkBody"); col = 1f; GL11.glColor3f(col, col, col); bindTexture(TextureResources.diamondMetal); model.renderOnly("Floor"); //Baked a light map, make tubes smooth GL11.glDisable(GL11.GL_LIGHTING); bindTexture(tubeTexture); model.renderOnly("Tubes"); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0, 0.9f, col); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 196, 196); model.renderOnly("BlueRing"); GL11.glColor3f(col, col, col); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); }
Example 16
Source File: Model.java From pycode-minecraft with MIT License | 4 votes |
public void genList() { this.glList = GL11.glGenLists(1); GL11.glNewList(this.glList, GL11.GL_COMPILE); // if use_texture: glEnable(GL_TEXTURE_2D) GL11.glFrontFace(GL11.GL_CCW); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL); GL11.glDepthFunc(GL11.GL_LESS); GL11.glCullFace(GL11.GL_BACK); String currentMaterial = ""; Material mtl; for (Face face : this.faces) { if (!face.material.equals(currentMaterial)) { currentMaterial = face.material; mtl = this.materials.get(face.material); if (mtl == null) { GL11.glColor3f(1, 1, 1); } else { // if 'texture_Kd' in mtl: // # use diffuse texmap // glBindTexture(GL_TEXTURE_2D, mtl['texture_Kd']) GL11.glColor3f(mtl.diffuse.x, mtl.diffuse.y, mtl.diffuse.z); } } GL11.glBegin(GL11.GL_POLYGON); for (int i = 0; i < face.vertexes.size(); i++) { if (face.normals.get(i) != 0) { Vector3f n = this.normals.get(face.normals.get(i)); GL11.glNormal3f(n.x, n.y, n.z); } // if texture_coords[i]: // glTexCoord2fv(self.texcoords[texture_coords[i] - 1]) Vector3f v = this.vertices.get(face.vertexes.get(i)); GL11.glVertex3f(v.x, v.y, v.z); } GL11.glEnd(); } GL11.glCullFace(GL11.GL_BACK); GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL); GL11.glDisable(GL11.GL_CULL_FACE); // if use_texture: glDisable(GL11.GL_TEXTURE_2D); GL11.glEndList(); }
Example 17
Source File: RenderTank.java From AdvancedRocketry with MIT License | 4 votes |
@Override public void render(TileEntity tile, double x, double y, double z, float f, int damage, float a) { IFluidHandler fluidTile = (IFluidHandler)tile; FluidStack fluid = fluidTile.getTankProperties()[0].getContents(); ResourceLocation fluidIcon = new ResourceLocation("advancedrocketry:textures/blocks/fluid/oxygen_flow.png"); if(fluid != null && fluid.getFluid() != null) { GL11.glPushMatrix(); GL11.glTranslatef((float)x, (float)y, (float)z); double minU = 0, maxU = 1, minV = 0, maxV = 1; TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks(); TextureAtlasSprite sprite = map.getTextureExtry(fluid.getFluid().getStill().toString()); if(sprite != null) { minU = sprite.getMinU(); maxU = sprite.getMaxU(); minV = sprite.getMinV(); maxV = sprite.getMaxV(); GlStateManager.bindTexture(map.getGlTextureId()); } else { int color = fluid.getFluid().getColor(); GL11.glColor4f(((color >>> 16) & 0xFF)/255f, ((color >>> 8) & 0xFF)/255f, ((color& 0xFF)/255f),1f); bindTexture(fluidIcon); } Block block = tile.getBlockType(); Tessellator tess = Tessellator.getInstance(); float amt = fluid.amount / (float)fluidTile.getTankProperties()[0].getCapacity(); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); AxisAlignedBB bb = block.getDefaultState().getBoundingBox(tile.getWorld(), tile.getPos()); tess.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); RenderHelper.renderCubeWithUV(tess.getBuffer(), bb.minX + 0.01, bb.minY + 0.01, bb.minZ + 0.01, bb.maxX - 0.01, bb.maxY*amt - 0.01, bb.maxZ - 0.01, minU, maxU, minV, maxV); tess.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); GL11.glColor3f(1f, 1f, 1f); } }
Example 18
Source File: Snippet195.java From ldparteditor with MIT License | 4 votes |
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; final GLCanvas canvas = new GLCanvas(comp, SWT.NONE, data); canvas.setCurrent(); // try { // GLContext.useContext(canvas); // } catch (LWJGLException e) { // e.printStackTrace(); // } canvas.addListener(SWT.Resize, 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"); //$NON-NLS-1$ shell.setSize(640, 480); 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.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_FILL); GL11.glColor3f(0.9f, 0.9f, 0.9f); drawTorus(1, 1.9f + (float) Math.sin(0.004f * frot), 15, 15); GL11.glColor3f(0.9f, 0.9f, 0f); drawTorus(1.9f, 5.9f + (float) Math.sin(0.004f * frot), 15, 15); canvas.swapBuffers(); display.asyncExec(this); } } }); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
Example 19
Source File: Arrow.java From ldparteditor with MIT License | 4 votes |
public void drawGL20(float x, float y, float z, float zoom) { final float zoom_inv = 1f / zoom; GL11.glPushMatrix(); GL11.glTranslatef(x, y, z); GL11.glMultMatrixf(matrix_buf); GL11.glScalef(zoom_inv, zoom_inv, zoom_inv); GL11.glLineWidth(line_width); GL11.glColor3f(r, g, b); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(0f, 0f, 0f); GL11.glVertex3f(0f, line_end, 0f); GL11.glEnd(); GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glVertex3f(0f, length, 0f); GL11.glVertex3f(cone[0], cone_start, cone[1]); GL11.glVertex3f(cone[2], cone_start, cone[3]); GL11.glVertex3f(cone[4], cone_start, cone[5]); GL11.glVertex3f(cone[6], cone_start, cone[7]); GL11.glVertex3f(cone[8], cone_start, cone[9]); GL11.glVertex3f(cone[10], cone_start, cone[11]); GL11.glVertex3f(cone[12], cone_start, cone[13]); GL11.glVertex3f(cone[14], cone_start, cone[15]); GL11.glVertex3f(cone[16], cone_start, cone[17]); GL11.glVertex3f(cone[18], cone_start, cone[19]); GL11.glVertex3f(cone[20], cone_start, cone[21]); GL11.glVertex3f(cone[22], cone_start, cone[23]); GL11.glVertex3f(cone[24], cone_start, cone[25]); GL11.glVertex3f(cone[26], cone_start, cone[27]); GL11.glVertex3f(cone[28], cone_start, cone[29]); GL11.glVertex3f(cone[30], cone_start, cone[31]); GL11.glVertex3f(cone[32], cone_start, cone[33]); GL11.glEnd(); GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glVertex3f(0f, cone_start, 0f); GL11.glVertex3f(cone[32], cone_start, cone[33]); GL11.glVertex3f(cone[30], cone_start, cone[31]); GL11.glVertex3f(cone[28], cone_start, cone[29]); GL11.glVertex3f(cone[26], cone_start, cone[27]); GL11.glVertex3f(cone[24], cone_start, cone[25]); GL11.glVertex3f(cone[22], cone_start, cone[23]); GL11.glVertex3f(cone[20], cone_start, cone[21]); GL11.glVertex3f(cone[18], cone_start, cone[19]); GL11.glVertex3f(cone[16], cone_start, cone[17]); GL11.glVertex3f(cone[14], cone_start, cone[15]); GL11.glVertex3f(cone[12], cone_start, cone[13]); GL11.glVertex3f(cone[10], cone_start, cone[11]); GL11.glVertex3f(cone[8], cone_start, cone[9]); GL11.glVertex3f(cone[6], cone_start, cone[7]); GL11.glVertex3f(cone[4], cone_start, cone[5]); GL11.glVertex3f(cone[2], cone_start, cone[3]); GL11.glVertex3f(cone[0], cone_start, cone[1]); GL11.glEnd(); GL11.glPopMatrix(); }
Example 20
Source File: DebugRender.java From tribaltrouble with GNU General Public License v2.0 | 4 votes |
public final static void setColor(int i) { float[] color = debug_colors[i%debug_colors.length]; GL11.glColor3f(color[0], color[1], color[2]); }