Win32: Handle context-dependent wgl extensions

This commit is contained in:
Elias Naur 2005-02-24 13:24:08 +00:00
parent f9400843aa
commit a5469e6ff3
8 changed files with 277 additions and 205 deletions

View file

@ -94,9 +94,14 @@ final class Win32ContextImplementation implements ContextImplementation {
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
public void setVSync(boolean enabled) {
nSetVSync(enabled);
Context current_context = Context.getCurrentContext();
if (current_context == null)
throw new IllegalStateException("No context is current");
synchronized (current_context) {
nSetVSync(current_context.getHandle(), enabled);
}
}
private static native void nSetVSync(boolean enabled);
private static native void nSetVSync(ByteBuffer context_handle, boolean enabled);
public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException {
nDestroy(handle);

View file

@ -124,7 +124,17 @@ final class Win32Display implements DisplayImplementation {
}
public native void destroyCursor(Object cursorHandle);
public native int getPbufferCapabilities();
public int getPbufferCapabilities() {
try {
// Return the capabilities of a minimum pixel format
return nGetPbufferCapabilities(new PixelFormat(0, 0, 0, 0, 0, 0, 0, 0, false));
} catch (LWJGLException e) {
Sys.log("Exception occurred while determining pbuffer capabilities: " + e);
return 0;
}
}
private native int nGetPbufferCapabilities(PixelFormat format) throws LWJGLException;
public boolean isBufferLost(PeerInfo handle) {
return ((Win32PbufferPeerInfo)handle).isBufferLost();
}