Windows: Check for gl errors after setting swap interval

This commit is contained in:
Elias Naur 2007-05-27 05:19:19 +00:00
parent 59a3176ace
commit 42e75bb619
3 changed files with 9 additions and 10 deletions

View File

@ -57,7 +57,7 @@ public final class Sys {
private static final String VERSION = "1.1";
/** Current version of the JNI library */
static final int JNI_VERSION = 9;
static final int JNI_VERSION = 10;
/** The implementation instance to delegate platform specific behavior to */
private final static SysImplementation implementation;

View File

@ -34,6 +34,7 @@ package org.lwjgl.opengl;
import java.nio.ByteBuffer;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
/**
*
@ -96,14 +97,12 @@ final class WindowsContextImplementation implements ContextImplementation {
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
public void setSwapInterval(int value) {
Context current_context = Context.getCurrentContext();
if (current_context == null)
throw new IllegalStateException("No context is current");
synchronized (current_context) {
nSetSwapInterval(current_context.getHandle(), value);
}
boolean success = nSetSwapInterval(value) == GL11.GL_TRUE ? true : false;
if (!success)
LWJGLUtil.log("Failed to set swap interval");
Util.checkGLError();
}
private static native void nSetSwapInterval(ByteBuffer context_handle, int value);
private static native int nSetSwapInterval(int value);
public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException {
nDestroy(handle);

View File

@ -105,8 +105,8 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nI
return wglGetCurrentContext() == context_info->context;
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSetSwapInterval
(JNIEnv *env, jclass clazz, jobject context_handle, jint value) {
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSetSwapInterval
(JNIEnv *env, jclass clazz, jint value) {
WGLExtensions extensions;
extgl_InitWGL(&extensions);
if (extensions.WGL_EXT_swap_control) {