List of usage examples for org.lwjgl.opengl GL11 glClear
public static void glClear(@NativeType("GLbitfield") int mask)
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 ww . j ava2 s. c om*/ 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:fr.guillaume.prive.viper.core.graphic.GraphicMotor.java
public static void draw() { GraphicMotor.checkInstance();// w w w . ja va 2 s . co m GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL20.glUseProgram(instance.shipShaderId); GL20.glUniform1i(instance.useTextureLocation, instance.drawPolygonFrame ? 0 : 1); int drawStyle = instance.drawPolygonFrame ? GL11.GL_LINE_LOOP : GL11.GL_TRIANGLES; GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, instance.shipTextureId); GL30.glBindVertexArray(instance.shipVaoId); GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1); GL20.glEnableVertexAttribArray(2); GL20.glEnableVertexAttribArray(3); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, instance.shipVboiId); GL11.glDrawElements(drawStyle, instance.shipVboiLenght, GL11.GL_UNSIGNED_INT, 0); GL20.glDisableVertexAttribArray(0); GL20.glDisableVertexAttribArray(1); GL20.glDisableVertexAttribArray(2); GL20.glDisableVertexAttribArray(3); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL30.glBindVertexArray(0); GL20.glUseProgram(0); }
From source file:fr.ign.cogit.geoxygene.appli.render.LwjglLayerRenderer.java
License:Open Source License
/** * Initialize layer FBO to receive GL primitives from a set of identical * symbolizers// w w w .j a v a2 s. c om * * @param primitive * @param opacity * @param currentSymbolizer * @throws GLException */ private void clearFBOLayer() throws GLException { GLTools.glCheckError("preparing next FBO Layer"); GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, this.getLayerViewPanel().getGLCanvas().getFboId()); GL11.glDrawBuffer(GL30.GL_COLOR_ATTACHMENT0); GLTools.glCheckError("bind frame buffer"); // Blending mode in FBO drawing. GLTools.glCheckError("finalizing FBO initialization"); GL11.glClearColor(0f, 0f, 0f, 0f); GLTools.glCheckError("finalizing FBO initialization"); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GLTools.glCheckError("finalizing FBO initialization"); glEnable(GL11.GL_BLEND); GLTools.glCheckError("finalizing FBO initialization"); GL20.glBlendEquationSeparate(GL14.GL_FUNC_ADD, GL14.GL_MAX); GLTools.glCheckError("finalizing FBO initialization"); GL14.glBlendFuncSeparate(GL11.GL_ONE, GL11.GL_ZERO, GL11.GL_ZERO, GL11.GL_ZERO); GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, 0); GLTools.glCheckError("finalizing FBO initialization"); }
From source file:fr.ign.cogit.geoxygene.util.gl.GLTools.java
License:Open Source License
/** * set gl clear color from a LWJGL Color object *//*from w ww.j a v a 2s .c o m*/ public static void glClear(final Color color, int bufferId) { GL11.glClearColor(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f); GL11.glClear(bufferId); }
From source file:fr.ign.cogit.geoxygene.util.gl.GLTools.java
License:Open Source License
/** * set gl clear color from an AWT Color object *///from ww w. j ava 2 s .com public static void glClear(final java.awt.Color color, int bufferId) { GL11.glClearColor(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f); GL11.glClear(bufferId); }
From source file:fr.ign.cogit.geoxygene.util.gl.GLTools.java
License:Open Source License
/** * set gl clear color from RGBA components *//*from w w w . jav a 2 s .c o m*/ public static void glClear(float r, float g, float b, float a, int bufferId) { GL11.glClearColor(r, g, b, a); GL11.glClear(bufferId); }
From source file:fr.theshark34.sharkengine.Game.java
License:Apache License
/** * Update the window, called by the main loop of the create() method *///from ww w . jav a 2s . c om private static void update() { // Clear all GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glClearColor((float) clearColor.getRed() / 255, (float) clearColor.getGreen() / 255, (float) clearColor.getBlue() / 255, (float) clearColor.getAlpha() / 255); // Draw the current GUI if (currentGUI != null) currentGUI.draw(); // Check if user requested close if (Display.isCloseRequested()) stop(); // Update the Display Display.update(); }
From source file:game.engine.game.Scene.java
License:Open Source License
/** * Draws the screen contents using OpenGL. *///from w ww .j av a2s. c o m public void draw() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, getScreenWidthUnits(), getScreenHeightUnits(), 0, -1, 1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(-screenX, -screenY, 0.0f); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); for (GameObject gameObject : gameObjects) { gameObject.draw(); } }
From source file:game.states.State_PREFAB_EDITOR.java
License:Open Source License
@Override protected void Render() { OrthoMode();/* w w w .jav a 2 s . c o m*/ ModelMode(); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glEnable(GL11.GL_TEXTURE_2D); DrawBackground(); ButtonGUILayer.Render(); if (PrefabMap != null) PrefabMap.Render(); PrefabPalette.Render(); Color.white.bind(); MenuGUILayer.Render(); ProjectionMode(); ModelMode(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glTranslatef(CameraX, CameraY, -20f + CameraZ); // Move Right 1.5 GL11.glTranslatef(9, -45, 0); GL11.glRotatef(MapRotatef, 0f, 1.0f, 0f); RenderPrefab(); }
From source file:game.states.State_SINGLEPLAYER.java
License:Open Source License
@Override protected void Render() { OrthoMode();/*from w w w .j a va2 s.c om*/ ModelMode(); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glEnable(GL11.GL_TEXTURE_2D); DrawBackground(); MainGUILayer.Render(); MenuGUILayer.Render(); StatRenderer.DrawBars(); ProjectionMode(); ModelMode(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glTranslatef(PlayerX, PlayerY, -20f + PlayerZ); // Move Right 1.5 GL11.glTranslatef(9, -45, 0); GL11.glRotatef(MapRotatef, 0f, 1.0f, 0f); t.Render(); }