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:com.timvisee.voxeltex.architecture.component.other.splash.SplashAnimatorComponent.java
License:Open Source License
@Override public void update() { // Set the clear color of this scene // TODO: Configure this in the renderer class! GL11.glClearColor(0, 0, 0, 1.0f); // Make sure the proper components are attached if (this.rectangleTransform == null || this.guiImage == null) { // Update the attachments updateAttachments();/*from w w w . j a va2 s.c o m*/ // If the components still aren't attached, show an error and quit this method if (this.rectangleTransform == null || this.guiImage == null) { System.out.println("No RectangleTransform or GUI image component in " + this + " of " + getOwner() + ", unable to animate"); return; } } // Calculate the local time value double x = Time.time - 0.5; // Define the size and alpha variable used for calculations double size, alpha = 0; // Calculate the size of the splash size = (Math.pow(-x * 0.48 + 0.8, 3) + 1.2 - x * 0.1) * 256.0; // Calculate the alpha intensity of the splash if (Time.time < 1.25) alpha = Math.pow((x - 0.75) * 1.35, 2.0) * -1.0 + 1.0; else if (Time.time < 2.75) alpha = 1f; else if (Time.time < 3.5) alpha = Math.pow((x - 2.25) * 1.35, 2.0) * -1.0 + 1.0; // Send the values to the target components this.rectangleTransform.setSizeX((float) size); this.rectangleTransform.setSizeY((float) size); this.guiImage.setAlpha((float) alpha); // Load the test environment scene after the splash screen is done if (Time.time > 3.5) getEngine().getSceneManager().loadScene(getNextScene()); }
From source file:com.voxelplugineering.voxelsniper.render.RenderMain.java
License:Open Source License
private void setupOpenGL() { // Setup an OpenGL context with API version 3.2 try {// ww w. j ava2 s . co m PixelFormat pixelFormat = new PixelFormat(); ContextAttribs contextAtrributes = new ContextAttribs(3, 2).withForwardCompatible(true) .withProfileCore(true); Display.setDisplayMode(new DisplayMode(this.width, this.height)); Display.setTitle("VoxelGunsmithEngine"); Display.create(pixelFormat, contextAtrributes); GL11.glViewport(0, 0, this.width, this.height); } catch (LWJGLException e) { if (Standalone.DEBUG) { System.out.println("Failed creating display"); } e.printStackTrace(); System.exit(-1); } // Setup an XNA like background color GL11.glClearColor(RenderingConstants.CLEAR_COLOUR_R, RenderingConstants.CLEAR_COLOUR_G, RenderingConstants.CLEAR_COLOUR_B, RenderingConstants.CLEAR_COLOUR_A); GL11.glViewport(0, 0, this.width, this.height); // cull back faces GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); GL11.glFrontFace(GL11.GL_CW); OpenGLUtilities.checkGLError("setup OpenGL"); }
From source file:com.w67clement.openw67render.gui.screen.OpenScreen.java
License:Open Source License
/** * Method to paint the background of the screen. * * @param graphics Graphics for drawing. *//* w w w.j av a2 s .co m*/ public void paintBackground(OpenGraphics graphics) { if (background != null) GL11.glClearColor((float) background.getRed() / 255f, (float) background.getGreen() / 255f, (float) background.getBlue() / 255f, 1f); }
From source file:com.xrbpowered.gl.examples.ExampleClient.java
License:Open Source License
@Override public void redraw(RenderTarget target) { if (uiGraphPane.isVisible()) uiGraphPane.repaint();//from w w w . ja v a2 s . com RenderTarget drawTarget = target; if (offscreenBuffers != null) { offscreenBuffers.use(); drawTarget = offscreenBuffers; } GL11.glClearColor(CLEAR_COLOR.getRed() / 255f, CLEAR_COLOR.getGreen() / 255f, CLEAR_COLOR.getBlue() / 255f, 0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); if (wireframe) GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); drawObjects(drawTarget); if (wireframe) GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); if (offscreenBuffers != null) { offscreenBuffers.resolve(); target.use(); drawOffscreenBuffers(offscreenBuffers, target); } }
From source file:com.xrbpowered.gl.res.shaders.PostProcessRenderer.java
License:Open Source License
@Override public void redraw(RenderTarget target) { if (requestUpdate || updatePerFrame) { redrawBackgroundBuffer(); //updatePerFrame ? dt : 0f); }//from w w w . ja v a 2s . co m if (bgBuffer != null) { if (postProc == null) blit(bgBuffer, target); else { GL11.glDisable(GL11.GL_CULL_FACE); interBuffer.use(); postProc.draw(bgBuffer); blit(interBuffer, target); } target.use(); } else { target.use(); GL11.glClearColor(clearColor.getRed() / 255f, clearColor.getGreen() / 255f, clearColor.getBlue() / 255f, 0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); } }
From source file:com.xrbpowered.gl.scene.ActorPicker.java
License:Open Source License
public void startPicking(int x, int y, RenderTarget pickTarget) { this.x = x;/* w ww . jav a2s . c om*/ this.y = y; pickTarget.use(); GL11.glScissor(x, y, 1, 1); GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glClearColor(0f, 0f, 0f, 0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); ActorPickerShader.getInstance().use(); }
From source file:com.xrbpowered.gl.ui.AbstractLoadScreen.java
License:Open Source License
private void display() { GL11.glClearColor(clearColor.getRed() / 255f, clearColor.getGreen() / 255f, clearColor.getBlue() / 255f, 0f);/*from w w w . j av a 2 s . com*/ GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); uiPane.x = Display.getWidth() / 2 - uiPane.getWidth() / 2; uiPane.y = Display.getHeight() / 2 - uiPane.getHeight() / 2; ui.draw(Display.getWidth(), Display.getHeight()); Display.update(); }
From source file:cuchaz.jfxgl.JFXGL.java
License:Open Source License
public static void renderLoop() { long appHwnd = JFXGLContexts.app.hwnd; GL11.glClearColor(0f, 0f, 0f, 1f); while (!GLFW.glfwWindowShouldClose(appHwnd)) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); render();//from w w w .j a v a 2s.c om GLFW.glfwSwapBuffers(appHwnd); GLFW.glfwPollEvents(); } }
From source file:cuchaz.jfxgl.prism.JFXGLContext.java
License:Open Source License
@Override public void clearBuffers(Color color, boolean clearColor, boolean clearDepth, boolean ignoreScissor) { clearBuffersState.backup();//from w w w .j ava 2 s . c o m if (ignoreScissor) { GL11.glDisable(GL11.GL_SCISSOR_TEST); } int clearFlags = 0; if (clearColor) { clearFlags |= GL11.GL_COLOR_BUFFER_BIT; GL11.glClearColor(color.getRedPremult(), color.getGreenPremult(), color.getBluePremult(), color.getAlpha()); } if (clearDepth) { clearFlags |= GL11.GL_DEPTH_BUFFER_BIT; GL11.glDepthMask(true); GL11.glClear(clearFlags); } else { GL11.glClear(clearFlags); } clearBuffersState.restore(); }
From source file:dripdisplay.DripDisplayLWJGL.java
protected void initGLLWJGL() { if (!LEVEL_EDITOR) { GL11.glViewport(0, 0, 800, 600); } else {/*from w w w . ja v a 2 s. co m*/ GL11.glViewport(0, 0, 1000, 800); } GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); if (!LEVEL_EDITOR) { GL11.glOrtho(0, 800, 600, 0, 1, -1); } else { GL11.glOrtho(0, 1000, 800, 0, 1, -1); } GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); initTextures(); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); createModel(); }