*** empty log message ***
This commit is contained in:
parent
0b07bb7afb
commit
1fd7d36188
|
@ -155,9 +155,8 @@ int findPixelFormatARB(JNIEnv *env, jobject pixel_format, jobject pixelFormatCap
|
||||||
/*
|
/*
|
||||||
* Find an appropriate pixel format
|
* Find an appropriate pixel format
|
||||||
*/
|
*/
|
||||||
static int findPixelFormat(JNIEnv *env, jobject pixel_format)
|
static int findPixelFormatFromBPP(JNIEnv *env, jobject pixel_format, int bpp)
|
||||||
{
|
{
|
||||||
int bpp = GetDeviceCaps(hdc, BITSPIXEL);
|
|
||||||
jclass cls_pixel_format = env->GetObjectClass(pixel_format);
|
jclass cls_pixel_format = env->GetObjectClass(pixel_format);
|
||||||
int alpha = (int)env->GetIntField(pixel_format, env->GetFieldID(cls_pixel_format, "alpha", "I"));
|
int alpha = (int)env->GetIntField(pixel_format, env->GetFieldID(cls_pixel_format, "alpha", "I"));
|
||||||
int depth = (int)env->GetIntField(pixel_format, env->GetFieldID(cls_pixel_format, "depth", "I"));
|
int depth = (int)env->GetIntField(pixel_format, env->GetFieldID(cls_pixel_format, "depth", "I"));
|
||||||
|
@ -241,6 +240,17 @@ static int findPixelFormat(JNIEnv *env, jobject pixel_format)
|
||||||
return iPixelFormat;
|
return iPixelFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int findPixelFormat(JNIEnv *env, jobject pixel_format) {
|
||||||
|
int bpp;
|
||||||
|
jclass cls_pixel_format = env->GetObjectClass(pixel_format);
|
||||||
|
bpp = GetDeviceCaps(hdc, BITSPIXEL);
|
||||||
|
int iPixelFormat = findPixelFormatFromBPP(env, pixel_format, bpp);
|
||||||
|
if (iPixelFormat == -1) {
|
||||||
|
return findPixelFormatFromBPP(env, pixel_format, 16);
|
||||||
|
} else
|
||||||
|
return iPixelFormat;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close the window
|
* Close the window
|
||||||
*/
|
*/
|
||||||
|
@ -677,6 +687,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_createContext(JNIEnv *env,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pixel_format_index = findPixelFormat(env, pixel_format);
|
pixel_format_index = findPixelFormat(env, pixel_format);
|
||||||
|
if (pixel_format_index == -1) {
|
||||||
|
extgl_Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Special option for allowing software opengl
|
// Special option for allowing software opengl
|
||||||
if (!applyPixelFormat(env, hdc, pixel_format_index)) {
|
if (!applyPixelFormat(env, hdc, pixel_format_index)) {
|
||||||
closeWindow();
|
closeWindow();
|
||||||
|
@ -705,6 +719,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_createContext(JNIEnv *env,
|
||||||
pixel_format_index = findPixelFormatARB(env, pixel_format, NULL, true, true, true);
|
pixel_format_index = findPixelFormatARB(env, pixel_format, NULL, true, true, true);
|
||||||
wglMakeCurrent(NULL, NULL);
|
wglMakeCurrent(NULL, NULL);
|
||||||
wglDeleteContext(hglrc);
|
wglDeleteContext(hglrc);
|
||||||
|
if (pixel_format_index == -1) {
|
||||||
|
extgl_Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
hglrc = wglCreateContext(hdc);
|
hglrc = wglCreateContext(hdc);
|
||||||
closeWindow();
|
closeWindow();
|
||||||
if (hglrc == NULL) {
|
if (hglrc == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue