瀏覽代碼

Kirill: Better fix for mac issue

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7448 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
nor..67 14 年之前
父節點
當前提交
8406f0058e

+ 2 - 1
engine/src/core/com/jme3/renderer/RenderContext.java

@@ -178,7 +178,8 @@ public class RenderContext {
         boundShaderProgram = 0;
         boundFBO = 0;
         boundRB = 0;
-        boundDrawBuf = -1;
+        boundDrawBuf = -1; 
+        boundReadBuf = -1;
         boundElementArrayVBO = 0;
         boundVertexArray = 0;
         boundArrayVBO = 0;

+ 8 - 7
engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglRenderer.java

@@ -202,14 +202,14 @@ public class LwjglRenderer implements Renderer {
 
         // Fix issue in TestRenderToMemory when GL_FRONT is the main
         // buffer being used.
-//        initialDrawBuf = glGetInteger(GL_DRAW_BUFFER);
-//        initialReadBuf = glGetInteger(GL_READ_BUFFER);
+        initialDrawBuf = glGetInteger(GL_DRAW_BUFFER);
+        initialReadBuf = glGetInteger(GL_READ_BUFFER);
         
         // XXX: This has to be GL_BACK for canvas on Mac
         // Since initialDrawBuf is GL_FRONT for pbuffer, gotta
         // change this value later on ...
-        initialDrawBuf = GL_BACK;
-        initialReadBuf = GL_BACK;
+//        initialDrawBuf = GL_BACK;
+//        initialReadBuf = GL_BACK;
 
         int spaceIdx = versionStr.indexOf(" ");
         if (spaceIdx >= 1) {
@@ -418,14 +418,15 @@ public class LwjglRenderer implements Renderer {
         context.reset();
         boundShader = null;
         lastFb = null;
+        
+        initialDrawBuf = glGetInteger(GL_DRAW_BUFFER);
+        initialReadBuf = glGetInteger(GL_READ_BUFFER);
     }
 
     public void resetGLObjects() {
         objManager.resetObjects();
         statistics.clearMemory();
-        context.reset();
-        boundShader = null;
-        lastFb = null;
+        invalidateState();
     }
 
     public void cleanup() {

+ 7 - 1
engine/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglCanvas.java

@@ -35,6 +35,8 @@ package com.jme3.system.lwjgl;
 import com.jme3.system.AppSettings;
 import com.jme3.system.JmeCanvasContext;
 import com.jme3.system.JmeContext.Type;
+import com.jme3.system.JmeSystem;
+import com.jme3.system.JmeSystem.Platform;
 import java.awt.Canvas;
 import java.util.concurrent.BrokenBarrierException;
 import java.util.concurrent.CyclicBarrier;
@@ -281,7 +283,11 @@ public class LwjglCanvas extends LwjglAbstractDisplay implements JmeCanvasContex
             try {
                 // NOTE: On Windows XP, not calling setParent(null)
                 // freezes the application.
-                Display.setParent(null);
+                // On Mac it freezes the application.
+                if (JmeSystem.getPlatform() == Platform.Windows32
+                 || JmeSystem.getPlatform() == Platform.Windows64){
+                    Display.setParent(null);
+                }
             } catch (LWJGLException ex) {
                 logger.log(Level.SEVERE, "Encountered exception when setting parent to null", ex);
             }