Roi Atalla avatar Roi Atalla committed 5a8717f

Fixed an issue with the old OSB4 examples where stencil buffer wasn't enabled in LWJGL.

Comments (0)

Files changed (3)

src/main/java/com/ra4king/opengl/GLProgram.java

 		gameLoop();
 	}
 	
+	public final void run(PixelFormat format) {
+		run(format, new ContextAttribs());
+	}
+	
+	public final void run(PixelFormat format, ContextAttribs attribs) {
+		try {
+			Display.create(format, attribs);
+		} catch(Exception exc) {
+			exc.printStackTrace();
+			System.exit(1);
+		}
+		
+		gameLoop();
+	}
+	
 	private void gameLoop() {
 		try {
 			init();

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter11/example2/Example11_2.java

 				break;
 			case Keyboard.KEY_H:
 				if(Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
-					if(lightModel.ordinal()%2 != 0)
-						lightModel = LightingModel.values()[(lightModel.ordinal()-1)%LightingModel.values().length];
+					if(lightModel.ordinal() % 2 != 0)
+						lightModel = LightingModel.values()[(lightModel.ordinal() - 1) % LightingModel.values().length];
 					else
-						lightModel = LightingModel.values()[(lightModel.ordinal()+1)%LightingModel.values().length];
+						lightModel = LightingModel.values()[(lightModel.ordinal() + 1) % LightingModel.values().length];
 				}
 				else
-					lightModel = LightingModel.values()[(lightModel.ordinal()+2)%LightingModel.values().length];
+					lightModel = LightingModel.values()[(lightModel.ordinal() + 2) % LightingModel.values().length];
 				
 				changedLightModel = true;
 				break;

src/main/java/com/ra4king/opengl/superbible/osb4/chapter3/Example3_14.java

 import static org.lwjgl.opengl.GL11.*;
 
 import org.lwjgl.opengl.Display;
+import org.lwjgl.opengl.PixelFormat;
 
 import com.ra4king.opengl.GLProgram;
 
 public class Example3_14 extends GLProgram {
 	public static void main(String[] args) {
-		new Example3_14().run();
+		new Example3_14().run(new PixelFormat(8,16,8));
 	}
 	
 	private float x, y, size = 50;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.