|
|
@ -29,7 +29,6 @@ |
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
package com.jme3.system.lwjgl; |
|
|
|
package com.jme3.system.lwjgl; |
|
|
|
|
|
|
|
|
|
|
|
import com.jme3.input.lwjgl.JInputJoyInput; |
|
|
|
import com.jme3.input.lwjgl.JInputJoyInput; |
|
|
@ -82,18 +81,18 @@ public abstract class LwjglContext implements JmeContext { |
|
|
|
protected Timer timer; |
|
|
|
protected Timer timer; |
|
|
|
protected SystemListener listener; |
|
|
|
protected SystemListener listener; |
|
|
|
|
|
|
|
|
|
|
|
public void setSystemListener(SystemListener listener){ |
|
|
|
public void setSystemListener(SystemListener listener) { |
|
|
|
this.listener = listener; |
|
|
|
this.listener = listener; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void printContextInitInfo() { |
|
|
|
protected void printContextInitInfo() { |
|
|
|
logger.log(Level.INFO, "LWJGL {0} context running on thread {1}\n" + |
|
|
|
logger.log(Level.INFO, "LWJGL {0} context running on thread {1}\n" |
|
|
|
" * Graphics Adapter: {2}\n" + |
|
|
|
+ " * Graphics Adapter: {2}\n" |
|
|
|
" * Driver Version: {3}\n" + |
|
|
|
+ " * Driver Version: {3}\n" |
|
|
|
" * Scaling Factor: {4}", |
|
|
|
+ " * Scaling Factor: {4}", |
|
|
|
new Object[]{ Sys.getVersion(), Thread.currentThread().getName(), |
|
|
|
new Object[]{Sys.getVersion(), Thread.currentThread().getName(), |
|
|
|
Display.getAdapter(), Display.getVersion(), |
|
|
|
Display.getAdapter(), Display.getVersion(), |
|
|
|
Display.getPixelScaleFactor() }); |
|
|
|
Display.getPixelScaleFactor()}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected ContextAttribs createContextAttribs() { |
|
|
|
protected ContextAttribs createContextAttribs() { |
|
|
@ -162,6 +161,7 @@ public abstract class LwjglContext implements JmeContext { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void loadNatives() { |
|
|
|
protected void loadNatives() { |
|
|
|
if (JmeSystem.isLowPermissions()) { |
|
|
|
if (JmeSystem.isLowPermissions()) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -181,7 +181,7 @@ public abstract class LwjglContext implements JmeContext { |
|
|
|
|
|
|
|
|
|
|
|
protected int getNumSamplesToUse() { |
|
|
|
protected int getNumSamplesToUse() { |
|
|
|
int samples = 0; |
|
|
|
int samples = 0; |
|
|
|
if (settings.getSamples() > 1){ |
|
|
|
if (settings.getSamples() > 1) { |
|
|
|
samples = settings.getSamples(); |
|
|
|
samples = settings.getSamples(); |
|
|
|
int supportedSamples = determineMaxSamples(samples); |
|
|
|
int supportedSamples = determineMaxSamples(samples); |
|
|
|
if (supportedSamples < samples) { |
|
|
|
if (supportedSamples < samples) { |
|
|
@ -196,10 +196,10 @@ public abstract class LwjglContext implements JmeContext { |
|
|
|
return samples; |
|
|
|
return samples; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void initContextFirstTime(){ |
|
|
|
protected void initContextFirstTime() { |
|
|
|
if (!GLContext.getCapabilities().OpenGL20) { |
|
|
|
if (!GLContext.getCapabilities().OpenGL20) { |
|
|
|
throw new RendererException("OpenGL 2.0 or higher is " + |
|
|
|
throw new RendererException("OpenGL 2.0 or higher is " |
|
|
|
"required for jMonkeyEngine"); |
|
|
|
+ "required for jMonkeyEngine"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL2) |
|
|
|
if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL2) |
|
|
@ -260,42 +260,42 @@ public abstract class LwjglContext implements JmeContext { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void internalDestroy(){ |
|
|
|
public void internalDestroy() { |
|
|
|
renderer = null; |
|
|
|
renderer = null; |
|
|
|
timer = null; |
|
|
|
timer = null; |
|
|
|
renderable.set(false); |
|
|
|
renderable.set(false); |
|
|
|
synchronized (createdLock){ |
|
|
|
synchronized (createdLock) { |
|
|
|
created.set(false); |
|
|
|
created.set(false); |
|
|
|
createdLock.notifyAll(); |
|
|
|
createdLock.notifyAll(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void internalCreate(){ |
|
|
|
public void internalCreate() { |
|
|
|
timer = new LwjglTimer(); |
|
|
|
timer = new LwjglTimer(); |
|
|
|
|
|
|
|
|
|
|
|
synchronized (createdLock){ |
|
|
|
synchronized (createdLock) { |
|
|
|
created.set(true); |
|
|
|
created.set(true); |
|
|
|
createdLock.notifyAll(); |
|
|
|
createdLock.notifyAll(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (renderable.get()){ |
|
|
|
if (renderable.get()) { |
|
|
|
initContextFirstTime(); |
|
|
|
initContextFirstTime(); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
assert getType() == Type.Canvas; |
|
|
|
assert getType() == Type.Canvas; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void create(){ |
|
|
|
public void create() { |
|
|
|
create(false); |
|
|
|
create(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void destroy(){ |
|
|
|
public void destroy() { |
|
|
|
destroy(false); |
|
|
|
destroy(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void waitFor(boolean createdVal){ |
|
|
|
protected void waitFor(boolean createdVal) { |
|
|
|
synchronized (createdLock){ |
|
|
|
synchronized (createdLock) { |
|
|
|
while (created.get() != createdVal){ |
|
|
|
while (created.get() != createdVal) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
createdLock.wait(); |
|
|
|
createdLock.wait(); |
|
|
|
} catch (InterruptedException ex) { |
|
|
|
} catch (InterruptedException ex) { |
|
|
@ -304,11 +304,11 @@ public abstract class LwjglContext implements JmeContext { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isCreated(){ |
|
|
|
public boolean isCreated() { |
|
|
|
return created.get(); |
|
|
|
return created.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isRenderable(){ |
|
|
|
public boolean isRenderable() { |
|
|
|
return renderable.get(); |
|
|
|
return renderable.get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -316,7 +316,7 @@ public abstract class LwjglContext implements JmeContext { |
|
|
|
this.settings.copyFrom(settings); |
|
|
|
this.settings.copyFrom(settings); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AppSettings getSettings(){ |
|
|
|
public AppSettings getSettings() { |
|
|
|
return settings; |
|
|
|
return settings; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|