createARBContextAndPixelFormat didn't return true when ok
This commit is contained in:
parent
2227e83ea4
commit
dd312b492b
|
@ -703,38 +703,45 @@ static bool createARBContextAndPixelFormat(JNIEnv *env, HDC hdc, jobject pixel_f
|
||||||
HWND arb_hwnd;
|
HWND arb_hwnd;
|
||||||
HDC arb_hdc;
|
HDC arb_hdc;
|
||||||
HGLRC arb_context;
|
HGLRC arb_context;
|
||||||
|
|
||||||
// Some crazy strangeness here so we can use ARB_pixel_format to specify the number
|
// Some crazy strangeness here so we can use ARB_pixel_format to specify the number
|
||||||
// of multisamples we want. If the extension is present we'll delete the existing
|
// of multisamples we want. If the extension is present we'll delete the existing
|
||||||
// rendering context and start over, using the ARB extension instead to pick the context.
|
// rendering context and start over, using the ARB extension instead to pick the context.
|
||||||
if (!extgl_Extensions.WGL_ARB_pixel_format)
|
if ( !extgl_Extensions.WGL_ARB_pixel_format )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
pixel_format_index = findPixelFormatARB(env, hdc, pixel_format, NULL, true, true, true, true);
|
pixel_format_index = findPixelFormatARB(env, hdc, pixel_format, NULL, true, true, true, true);
|
||||||
if (pixel_format_index == -1) {
|
if ( pixel_format_index == -1 ) {
|
||||||
pixel_format_index = findPixelFormatARB(env, hdc, pixel_format, NULL, true, true, false, true);
|
pixel_format_index = findPixelFormatARB(env, hdc, pixel_format, NULL, true, true, false, true);
|
||||||
if (pixel_format_index == -1)
|
if ( pixel_format_index == -1 )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
arb_hwnd = createWindow(0, 0, 1, 1, false, false);
|
arb_hwnd = createWindow(0, 0, 1, 1, false, false);
|
||||||
if (arb_hwnd == NULL)
|
if ( arb_hwnd == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
arb_hdc = GetDC(arb_hwnd);
|
arb_hdc = GetDC(arb_hwnd);
|
||||||
if (!applyPixelFormat(arb_hdc, pixel_format_index)) {
|
if ( !applyPixelFormat(arb_hdc, pixel_format_index) ) {
|
||||||
closeWindow(arb_hwnd, arb_hdc);
|
closeWindow(arb_hwnd, arb_hdc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
arb_context = wglCreateContext(arb_hdc);
|
arb_context = wglCreateContext(arb_hdc);
|
||||||
closeWindow(arb_hwnd, arb_hdc);
|
closeWindow(arb_hwnd, arb_hdc);
|
||||||
if (arb_context == NULL) {
|
if ( arb_context == NULL )
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (!wglMakeCurrent(arb_hdc, arb_context)) {
|
if ( !wglMakeCurrent(arb_hdc, arb_context) ) {
|
||||||
wglDeleteContext(arb_context);
|
wglDeleteContext(arb_context);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
extgl_InitWGL(env);
|
extgl_InitWGL(env);
|
||||||
*pixel_format_index_return = pixel_format_index;
|
*pixel_format_index_return = pixel_format_index;
|
||||||
*context_return = arb_context;
|
*context_return = arb_context;
|
||||||
return;
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createContext(JNIEnv *env, jobject self, jobject pixel_format) {
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createContext(JNIEnv *env, jobject self, jobject pixel_format) {
|
||||||
|
|
Loading…
Reference in New Issue