List of usage examples for org.lwjgl.opengl GL11 glColor3f
public static native void glColor3f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green, @NativeType("GLfloat") float blue);
From source file:net.BiggerOnTheInside.Binder.engine.BlockRenderer.java
License:Open Source License
public static void renderWireframeBlock(Block b, float x, float y, float z) { GL11.glTranslatef(x * 2f, y * 2f, z * 2f); GL11.glBegin(GL11.GL_LINE_LOOP);/*w w w. jav a 2 s. co m*/ GL11.glColor3f(0.0f, 1.0f, 0.0f); GL11.glVertex3f(1.0f, 1.0f, -1.0f); GL11.glVertex3f(-1.0f, 1.0f, -1.0f); GL11.glVertex3f(-1.0f, 1.0f, 1.0f); GL11.glVertex3f(1.0f, 1.0f, 1.0f); GL11.glColor3f(1.0f, 0.5f, 0.0f); GL11.glVertex3f(1.0f, -1.0f, 1.0f); GL11.glVertex3f(-1.0f, -1.0f, 1.0f); GL11.glVertex3f(-1.0f, -1.0f, -1.0f); GL11.glVertex3f(1.0f, -1.0f, -1.0f); GL11.glColor3f(1.0f, 0.0f, 0.0f); GL11.glVertex3f(1.0f, 1.0f, 1.0f); GL11.glVertex3f(-1.0f, 1.0f, 1.0f); GL11.glVertex3f(-1.0f, -1.0f, 1.0f); GL11.glVertex3f(1.0f, -1.0f, 1.0f); GL11.glColor3f(1.0f, 1.0f, 0.0f); GL11.glVertex3f(1.0f, -1.0f, -1.0f); GL11.glVertex3f(-1.0f, -1.0f, -1.0f); GL11.glVertex3f(-1.0f, 1.0f, -1.0f); GL11.glVertex3f(1.0f, 1.0f, -1.0f); GL11.glColor3f(0.0f, 0.0f, 1.0f); GL11.glVertex3f(-1.0f, 1.0f, 1.0f); GL11.glVertex3f(-1.0f, 1.0f, -1.0f); GL11.glVertex3f(-1.0f, -1.0f, -1.0f); GL11.glVertex3f(-1.0f, -1.0f, 1.0f); GL11.glColor3f(1.0f, 0.0f, 1.0f); GL11.glVertex3f(1.0f, 1.0f, -1.0f); GL11.glVertex3f(1.0f, 1.0f, 1.0f); GL11.glVertex3f(1.0f, -1.0f, 1.0f); GL11.glVertex3f(1.0f, -1.0f, -1.0f); GL11.glEnd(); GL11.glTranslatef(0f, 0f, 0f); }
From source file:net.BiggerOnTheInside.Binder.engine.world.World.java
License:Open Source License
private void Render() { // GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); //GL11.glLoadIdentity(); GL11.glTranslatef(0f, 0.0f, -7f);/*from w ww. j a va 2 s. c o m*/ // GL11.glRotatef(45f,0.0f,1.0f,0.0f); GL11.glColor3f(0.5f, 0.5f, 1.0f); GL11.glBegin(GL11.GL_QUADS); GL11.glColor3f(1.0f, 1.0f, 0.0f); GL11.glVertex3f(1.0f, 1.0f, -1.0f); GL11.glVertex3f(-1.0f, 1.0f, -1.0f); GL11.glVertex3f(-1.0f, 1.0f, 1.0f); GL11.glVertex3f(1.0f, 1.0f, 1.0f); GL11.glColor3f(1.0f, 0.5f, 0.0f); GL11.glVertex3f(1.0f, -1.0f, 1.0f); GL11.glVertex3f(-1.0f, -1.0f, 1.0f); GL11.glVertex3f(-1.0f, -1.0f, -1.0f); GL11.glVertex3f(1.0f, -1.0f, -1.0f); GL11.glColor3f(1.0f, 0.0f, 0.0f); GL11.glVertex3f(1.0f, 1.0f, 1.0f); GL11.glVertex3f(-1.0f, 1.0f, 1.0f); GL11.glVertex3f(-1.0f, -1.0f, 1.0f); GL11.glVertex3f(1.0f, -1.0f, 1.0f); GL11.glColor3f(1.0f, 1.0f, 0.0f); GL11.glVertex3f(1.0f, -1.0f, -1.0f); GL11.glVertex3f(-1.0f, -1.0f, -1.0f); GL11.glVertex3f(-1.0f, 1.0f, -1.0f); GL11.glVertex3f(1.0f, 1.0f, -1.0f); GL11.glColor3f(0.0f, 0.0f, 1.0f); GL11.glVertex3f(-1.0f, 1.0f, 1.0f); GL11.glVertex3f(-1.0f, 1.0f, -1.0f); GL11.glVertex3f(-1.0f, -1.0f, -1.0f); GL11.glVertex3f(-1.0f, -1.0f, 1.0f); GL11.glColor3f(1.0f, 0.0f, 1.0f); GL11.glVertex3f(1.0f, 1.0f, -1.0f); GL11.glVertex3f(1.0f, 1.0f, 1.0f); GL11.glVertex3f(1.0f, -1.0f, 1.0f); GL11.glVertex3f(1.0f, -1.0f, -1.0f); GL11.glEnd(); GL11.glTranslatef(0, 0, 0); }
From source file:net.bryanbergen.lwjgl.test.Main.java
public static void main(String... args) { Dimension d = new Dimension(0, 0, 960, 600); Window.Builder builder = new Window.Builder(d); builder.setTitle("Test Window"); builder.setFullscreen(false);/*from w w w . java 2 s.co m*/ builder.setResizable(true); builder.setVisible(true); builder.setVsync(true); builder.setBackground(Color.BLUE); Window window = builder.build(); window.addKeyListener(new KeyAdapter() { @Override public void KeyPressed(KeyEvent event) { if (event.getKeycode() == KeyCode.KEY_ESCAPE) { window.close(); } } }); window.addKeyListener(new ColorSwapper()); window.addMouseListener(new ColorClicker(window)); while (!window.shouldClose()) { window.clear(); // immediate mode for testing only GL11.glColor3f((float) color.getRed(), (float) color.getGreen(), (float) color.getBlue()); GL11.glBegin(GL_QUADS); GL11.glVertex2f(-.5f, -.5f); GL11.glVertex2f(-.5f, .5f); GL11.glVertex2f(.5f, .5f); GL11.glVertex2f(.5f, -.5f); GL11.glEnd(); window.update(); } window.dispose(); }
From source file:net.codepixl.GLCraft.GLCraft.java
License:Open Source License
private void initSplashText() { glCullFace(GL_BACK);/* w ww .j ava 2 s . c o m*/ glClearDepth(1); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, Constants.getWidth(), Constants.getHeight()); glOrtho(0, Constants.getWidth(), Constants.getHeight(), 0, -200, 200); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glEnable(GL_CULL_FACE); GL11.glColor3f(1f, 1f, 1f); }
From source file:net.kubin.inventory.InventoryItem.java
License:Apache License
public void renderHoldableObject(LightBuffer lightBuffer) { GL11.glPushMatrix();/*w w w.j a v a 2 s .c om*/ float scale = 0.1f / 16.0f; float light = lightBuffer.get(1, 1, 1) / 30.001f; GL11.glScalef(scale, scale, scale); GL11.glColor3f(0.5f * light, 0.5f * light, 0.5f * light); /* Render the texture */ for (float i = 0.0f; i < 0.02f; i += 0.002f) { if (i > 0.016f) { GL11.glColor3f(1.0f * light, 1.0f * light, 1.0f * light); } renderInventoryItem(); GL11.glTranslatef(0, 0, 0.002f / scale); } GL11.glPopMatrix(); }
From source file:net.kubin.world.Sky.java
License:Apache License
private void drawShpere(float x, float y, float z) { GL11.glPushMatrix();/*from w w w . ja v a 2 s .com*/ GL11.glTranslatef(x, y, z); GL11.glColor3f(_color.x(), _color.y(), _color.z()); if (_sphereCallList == 0) { _sphereCallList = GL11.glGenLists(1); GL11.glNewList(_sphereCallList, GL11.GL_COMPILE_AND_EXECUTE); GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glVertex3f(0, 0, 0); for (int i = 0; i <= _vertices; ++i) { float angle = MathHelper.f_2PI / _vertices * i; float xx = MathHelper.cos(angle) * _radius; float zz = MathHelper.sin(angle) * _radius; GL11.glVertex3f(xx, -_bend, zz); } GL11.glEnd(); GL11.glEndList(); } else { GL11.glCallList(_sphereCallList); } GL11.glPopMatrix(); }
From source file:net.kubin.world.World.java
License:Apache License
private void renderOverlay() { Configuration conf = Kubin.getConfiguration(); Game.getInstance().initOverlayRendering(); GL11.glColor3f(1, 1, 1); if (Game.RENDER_INFORMATION_OVERLAY) { GLFont infoFont = FontStorage.getFont("Monospaced_20"); /* Down Left Info */ 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); }// ww w. jav a 2 s . com /** 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 = 7; int crossHole = 4; GL11.glLineWidth(2.5f); GL11.glColor3f(255, 255, 255); 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, 0, 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:net.lyonlancer5.mcmp.karasu.client.renderer.tileentity.TileEntityEndRodRenderer.java
License:Apache License
private static void colour(int colour) { float r = (colour >> 16 & 255) / 255F; float g = (colour >> 8 & 255) / 255F; float b = (colour & 255) / 255F; GL11.glColor3f(r, g, b); }
From source file:net.mechanicalcat.pycode.obj.Model.java
License:Open Source License
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);//from w ww . j ava 2 s . c om 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(); }
From source file:nz.co.crookedhill.ggutils.renderer.GGURenderCreeperMite.java
License:Mozilla Public License
/** * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: * entityLiving, partialTickTime/*from w w w.j a v a 2 s. c om*/ */ @Override protected void preRenderCallback(EntityLivingBase p_77041_1_, float p_77041_2_) { GL11.glColor3f(0, 255, 0); }