List of usage examples for org.lwjgl.opengl GL11 glFlush
public static void glFlush()
From source file:fr.def.iss.vd2.lib_v3d.V3DCanvas.java
License:Open Source License
/** * Sets up the screen.// ww w .j a va2s . c o m * * @see javax.media.openGL11.GLEventListener#init(javax.media.openGL11.GLAutoDrawable) */ public void init() { try { frame = new JFrame("Space agencies"); //frame.setSize(width,height); //frame.setUndecorated(true); //here frame.setVisible(true); //frame.setAlwaysOnTop(true); frame.setLocation(0, 0); Canvas canvas = new Canvas(); canvas.setMinimumSize(new Dimension(800, 600)); canvas.setPreferredSize(new Dimension(width, height)); frame.add(canvas); frame.pack(); frame.addWindowListener(generateWindowListener()); frame.getContentPane().addHierarchyBoundsListener(new HierarchyBoundsListener() { @Override public void ancestorMoved(HierarchyEvent e) { } @Override public void ancestorResized(HierarchyEvent e) { width = frame.getContentPane().getWidth(); height = frame.getContentPane().getHeight(); reshape(0, 0, width, height); } }); Display.setDisplayMode(new DisplayMode(width, height)); //Display.setFullscreen(true); Display.setVSyncEnabled(false); Display.setTitle("Space agencies"); Display.setParent(canvas); Display.create(); canvas.requestFocus(); } catch (Exception e) { System.out.println("Error setting up display" + e); System.exit(0); } // Enable z- (depth) buffer for hidden surface removal. GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_POINT_SMOOTH); if (polygonOffset) { GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL); GL11.glPolygonOffset(1.0f, 1.0f); } GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST); GL11.glClearDepth(1.0); // Enables Clearing Of The Depth Buffer GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_BLEND); // Enable smooth shading. GL11.glShadeModel(GL11.GL_SMOOTH); // Define "clear" color. GL11.glClearColor(0f, 0f, 0.4f, 0f); // We want a nice perspective. GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glFlush(); TextureManager.clearCache(); initied = true; // new LWJGLBinding(); }
From source file:fr.def.iss.vd2.lib_v3d.V3DCanvas.java
License:Open Source License
/** * The only method that you should implement by yourself. * * @see javax.media.openGL11.GLEventListener#display(javax.media.openGL11.GLAutoDrawable) *///from w w w . j av a 2 s. co m public void display() { GL11.glClear(GL11.GL_ACCUM_BUFFER_BIT); for (V3DCameraBinding binding : cameraList) { GL11.glViewport(binding.x, binding.y, binding.width, binding.height); //Clean Background I3dColor color = binding.camera.getBackgroundColor(); GL11.glClearColor(color.r, color.g, color.b, color.a); GL11.glScissor(binding.x, binding.y, binding.width, binding.height); GL11.glEnable(GL11.GL_SCISSOR_TEST); if (color.a == 1.0f) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); } else { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glOrtho(0, binding.width, 0, binding.height, -2000.0, 2000.0); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glColor4f(color.r, color.g, color.b, color.a); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(0, 0, 0); GL11.glVertex3f(binding.width, 0, 0); GL11.glVertex3f(binding.width, binding.height, 0); GL11.glVertex3f(0, binding.height, 0); GL11.glEnd(); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); } GL11.glDisable(GL11.GL_SCISSOR_TEST); binding.camera.display(binding.width, binding.height); GL11.glDisable(GL11.GL_DEPTH_TEST); // binding.getGui().display(); GL11.glEnable(GL11.GL_DEPTH_TEST); if (select && binding == focusCamera) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); //glu.gluPerspective(45.0f, h, 0.1, 2000.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); binding.camera.select(mouseX, mouseY); context.setMouseOverCameraBinding(binding); } } GL11.glFlush(); select = false; }
From source file:io.root.gfx.glutils.GL.java
License:Apache License
public static void glFlush() { GL11.glFlush(); }
From source file:jake2.desktop.LWJGLAdapter.java
License:Open Source License
@Override public void swapBuffers() { GL11.glFlush(); Display.update(); }
From source file:kuake2.render.lwjgl.LWJGLBase.java
License:Open Source License
protected void GLimp_EndFrame() { GL11.glFlush(); // swap buffers Display.update(); }
From source file:org.oscim.gdx.LwjglGL20.java
License:Apache License
public void flush() { GL11.glFlush(); }
From source file:playn.java.JavaGL20.java
License:Apache License
@Override public void glFlush() { GL11.glFlush(); }
From source file:processing.opengl.PLWJGL.java
License:Open Source License
@Override public void flush() { GL11.glFlush(); }
From source file:voxicity.Renderer.java
License:Open Source License
public void render() { lock.lock();//from ww w . j a v a 2 s. c o 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.RenderUpdater.java
License:Open Source License
public void run() { boolean cleaned_one = false; try {/*w ww.j av a 2 s .c o m*/ drawable.makeCurrent(); while (!quitting) { ArrayList<ChunkID> ids = new ArrayList<ChunkID>(); updates.drainTo(ids, 5); ArrayList<ChunkNode> nodes = new ArrayList<ChunkNode>(); for (ChunkID id : ids) { lock.lock(); ChunkNode node = chunks.get(id); lock.unlock(); if (node != null) nodes.add(node); } ArrayList<ChunkNode.Batch> additions = new ArrayList<ChunkNode.Batch>(); ArrayList<ChunkNode.Batch> removals = new ArrayList<ChunkNode.Batch>(); for (ChunkNode node : nodes) { ArrayList<ChunkNode.Batch> old_batches = new ArrayList<ChunkNode.Batch>(node.batches); if (!node.is_clean()) { node.clean(); additions.addAll(new ArrayList<ChunkNode.Batch>(node.batches)); removals.addAll(old_batches); } } if (additions.size() > 0 || removals.size() > 0) { GL11.glFlush(); client.renderer.add_remove(additions, removals); } for (ChunkNode.Batch batch : removals) { GL15.glDeleteBuffers(batch.vert_buf); GL15.glDeleteBuffers(batch.tex_buf); GL15.glDeleteBuffers(batch.indices); } } } catch (Exception e) { System.out.println("Render Updater is quitting"); System.out.println(e); e.printStackTrace(); } }