From: <ka...@us...> - 2009-12-01 15:13:10
|
Revision: 3258 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3258&view=rev Author: kappa1 Date: 2009-12-01 15:12:52 +0000 (Tue, 01 Dec 2009) Log Message: ----------- added the Display.setInitialBackground(r,g,b) method, this will allow you to select the initial background color of the lwjgl Display window. Useful to create more polished applications and smoother looking applets. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2009-12-01 11:39:48 UTC (rev 3257) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2009-12-01 15:12:52 UTC (rev 3258) @@ -116,6 +116,9 @@ private static boolean window_created = false; private static boolean parent_resized; + + /** Initial Background Color of Display */ + private static float r = 0, g = 0, b = 0; private static ComponentListener component_listener = new ComponentAdapter() { public void componentResized(ComponentEvent e) { @@ -861,6 +864,20 @@ } } } + + /** + * Set the initial color of the Display. This method is called before the Display is created and will set the + * background color to the one specified in this method. + * + * @param red - color value between 0 - 1 + * @param green - color value between 0 - 1 + * @param blue - color value between 0 - 1 + */ + public static void setInitialBackground(float red, float green, float blue) { + r = red; + g = green; + b = blue; + } private static void makeCurrentAndSetSwapInterval() throws LWJGLException { makeCurrent(); @@ -869,6 +886,8 @@ } private static void initContext() { + // set background clear color + GL11.glClearColor(r, g, b, 1.0f); // Clear window to avoid the desktop "showing through" GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); update(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |