Revert the Pbuffer "find singe buffered pixel format" behaviour in the Display context shared path.

This commit is contained in:
Elias Naur 2004-07-26 19:13:02 +00:00
parent 7c949a1325
commit a04133fe8a
1 changed files with 1 additions and 51 deletions

View File

@ -139,54 +139,6 @@ static HGLRC createPbufferContext(JNIEnv *env, HDC Pbuffer_dc) {
return Pbuffer_context;
}
static bool formatMatches(HDC hdc, int pixel_format1, int pixel_format2, int attribute) {
int format_val1;
int format_val2;
if (wglGetPixelFormatAttribivARB(hdc, pixel_format1, 0, 1, &attribute, &format_val1) != TRUE)
return false;
if (wglGetPixelFormatAttribivARB(hdc, pixel_format2, 0, 1, &attribute, &format_val2) != TRUE)
return false;
return format_val1 == format_val2;
}
static int chooseSingleBufferedFormatFromFormat(HDC hdc, int orig_pixel_format) {
int max_pixel_format_index = DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), NULL);
for (int i = 1; i <= max_pixel_format_index; i++) {
int attribute = WGL_DOUBLE_BUFFER_ARB;
int double_buffer;
if (wglGetPixelFormatAttribivARB(hdc, i, 0, 1, &attribute, &double_buffer) != TRUE) {
return -1;
}
attribute = WGL_DRAW_TO_PBUFFER_ARB;
int draw_to_pbuffer;
if (wglGetPixelFormatAttribivARB(hdc, i, 0, 1, &attribute, &draw_to_pbuffer) != TRUE) {
return -1;
}
if (double_buffer != FALSE || draw_to_pbuffer != TRUE)
continue;
if (formatMatches(hdc, i, orig_pixel_format, WGL_RED_BITS_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_GREEN_BITS_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_BLUE_BITS_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_ALPHA_BITS_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_ACCUM_RED_BITS_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_ACCUM_GREEN_BITS_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_ACCUM_BLUE_BITS_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_ACCUM_ALPHA_BITS_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_DEPTH_BITS_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_STENCIL_BITS_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_ACCELERATION_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_SUPPORT_OPENGL_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_STEREO_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_AUX_BUFFERS_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_PIXEL_TYPE_ARB) &&
(!extgl_Extensions.WGL_ARB_multisample || (formatMatches(hdc, i, orig_pixel_format, WGL_SAMPLE_BUFFERS_ARB) &&
formatMatches(hdc, i, orig_pixel_format, WGL_SAMPLES_ARB)))) {
return i;
}
}
return -1;
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate
(JNIEnv *env, jclass clazz, jobject buffer_handle, jboolean use_display_context,
jint width, jint height, jobject pixel_format,
@ -204,9 +156,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate
pBufferAttribs_ptr = NULL;
}
if (use_display_context) {
int iPixelFormat = chooseSingleBufferedFormatFromFormat(getCurrentWindowDC(), getCurrentPixelFormat());
if (iPixelFormat == -1)
iPixelFormat = getCurrentPixelFormat();
int iPixelFormat = getCurrentPixelFormat();
Pbuffer = wglCreatePbufferARB(getCurrentWindowDC(), iPixelFormat, width, height, pBufferAttribs_ptr);
} else {
Pbuffer = createPbuffer(env, width, height, pixel_format, pixelFormatCaps, pBufferAttribs_ptr);