Refactor so that the peer_info variable in ContextGL does not need to be static
This commit is contained in:
parent
6010657389
commit
093bfe9698
|
@ -64,7 +64,7 @@ final class ContextGL implements Context {
|
|||
|
||||
/** Handle to the native GL rendering context */
|
||||
private final ByteBuffer handle;
|
||||
private static PeerInfo peer_info;
|
||||
private final PeerInfo peer_info;
|
||||
|
||||
private final ContextAttribs contextAttribs;
|
||||
private final boolean forwardCompatible;
|
||||
|
@ -229,7 +229,7 @@ final class ContextGL implements Context {
|
|||
* A video frame period is the time required to display a full frame of video data.
|
||||
*/
|
||||
public static void setSwapInterval(int value) {
|
||||
implementation.setSwapInterval(peer_info, value);
|
||||
implementation.setSwapInterval(value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,7 +81,7 @@ interface ContextImplementation {
|
|||
*/
|
||||
boolean isCurrent(ByteBuffer handle) throws LWJGLException;
|
||||
|
||||
void setSwapInterval(PeerInfo peer_info, int value);
|
||||
void setSwapInterval(int value);
|
||||
|
||||
/**
|
||||
* Destroys the Context.
|
||||
|
|
|
@ -141,8 +141,10 @@ final class LinuxContextImplementation implements ContextImplementation {
|
|||
|
||||
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
|
||||
|
||||
public void setSwapInterval(PeerInfo peer_info, int value) {
|
||||
public void setSwapInterval(int value) {
|
||||
ContextGL current_context = ContextGL.getCurrentContext();
|
||||
PeerInfo peer_info = current_context.getPeerInfo();
|
||||
|
||||
if ( current_context == null )
|
||||
throw new IllegalStateException("No context is current");
|
||||
synchronized ( current_context ) {
|
||||
|
|
|
@ -118,7 +118,7 @@ final class MacOSXContextImplementation implements ContextImplementation {
|
|||
|
||||
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
|
||||
|
||||
public void setSwapInterval(PeerInfo peer_info, int value) {
|
||||
public void setSwapInterval(int value) {
|
||||
ContextGL current_context = ContextGL.getCurrentContext();
|
||||
synchronized ( current_context ) {
|
||||
nSetSwapInterval(current_context.getHandle(), value);
|
||||
|
|
|
@ -106,7 +106,7 @@ final class WindowsContextImplementation implements ContextImplementation {
|
|||
|
||||
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
|
||||
|
||||
public void setSwapInterval(PeerInfo peer_info, int value) {
|
||||
public void setSwapInterval(int value) {
|
||||
boolean success = nSetSwapInterval(value);
|
||||
if ( !success )
|
||||
LWJGLUtil.log("Failed to set swap interval");
|
||||
|
|
Loading…
Reference in New Issue