From 7427ba13f6a386ada00ef130445499c8482edffb Mon Sep 17 00:00:00 2001 From: Ioannis Tsakpinis Date: Wed, 31 Mar 2004 21:03:20 +0000 Subject: [PATCH] Bugs fixed --- .../lwjgl/test/opengl/shaders/ShadersTest.java | 16 +++++++--------- .../org/lwjgl/test/opengl/shaders/shaderFSH.fsh | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java b/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java index 646d27d6..a58228b5 100644 --- a/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java +++ b/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java @@ -122,13 +122,11 @@ public final class ShadersTest { DisplayMode displayMode; - displayMode = chooseMode(modes, 1024, 768, 32); + displayMode = chooseMode(modes, 1024, 768); if ( displayMode == null ) - displayMode = chooseMode(modes, 800, 600, 32); + displayMode = chooseMode(modes, 800, 600); if ( displayMode == null ) - displayMode = chooseMode(modes, 1024, 768, 16); - if ( displayMode == null ) - displayMode = chooseMode(modes, 800, 600, 16); + displayMode = chooseMode(modes, 640, 480); if ( displayMode == null ) kill("Failed to set an appropriate display mode."); @@ -206,7 +204,7 @@ public final class ShadersTest { // Setup lighting for when we have fixed function fragment rendering. GL11.glShadeModel(GL11.GL_SMOOTH); - if (shader == null ) { + if ( shader == null ) { GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHT0); } @@ -281,13 +279,13 @@ public final class ShadersTest { sphere.draw(1.0f, 32, 32); } - private static DisplayMode chooseMode(DisplayMode[] modes, int width, int height, int bpp) { + private static DisplayMode chooseMode(DisplayMode[] modes, int width, int height) { DisplayMode bestMode = null; for ( int i = 0; i < modes.length; i++ ) { DisplayMode mode = modes[i]; - if ( mode.width == width && mode.height == height && mode.bpp == bpp && mode.freq <= 85 ) { - if ( bestMode == null || bestMode.freq < mode.freq ) + if ( mode.width == width && mode.height == height && mode.freq <= 85 ) { + if ( bestMode == null || (mode.bpp >= bestMode.bpp && mode.freq > bestMode.freq) ) bestMode = mode; } } diff --git a/src/java/org/lwjgl/test/opengl/shaders/shaderFSH.fsh b/src/java/org/lwjgl/test/opengl/shaders/shaderFSH.fsh index 8d024d83..dd510297 100644 --- a/src/java/org/lwjgl/test/opengl/shaders/shaderFSH.fsh +++ b/src/java/org/lwjgl/test/opengl/shaders/shaderFSH.fsh @@ -8,7 +8,7 @@ void main(void) { // Normalize position. // Multiply with current sin. - color2D.xy = normalize(color2D) * UNIFORMS.x; + color2D.xy = normalize(color2D).xy * UNIFORMS.x; // {-1..1} => {0..1} & Intensify colors. color2D.xy = (vec2(color2D) * 0.5 + 0.5) * 2.0; color2D.z = 1.0;