List of usage examples for org.lwjgl.opengl GL11 glClear
public static void glClear(@NativeType("GLbitfield") int mask)
From source file:tk.jacklin213.voxelgale.rendering.BasicRenderer.java
License:Apache License
private void render() { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glLoadIdentity();/* w w w .j a v a 2 s . c o m*/ GL11.glTranslatef(-3f, 0.0f, -20f); GL11.glRotatef(45f, 0.4f, 1.0f, 0.1f); GL11.glColor3f(0.5f, 0.5f, 1.0f); for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { for (int z = 0; z < 3; z++) { renderCube(); GL11.glTranslatef(0, 0, 2); } GL11.glTranslatef(0, 2, -6); } GL11.glTranslatef(2, -6, 0); } }
From source file:uk.co.ifs_studios.engine.util.OpenGL.java
License:Open Source License
/** * OpenGL methods that need to be called every frame. */ public static void update() { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); }
From source file:vengine.VGraphicManager.java
public void render(VGraphics g) { long d = new Date().getTime(); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); for (int i = 0; i < add_vgl.size(); i++) { vgl.add(add_vgl.get(0));/*w w w .j a va 2 s. c om*/ add_vgl.remove(0); } for (int i = 0; i < remove_vgl.size(); i++) { vgl.remove(remove_vgl.get(0)); remove_vgl.remove(0); } for (VGraphicLayer vgl : this.vgl) { vgl.set(); vgl.render(g); } if (vgl.isEmpty()) { emptyLayer.set(); emptyLayer.render(g); } long t = new Date().getTime(); //g.drawString(String.valueOf(1000/Math.max(1, t - d)), 20, 20); }
From source file:vengine.VGraphics.java
public static void start() { Thread renderingThread = new Thread("RenderingThread") { @Override/*ww w . jav a 2 s . c om*/ public void run() { try { Display.setDisplayMode(new DisplayMode(8000, 6000)); Display.setTitle(VEngine.cfg.g("mod")); Display.setIcon(new ByteBuffer[] { new ImageIOImageData().imageToByteBuffer( ImageIO.read(new File(VEngine.cfg.g("modhome") + "/icon.png")), false, false, null), new ImageIOImageData().imageToByteBuffer( ImageIO.read(new File(VEngine.cfg.g("modhome") + "/icon.png")), false, false, null) }); Display.setFullscreen(true); Display.setResizable(true); Display.create(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 1, 1, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); VGraphics g = new VGraphics(); Random r = new Random(); while (!Display.isCloseRequested()) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glEnable(GL11.GL_TEXTURE_2D); // ? ? ? ?. GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_BLEND); WIDTH = Display.getWidth(); HEIGHT = Display.getHeight(); vgm.render(g); Display.update(); } Display.destroy(); System.exit(0); } catch (LWJGLException ex) { Logger.getLogger(VGraphics.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(VGraphics.class.getName()).log(Level.SEVERE, null, ex); } } }; renderingThread.setPriority(Thread.MAX_PRIORITY); renderingThread.start(); }
From source file:vertigo.graphics.lwjgl.LWJGL_Renderer.java
License:Open Source License
public void display() { GL11.glClearColor(red, green, blue, 1.0f); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_COLOR_BUFFER_BIT); world.accept(visitor);/*from w w w .j av a 2 s .co m*/ for (Shape shape : shapes) { // shape drawShape(shape); } }
From source file:view.Menu.java
public void menu() throws LWJGLException, IOException, InterruptedException { switch (state) { case GAME:/*from ww w . j ava2 s. co m*/ TheView v = new TheView(); stop_in_game(); v.view(); break; case INTRO: DisplayManager.createDisplay(); Display.setVSyncEnabled(true); loadFont(); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); play_in_game(); while (!Display.isCloseRequested()) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); drawImage(); writeFont(300, 500, "Space bar or start button to start"); checkInput(); Display.update(); Display.sync(60); } Display.destroy(); break; } }
From source file:voxicity.Renderer.java
License:Open Source License
public void render() { lock.lock();/* w w w . j a v a 2 s . co m*/ quads = 0; draw_calls = 0; batch_draw_calls = 0; GL11.glLoadIdentity(); GLU.gluLookAt(camera.pos.x, camera.pos.y, camera.pos.z, camera.pos.x + camera.look.x, camera.pos.y + camera.look.y, camera.pos.z + camera.look.z, camera.up.x, camera.up.y, camera.up.z); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); for (ChunkNode.Batch batch : batches) render_batch(batch); GL11.glFlush(); lock.unlock(); }
From source file:voxicity.Voxicity.java
License:Open Source License
static void init(Arguments args) { // Load the specified config file Config config = new Config(args.get_value("config", "voxicity.properties")); String mode = args.get_value("mode", "client"); if (mode.equals("server")) { // Start the server, it spawns its own thread // and takes over from here new Server(config).run(); } else if (mode.equals("client")) { try {/*from ww w .ja va 2s .c om*/ System.out.println("Intializing display"); Display.setDisplayMode(new DisplayMode(1200, 720)); Display.create(); Display.setTitle("Voxicity"); System.out.println("Display created"); } catch (LWJGLException e) { System.out.println("Unable to open Display"); e.printStackTrace(); System.exit(1); } System.out.println("Setting up OpenGL states"); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glClearColor(126.0f / 255.0f, 169.0f / 255.0f, 254.0f / 255.0f, 1.0f); GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); System.out.println("Number of texture units: " + GL11.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS)); System.out.println( "Number of image texture units: " + GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS)); System.out.println( "Number of vertex texture units: " + GL11.glGetInteger(GL20.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS)); System.out.println("Number of combined vertex/image texture units: " + GL11.glGetInteger(GL20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS)); try { LWJGLRenderer gui_renderer = new LWJGLRenderer(); LoginGUI login_gui = new LoginGUI(); ThemeManager theme = ThemeManager.createThemeManager(Voxicity.class.getResource("/login.xml"), gui_renderer); GUI gui = new GUI(login_gui, gui_renderer); gui.applyTheme(theme); while (!login_gui.is_login_pressed()) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); gui.update(); Display.update(); if (Display.isCloseRequested()) { Display.destroy(); System.exit(0); } } Socket client_s = new Socket(login_gui.get_server_name(), 11000); Client client = new Client(config, new NetworkConnection(client_s)); client.run(); System.out.println("Destroying display"); Display.destroy(); } // Catch exceptions from the game init and main game-loop catch (LWJGLException e) { System.out.println(e); e.printStackTrace(); System.exit(1); } catch (IOException e) { System.out.println(e); e.printStackTrace(); System.exit(1); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } } else { System.out.println("Invalid mode: " + mode); } }
From source file:zildo.fwk.gfx.filter.BilinearFilter.java
License:Open Source License
@Override public void preFilter() { fbo.startRendering(fboId, sizeX, sizeY); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer }
From source file:zildo.fwk.gfx.filter.BlendFilter.java
License:Open Source License
@Override public void preFilter() { if (getCurrentSquareSize() == 1) { return;//from w w w . j a v a 2 s . co m } // Copy last texture in TexBuffer fbo.bindToTextureAndDepth(textureID, depthTextureID, fboId); fbo.startRendering(fboId, sizeX, sizeY); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer }