aboutsummaryrefslogtreecommitdiffstats
path: root/src/native
diff options
context:
space:
mode:
authorChien Yang <[email protected]>2005-02-14 20:54:30 +0000
committerChien Yang <[email protected]>2005-02-14 20:54:30 +0000
commita606b2163bba30d9ab9ce3bc6ca08b1f7dd18f2d (patch)
tree669d7d49c1a6f1259b433848bd4a89c507b745f8 /src/native
parentd5602c854548a67bf11adf339a5f87cd3bce5505 (diff)
1) Fixed to issue 97 - ATI video card related - Lockup, lose hardware acceleration and crash OS.
2) Fixed to issue 98 - Random Lockup when adding a Canvas3D to JTabbedPane. 3) Partial fix to issue 100 - Offscreen Capture crash JVM. git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@120 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/native')
-rw-r--r--src/native/ogl/Canvas3D.c48
-rw-r--r--src/native/ogl/NativeConfigTemplate3D.c2
2 files changed, 34 insertions, 16 deletions
diff --git a/src/native/ogl/Canvas3D.c b/src/native/ogl/Canvas3D.c
index 1899e9c..a33eb54 100644
--- a/src/native/ogl/Canvas3D.c
+++ b/src/native/ogl/Canvas3D.c
@@ -1216,6 +1216,7 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext(
DWORD err;
LPTSTR errString;
jboolean result;
+ PixelFormatInfo *PixelFormatInfoPtr = (PixelFormatInfo *)fbConfigListPtr;
/* Fix for issue 76 */
@@ -1240,20 +1241,16 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext(
* by wglChoosePixelFormat() or wglChoosePixelFormatARB.
*/
- if(!offScreen) {
- /* fprintf(stderr, "Canvas3D_createNewContext: onScreen PixelFormat is %d\n", vid); */
-
- if (vid <= 0) {
+ if(!offScreen) { // Fix to issue 97
+ if ((PixelFormatInfoPtr == NULL) || (PixelFormatInfoPtr->onScreenPFormat <= 0)) {
printErrorMessage("Canvas3D_createNewContext: onScreen PixelFormat is invalid");
return 0;
}
else {
- PixelFormatID = vid;
+ PixelFormatID = PixelFormatInfoPtr->onScreenPFormat;
}
}
- else { /* offScreen case */
- PixelFormatInfo *PixelFormatInfoPtr = (PixelFormatInfo *)fbConfigListPtr;
-
+ else { /* offScreen case */
if ((PixelFormatInfoPtr == NULL) || (PixelFormatInfoPtr->offScreenPFormat <= 0)) {
printErrorMessage("Canvas3D_createNewContext: offScreen PixelFormat is invalid");
return 0;
@@ -1265,8 +1262,12 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext(
SetPixelFormat(hdc, PixelFormatID, NULL);
+ // fprintf(stderr, "Before wglCreateContext\n");
+
hrc = wglCreateContext( hdc );
+ // fprintf(stderr, "After wglCreateContext hrc = 0x%x\n", hrc);
+
if (!hrc) {
err = GetLastError();
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
@@ -1281,7 +1282,9 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext(
wglShareLists( (HGLRC) sharedCtx, hrc );
}
+ // fprintf(stderr, "Before wglMakeCurrent\n");
result = wglMakeCurrent(hdc, hrc);
+ // fprintf(stderr, "After wglMakeCurrent result = %d\n", result);
if (!result) {
err = GetLastError();
@@ -3335,6 +3338,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_createQueryContext(
static char szAppName[] = "OpenGL";
jlong vinfo = 0;
jboolean result;
+ PixelFormatInfo *PixelFormatInfoPtr = (PixelFormatInfo *)fbConfigListPtr;
/* Fix for issue 76 */
@@ -3346,14 +3350,28 @@ void JNICALL Java_javax_media_j3d_Canvas3D_createQueryContext(
/*
* vid must be valid PixelFormat returned
* by wglChoosePixelFormat() or wglChoosePixelFormatARB.
- */
- if (vid <= 0) {
- printErrorMessage("Canvas3D_createQueryContext: PixelFormat is invalid");
- return;
- }
-
- PixelFormatID = (int)vid;
+ */
+ // Fix to issue 97
+ if(!offScreen) {
+ if ((PixelFormatInfoPtr == NULL) || (PixelFormatInfoPtr->onScreenPFormat <= 0)) {
+ printErrorMessage("Canvas3D_createNewContext: onScreen PixelFormat is invalid");
+ return;
+ }
+ else {
+ PixelFormatID = PixelFormatInfoPtr->onScreenPFormat;
+ }
+ }
+ else {
+ if ((PixelFormatInfoPtr == NULL) || (PixelFormatInfoPtr->offScreenPFormat <= 0)) {
+ printErrorMessage("Canvas3D_createNewContext: offScreen PixelFormat is invalid");
+ return;
+ }
+ else {
+ PixelFormatID = PixelFormatInfoPtr->offScreenPFormat;
+ }
+ }
+
/* onscreen rendering and window is 0 now */
if(window == 0 && !offScreen){
/* fprintf(stderr, "CreateQueryContext : window == 0 && !offScreen\n"); */
diff --git a/src/native/ogl/NativeConfigTemplate3D.c b/src/native/ogl/NativeConfigTemplate3D.c
index 9ebb0f3..0e9976a 100644
--- a/src/native/ogl/NativeConfigTemplate3D.c
+++ b/src/native/ogl/NativeConfigTemplate3D.c
@@ -972,7 +972,7 @@ int find_DB_AA_S_PixelFormat( HDC hdc, PixelFormatInfo * pFormatInfo,
if (dbVal == UNNECESSARY || dbVal== PREFERRED) {
index = dbIndex;
wglAttrs[index++] = WGL_DOUBLE_BUFFER_ARB;
- wglAttrs[index++] = TRUE;
+ wglAttrs[index++] = FALSE; // Partial fix to issue 100.
/*
* Terminate by 2 zeros to avoid driver bugs
* that assume attributes always come in pairs.