diff options
author | Chien Yang <[email protected]> | 2005-12-13 01:39:34 +0000 |
---|---|---|
committer | Chien Yang <[email protected]> | 2005-12-13 01:39:34 +0000 |
commit | 946937c96fddcdadb6e9d4daffc075ab343d5138 (patch) | |
tree | 749a24d459c93b928392b852cf64b33ec5e04558 /src/native | |
parent | c6487f83fcbb54bf2a98914094e8813641f017e2 (diff) |
1) Fixed issue 175 : OffScreenRendering: Issue with Updating Texture Size from Behavior.
2) Fixed issue 208 : Sound nodes cannot be placed below Switch groups
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@476 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/native')
-rw-r--r-- | src/native/ogl/Canvas3D.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/native/ogl/Canvas3D.c b/src/native/ogl/Canvas3D.c index f653e84..f18d817 100644 --- a/src/native/ogl/Canvas3D.c +++ b/src/native/ogl/Canvas3D.c @@ -1309,7 +1309,7 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext( JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_useCtx( +jboolean JNICALL Java_javax_media_j3d_Canvas3D_useCtx( JNIEnv *env, jclass cl, jlong ctxInfo, @@ -1318,13 +1318,36 @@ void JNICALL Java_javax_media_j3d_Canvas3D_useCtx( { GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo; jlong ctx = ctxProperties->context; + int result; #if defined(UNIX) - glXMakeCurrent((Display *)display, (GLXDrawable)window, (GLXContext)ctx); + + result = glXMakeCurrent((Display *)display, (GLXDrawable)window, (GLXContext)ctx); + if (result != GL_TRUE) { + fprintf(stderr, "Java 3D ERROR : In Canvas3D.useCtx() glXMakeCurrent fails\n"); + return JNI_FALSE; + } + #endif #ifdef WIN32 - wglMakeCurrent((HDC) window, (HGLRC) ctx); + DWORD err; + LPTSTR errString; + + result = wglMakeCurrent((HDC) window, (HGLRC) ctx); + /* fprintf(stderr, "useCtx : wglMakeCurrent : window %d, ctx %d, result = %d\n", + window, (int) ctx, result); */ + + if (result != GL_TRUE) { + err = GetLastError(); + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, err, 0, (LPTSTR)&errString, 0, NULL); + fprintf(stderr, "wglMakeCurrent Failed: %s\n", errString); + return JNI_FALSE; + } + #endif + return JNI_TRUE; } JNIEXPORT @@ -2741,7 +2764,6 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_createOffScreenBuffer( hpbuf = pFormatInfoPtr->wglCreatePbufferARB( hdc, pFormatInfoPtr->offScreenPFormat, width, height, piAttrs); - if(hpbuf == NULL) { printErrorMessage("In Canvas3D : wglCreatePbufferARB FAIL."); ReleaseDC(hwnd, hdc); |