List of usage examples for org.lwjgl.opengl GL11 glClearColor
public static void glClearColor(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green, @NativeType("GLfloat") float blue, @NativeType("GLfloat") float alpha)
From source file:org.evilco.emulator.core.graphic.matrix.MonochromeMatrixScreen.java
License:Apache License
/** * {@inheritDoc}/*w w w . ja v a 2 s .co m*/ */ @Override public synchronized void draw() { // clear screen GL11.glClearColor(0, 0, 0, 1); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glColor3f(1f, 1f, 1f); // TODO: Make color adjustable // draw pixels for (short y = 0; y < this.height; y++) { for (short x = 0; x < this.width; x++) { // skip disabled pixels if (!this.getPixel(x, y)) continue; // draw GL11.glRecti(x, y, (x + 1), (y + 1)); } } }
From source file:org.fenggui.example.ExampleBasisLWJGL.java
License:Open Source License
private void glInit(int width, int height) { // Go into orthographic projection mode. GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();/*from ww w . j a v a 2 s.co m*/ GLU.gluOrtho2D(0, width, 0, height); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glViewport(0, 0, width, height); //set clear color to ... ugly GL11.glClearColor(0.1f, 0.5f, 0.2f, 0.0f); //sync frame (only works on windows ) => THAT IS NOT TRUE (ask Rainer) Display.setVSyncEnabled(false); }
From source file:org.free.jake2.render.lwjgl.Main.java
License:Open Source License
/** * R_SetupFrame//from w w w. ja va 2 s. c o m */ void R_SetupFrame() { r_framecount++; // build the transformation matrix for the given view angles Math3D.VectorCopy(r_newrefdef.vieworg, r_origin); Math3D.AngleVectors(r_newrefdef.viewangles, vpn, vright, vup); // current viewcluster mleaf_t leaf; if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0) { r_oldviewcluster = r_viewcluster; r_oldviewcluster2 = r_viewcluster2; leaf = Mod_PointInLeaf(r_origin, r_worldmodel); r_viewcluster = r_viewcluster2 = leaf.cluster; // check above and below so crossing solid water doesn't draw wrong if (leaf.contents == 0) { // look down a bit Math3D.VectorCopy(r_origin, temp); temp[2] -= 16; leaf = Mod_PointInLeaf(temp, r_worldmodel); if ((leaf.contents & Defines.CONTENTS_SOLID) == 0 && (leaf.cluster != r_viewcluster2)) { r_viewcluster2 = leaf.cluster; } } else { // look up a bit Math3D.VectorCopy(r_origin, temp); temp[2] += 16; leaf = Mod_PointInLeaf(temp, r_worldmodel); if ((leaf.contents & Defines.CONTENTS_SOLID) == 0 && (leaf.cluster != r_viewcluster2)) { r_viewcluster2 = leaf.cluster; } } } System.arraycopy(r_newrefdef.blend, 0, v_blend, 0, 4); c_brush_polys = 0; c_alias_polys = 0; // clear out the portion of the screen that the NOWORLDMODEL defines if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) != 0) { GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glClearColor(0.3f, 0.3f, 0.3f, 1.0f); GL11.glScissor(r_newrefdef.x, vid.height - r_newrefdef.height - r_newrefdef.y, r_newrefdef.width, r_newrefdef.height); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glClearColor(1.0f, 0.0f, 0.5f, 0.5f); GL11.glDisable(GL11.GL_SCISSOR_TEST); } }
From source file:org.free.jake2.render.lwjgl.Main.java
License:Open Source License
/** * R_SetPalette//from w w w. j a v a 2s .c o m */ protected void R_SetPalette(byte[] palette) { // 256 RGB values (768 bytes) // or null int i; int color = 0; if (palette != null) { int j = 0; for (i = 0; i < 256; i++) { color = (palette[j++] & 0xFF); color |= (palette[j++] & 0xFF) << 8; color |= (palette[j++] & 0xFF) << 16; color |= 0xFF000000; r_rawpalette[i] = color; } } else { for (i = 0; i < 256; i++) { r_rawpalette[i] = d_8to24table[i] | 0xff000000; } } GL_SetTexturePalette(r_rawpalette); GL11.glClearColor(0, 0, 0, 0); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GL11.glClearColor(1f, 0f, 0.5f, 0.5f); }
From source file:org.free.jake2.render.lwjgl.Misc.java
License:Open Source License
void GL_SetDefaultState() { GL11.glClearColor(1f, 0f, 0.5f, 0.5f); // original quake2 //GL11.glClearColor(0, 0, 0, 0); // replaced with black GL11.glCullFace(GL11.GL_FRONT);/*from w w w. j a v a2 s . c om*/ GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.666f); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1, 1, 1, 1); GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); GL11.glShadeModel(GL11.GL_FLAT); GL_TextureMode(gl_texturemode.string); GL_TextureAlphaMode(gl_texturealphamode.string); GL_TextureSolidMode(gl_texturesolidmode.string); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, gl_filter_min); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, gl_filter_max); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL_TexEnv(GL11.GL_REPLACE); if (qglPointParameterfEXT) { // float[] attenuations = { gl_particle_att_a.value, gl_particle_att_b.value, gl_particle_att_c.value }; FloatBuffer att_buffer = BufferUtils.createFloatBuffer(4); att_buffer.put(0, gl_particle_att_a.value); att_buffer.put(1, gl_particle_att_b.value); att_buffer.put(2, gl_particle_att_c.value); GL11.glEnable(GL11.GL_POINT_SMOOTH); GL14.glPointParameterf(EXTPointParameters.GL_POINT_SIZE_MIN_EXT, gl_particle_min_size.value); GL14.glPointParameterf(EXTPointParameters.GL_POINT_SIZE_MAX_EXT, gl_particle_max_size.value); GL14.glPointParameter(EXTPointParameters.GL_DISTANCE_ATTENUATION_EXT, att_buffer); } if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f) { GL11.glEnable(EXTSharedTexturePalette.GL_SHARED_TEXTURE_PALETTE_EXT); GL_SetTexturePalette(d_8to24table); } GL_UpdateSwapInterval(); /* * vertex array extension */ GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL13.glClientActiveTexture(GL_TEXTURE0); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); }
From source file:org.geekygoblin.nedetlesmaki.game.systems.DrawSystem.java
License:Open Source License
@Override protected void processEntities(ImmutableBag<Entity> entities) { GL11.glClearColor(99f / 255f, 201f / 255f, 183f / 255f, 1f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); Sort.instance().sort(sprites, zComparator); GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_TRANSFORM_BIT | GL11.GL_HINT_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_SCISSOR_BIT | GL11.GL_LINE_BIT | GL11.GL_TEXTURE_BIT); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix();// www . j av a 2 s .c o m GL11.glLoadIdentity(); updateViewPort(); GL11.glViewport(viewPort.x, viewPort.y, viewPort.width, viewPort.height); GLU.gluOrtho2D(-VirtualResolution.WIDTH / 2.0f, VirtualResolution.WIDTH / 2.0f, VirtualResolution.HEIGHT / 2.0f, -VirtualResolution.HEIGHT / 2.0f); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_SCISSOR_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); NedGame game = (NedGame) world; Entity ned = game.getNed(); if (null != ned) { Sprite nedSprite = spriteMapper.get(ned); Vector nedPos = spriteProjector.project(nedSprite.getPosition()); GL11.glTranslatef(-nedPos.x, -nedPos.y, 0.0f); } for (Entity e : backgrounds) { LevelBackground level = levelBackgroundMapper.getSafe(e); if (null != level) { drawLevel(level); } } GL11.glPushMatrix(); GL11.glScalef(spriteGlobalScale, spriteGlobalScale, 1.0f); spriteBatcher.begin(); for (Entity e : sprites) { spriteBatcher.draw(spriteMapper.getSafe(e)); } spriteBatcher.end(); for (Entity e : sprites) { drawSpriteLabel(spriteMapper.getSafe(e)); } GL11.glPopMatrix(); for (Entity e : uis) { MainMenu mainMenu = mainMenuMapper.getSafe(e); if (null != mainMenu) { nuitRenderer.render(mainMenu.getRoot()); } DialogComponent dialog = dialogMapper.getSafe(e); if (null != dialog) { nuitRenderer.render(dialog.getRoot()); } InGameUI inGameUI = inGameUIMapper.getSafe(e); if (null != inGameUI) { nuitRenderer.render(inGameUI.getRoot()); } } GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:org.joge.core.draw.Graphics.java
License:Open Source License
public void setBackground(Color color) { GL11.glClearColor(color.r, color.g, color.b, color.a); }
From source file:org.jtrfp.mtmx.tools.internal.ModelViewerConfiguration.java
License:Open Source License
@Override public void draw() { GL11.glClearColor(0.8f, 0.8f, 0.8f, 0.0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glLoadIdentity();/* ww w .j a v a 2 s . co m*/ GLU.gluLookAt(5.0f, 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); GL11.glRotatef(rot, 0.0f, 1.0f, 0.0f); GL11.glRotatef(rot2, 1.0f, 0.0f, 0.0f); drawer.draw(); Keyboard.poll(); while (Keyboard.next()) { if (Keyboard.getEventKeyState()) { if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { return; } if (Keyboard.getEventKey() == Keyboard.KEY_RIGHT) { rot -= 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_LEFT) { rot += 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_UP) { rot2 -= 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_DOWN) { rot2 += 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_T) { if (renderMode == GL11.GL_POLYGON) { renderMode = GL11.GL_LINE_LOOP; } else { renderMode = GL11.GL_POLYGON; } } } } }
From source file:org.jtrfp.mtmx.tools.internal.TruckViewerConfiguration.java
License:Open Source License
@Override public void draw() { GL11.glClearColor(0.8f, 0.8f, 0.8f, 0.0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glLoadIdentity();// w ww.jav a 2s .c om GLU.gluLookAt(5.0f, 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); GL11.glRotatef(rot, 0.0f, 1.0f, 0.0f); GL11.glRotatef(rot2, 1.0f, 0.0f, 0.0f); truckDrawer.draw(); Keyboard.poll(); while (Keyboard.next()) { if (Keyboard.getEventKeyState()) { if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { return; } if (Keyboard.getEventKey() == Keyboard.KEY_RIGHT) { rot -= 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_LEFT) { rot += 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_UP) { rot2 -= 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_DOWN) { rot2 += 15.0f; } if (Keyboard.getEventKey() == Keyboard.KEY_A) { truckDrawer.setSteerAngle(truckDrawer.getSteerAngle() + 0.1f); } if (Keyboard.getEventKey() == Keyboard.KEY_D) { truckDrawer.setSteerAngle(truckDrawer.getSteerAngle() - 0.1f); } if (Keyboard.getEventKey() == Keyboard.KEY_T) { if (truckDrawer.getRenderMode() == GL11.GL_POLYGON) { truckDrawer.setRenderMode(GL11.GL_LINE_LOOP); } else { truckDrawer.setRenderMode(GL11.GL_POLYGON); } } } } }
From source file:org.jtrfp.mtmx.tools.internal.WorldViewerConfiguration.java
License:Open Source License
@Override public void draw() { GL11.glClearColor(0.8f, 0.8f, 0.8f, 0.0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glLoadIdentity();//w w w .j a v a2 s. c o m float e = terrainDrawer.getTerrainMap().getElevationAt(1, 1) * IDrawer.WORLD_SCALE_XZ; GLU.gluLookAt(-1.0f + lookX * IDrawer.WORLD_SCALE_XZ, 1.0f + e, -1.0f + lookZ * IDrawer.WORLD_SCALE_XZ, 0.0f + lookX * IDrawer.WORLD_SCALE_XZ, 0.0f + e, 0.0f + lookZ * IDrawer.WORLD_SCALE_XZ, 0.0f, 1.0f, 0.0f); GL11.glColor3f(0.0f, 1.0f, 0.0f); terrainDrawer.draw(); Keyboard.poll(); while (Keyboard.next()) { if (Keyboard.getEventKeyState()) { if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { return; } if (Keyboard.getEventKey() == Keyboard.KEY_RIGHT) { lookX -= 5; } if (Keyboard.getEventKey() == Keyboard.KEY_LEFT) { lookX += 5; } if (Keyboard.getEventKey() == Keyboard.KEY_UP) { lookZ += 5; } if (Keyboard.getEventKey() == Keyboard.KEY_DOWN) { lookZ -= 5; } if (Keyboard.getEventKey() == Keyboard.KEY_T) { if (terrainDrawer.getRenderMode() == GL11.GL_TRIANGLES) { terrainDrawer.setRenderMode(GL11.GL_LINE_LOOP); } else { terrainDrawer.setRenderMode(GL11.GL_TRIANGLES); } } } } }