Skip to content

Commit

Permalink
Refactor so that the peer_info variable in ContextGL does not need to…
Browse files Browse the repository at this point in the history
… be static
  • Loading branch information
kappaOne committed Mar 4, 2012
1 parent 6010657 commit 093bfe9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/java/org/lwjgl/opengl/ContextGL.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -229,7 +229,7 @@ private void checkDestroy() {
* 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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/java/org/lwjgl/opengl/ContextImplementation.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion src/java/org/lwjgl/opengl/LinuxContextImplementation.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ public boolean isCurrent(ByteBuffer handle) throws LWJGLException {

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 ) {
Expand Down
2 changes: 1 addition & 1 deletion src/java/org/lwjgl/opengl/MacOSXContextImplementation.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public boolean isCurrent(ByteBuffer handle) throws LWJGLException {

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public boolean isCurrent(ByteBuffer handle) throws LWJGLException {

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");
Expand Down

0 comments on commit 093bfe9

Please sign in to comment.