Commits

Michael Ludwig  committed a4e066a

Fix bugs with AxisAlignedBox, and a bad mistake with glFlush() being called in the main thread.

  • Participants
  • Parent commits 18c0d90

Comments (0)

Files changed (4)

File src/com/ferox/math/AxisAlignedBox.java

 				if (normal.z > 0) {
 					min.x = this.worldMin.x; min.y = this.worldMin.y; min.z = this.worldMin.z;
 				} else {
-					min.x = this.worldMin.x; min.y = this.worldMin.y; min.z = this.worldMin.z;
+					min.x = this.worldMin.x; min.y = this.worldMin.y; min.z = this.worldMax.z;
 				}
 			} else {
 				if (normal.z > 0) {
-					min.x = this.worldMin.x; min.y = this.worldMin.y; min.z = this.worldMin.z;
+					min.x = this.worldMin.x; min.y = this.worldMax.y; min.z = this.worldMin.z;
 				} else {
-					min.x = this.worldMin.x; min.y = this.worldMin.y; min.z = this.worldMin.z;
+					min.x = this.worldMin.x; min.y = this.worldMax.y; min.z = this.worldMax.z;
 				}
 			}
 		} else {
 			if (normal.y > 0) {
 				if (normal.z > 0) {
-					min.x = this.worldMin.x; min.y = this.worldMin.y; min.z = this.worldMin.z;
+					min.x = this.worldMax.x; min.y = this.worldMin.y; min.z = this.worldMin.z;
 				} else {
-					min.x = this.worldMin.x; min.y = this.worldMin.y; min.z = this.worldMin.z;
+					min.x = this.worldMax.x; min.y = this.worldMin.y; min.z = this.worldMax.z;
 				}
 			} else {
 				if (normal.z > 0) {
-					min.x = this.worldMin.x; min.y = this.worldMin.y; min.z = this.worldMin.z;
+					min.x = this.worldMax.x; min.y = this.worldMax.y; min.z = this.worldMin.z;
 				} else {
-					min.x = this.worldMin.x; min.y = this.worldMin.y; min.z = this.worldMin.z;
+					min.x = this.worldMax.x; min.y = this.worldMax.y; min.z = this.worldMax.z;
 				}
 			}
 		}
 				if (normal.z > 0) {
 					max.x = this.worldMax.x; max.y = this.worldMax.y; max.z = this.worldMax.z;
 				} else {
-					max.x = this.worldMax.x; max.y = this.worldMax.y; max.z = this.worldMax.z;
+					max.x = this.worldMax.x; max.y = this.worldMax.y; max.z = this.worldMin.z;
 				}
 			} else {
 				if (normal.z > 0) {
-					max.x = this.worldMax.x; max.y = this.worldMax.y; max.z = this.worldMax.z;
+					max.x = this.worldMax.x; max.y = this.worldMin.y; max.z = this.worldMax.z;
 				} else {
-					max.x = this.worldMax.x; max.y = this.worldMax.y; max.z = this.worldMax.z;
+					max.x = this.worldMax.x; max.y = this.worldMin.y; max.z = this.worldMin.z;
 				}
 			}
 		} else {
 			if (normal.y > 0) {
 				if (normal.z > 0) {
-					max.x = this.worldMax.x; max.y = this.worldMax.y; max.z = this.worldMax.z;
+					max.x = this.worldMin.x; max.y = this.worldMax.y; max.z = this.worldMax.z;
 				} else {
-					max.x = this.worldMax.x; max.y = this.worldMax.y; max.z = this.worldMax.z;
+					max.x = this.worldMin.x; max.y = this.worldMax.y; max.z = this.worldMin.z;
 				}
 			} else {
 				if (normal.z > 0) {
-					max.x = this.worldMax.x; max.y = this.worldMax.y; max.z = this.worldMax.z;
+					max.x = this.worldMin.x; max.y = this.worldMin.y; max.z = this.worldMax.z;
 				} else {
-					max.x = this.worldMax.x; max.y = this.worldMax.y; max.z = this.worldMax.z;
+					max.x = this.worldMin.x; max.y = this.worldMin.y; max.z = this.worldMin.z;
 				}
 			}
 		}

File src/com/ferox/renderer/impl/jogl/AttachableSurfaceImplHelper.java

 					next = (i < size ? this.attachedSurfaces.get(i) : null);
 				}
 			}
+			
+			// flush everything that has been issued
+			drawable.getGL().glFlush();
 		} catch (Exception e) {
 			this.caughtEDTException = e;
 			return;

File src/com/ferox/renderer/impl/jogl/JoglRenderSurface.java

 			throw new RenderException("Cannot render a surface that must be attached to GL context");
 		
 		this.helper.render(gd);
-		gd.getGL().glFlush();
 	}
 
 	@Override

File test/com/ferox/scene/GlslTest.java

 import org.openmali.vecmath.Vector3f;
 
 import com.ferox.BasicApplication;
+import com.ferox.math.AxisAlignedBox;
 import com.ferox.math.BoundSphere;
 import com.ferox.math.Color;
 import com.ferox.renderer.Renderer;
 		Appearance app = this.createGlslAppearance(renderer);
 		
 		Shape s = new Shape(cube, app);
-		s.setLocalBounds(new BoundSphere());
+		s.setLocalBounds(new AxisAlignedBox());
 		root.add(s);
 		
 		SpotLight light = new SpotLight(new Color(1f, 1f, 1f), new Color(1f, 0f, 0f), new Color());