Windows implementation of floating point pixel formats
This commit is contained in:
parent
c1e65970a2
commit
9c4ce2845b
|
@ -271,7 +271,7 @@ bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int s
|
||||||
throwException(env, "Samples > 0 specified but there's no support for GLX_ARB_multisample");
|
throwException(env, "Samples > 0 specified but there's no support for GLX_ARB_multisample");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool floating_point = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
|
bool floating_point = (bool)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
|
||||||
if (floating_point && !extension_flags.GLX_ARB_fbconfig_float) {
|
if (floating_point && !extension_flags.GLX_ARB_fbconfig_float) {
|
||||||
throwException(env, "Floating point specified but there's no support for GLX_ARB_fbconfig_float");
|
throwException(env, "Floating point specified but there's no support for GLX_ARB_fbconfig_float");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -183,6 +183,8 @@ static int findPixelFormatARBFromBPP(JNIEnv *env, HDC hdc, WGLExtensions *extens
|
||||||
int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I"));
|
int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I"));
|
||||||
int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I"));
|
int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I"));
|
||||||
jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z"));
|
jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z"));
|
||||||
|
bool floating_point = (bool)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
|
||||||
|
int pixel_type = floating_point ? WGL_TYPE_RGBA_FLOAT_ARB : WGL_TYPE_RGBA_ARB;
|
||||||
int iPixelFormat;
|
int iPixelFormat;
|
||||||
unsigned int num_formats_returned;
|
unsigned int num_formats_returned;
|
||||||
attrib_list_t attrib_list;
|
attrib_list_t attrib_list;
|
||||||
|
@ -200,7 +202,7 @@ static int findPixelFormatARBFromBPP(JNIEnv *env, HDC hdc, WGLExtensions *extens
|
||||||
}
|
}
|
||||||
if (!getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"))
|
if (!getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"))
|
||||||
putAttrib(&attrib_list, WGL_ACCELERATION_ARB); putAttrib(&attrib_list, WGL_FULL_ACCELERATION_ARB);
|
putAttrib(&attrib_list, WGL_ACCELERATION_ARB); putAttrib(&attrib_list, WGL_FULL_ACCELERATION_ARB);
|
||||||
putAttrib(&attrib_list, WGL_PIXEL_TYPE_ARB); putAttrib(&attrib_list, WGL_TYPE_RGBA_ARB);
|
putAttrib(&attrib_list, WGL_PIXEL_TYPE_ARB); putAttrib(&attrib_list, pixel_type);
|
||||||
putAttrib(&attrib_list, WGL_DOUBLE_BUFFER_ARB); putAttrib(&attrib_list, double_buffer ? TRUE : FALSE);
|
putAttrib(&attrib_list, WGL_DOUBLE_BUFFER_ARB); putAttrib(&attrib_list, double_buffer ? TRUE : FALSE);
|
||||||
putAttrib(&attrib_list, WGL_SUPPORT_OPENGL_ARB); putAttrib(&attrib_list, TRUE);
|
putAttrib(&attrib_list, WGL_SUPPORT_OPENGL_ARB); putAttrib(&attrib_list, TRUE);
|
||||||
putAttrib(&attrib_list, WGL_COLOR_BITS_ARB); putAttrib(&attrib_list, bpp);
|
putAttrib(&attrib_list, WGL_COLOR_BITS_ARB); putAttrib(&attrib_list, bpp);
|
||||||
|
@ -358,6 +360,7 @@ int findPixelFormatOnDC(JNIEnv *env, HDC hdc, jobject pixel_format, jobject pixe
|
||||||
int pixel_format_id;
|
int pixel_format_id;
|
||||||
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
|
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
|
||||||
int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I"));
|
int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I"));
|
||||||
|
bool floating_point = (bool)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
|
||||||
bool use_arb_selection = samples > 0 || pbuffer || pixelFormatCaps != NULL;
|
bool use_arb_selection = samples > 0 || pbuffer || pixelFormatCaps != NULL;
|
||||||
pixel_format_id = findPixelFormatDefault(env, hdc, pixel_format, use_hdc_bpp, double_buffer);
|
pixel_format_id = findPixelFormatDefault(env, hdc, pixel_format, use_hdc_bpp, double_buffer);
|
||||||
if (use_arb_selection) {
|
if (use_arb_selection) {
|
||||||
|
@ -392,6 +395,12 @@ int findPixelFormatOnDC(JNIEnv *env, HDC hdc, jobject pixel_format, jobject pixe
|
||||||
throwException(env, "No support for WGL_ARB_multisample");
|
throwException(env, "No support for WGL_ARB_multisample");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (floating_point && !extensions.WGL_ARB_pixel_format_float) {
|
||||||
|
wglMakeCurrent(saved_current_hdc, saved_current_hglrc);
|
||||||
|
wglDeleteContext(dummy_hglrc);
|
||||||
|
throwException(env, "No support for WGL_ARB_pixel_format_float");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (pixelFormatCaps != NULL && !extensions.WGL_ARB_render_texture) {
|
if (pixelFormatCaps != NULL && !extensions.WGL_ARB_render_texture) {
|
||||||
wglMakeCurrent(saved_current_hdc, saved_current_hglrc);
|
wglMakeCurrent(saved_current_hdc, saved_current_hglrc);
|
||||||
wglDeleteContext(dummy_hglrc);
|
wglDeleteContext(dummy_hglrc);
|
||||||
|
|
|
@ -133,6 +133,7 @@ static void extgl_InitSupportedWGLExtensions(WGLExtensions *extensions) {
|
||||||
extensions->WGL_ARB_buffer_region = WGLQueryExtension(extensions, "WGL_ARB_buffer_region");
|
extensions->WGL_ARB_buffer_region = WGLQueryExtension(extensions, "WGL_ARB_buffer_region");
|
||||||
extensions->WGL_ARB_make_current_read = WGLQueryExtension(extensions, "WGL_ARB_make_current_read");
|
extensions->WGL_ARB_make_current_read = WGLQueryExtension(extensions, "WGL_ARB_make_current_read");
|
||||||
extensions->WGL_ARB_multisample = WGLQueryExtension(extensions, "WGL_ARB_multisample");
|
extensions->WGL_ARB_multisample = WGLQueryExtension(extensions, "WGL_ARB_multisample");
|
||||||
|
extensions->WGL_ARB_pixel_format_float = WGLQueryExtension(extensions, "WGL_ARB_pixel_format_float");
|
||||||
extensions->WGL_ARB_pbuffer = WGLQueryExtension(extensions, "WGL_ARB_pbuffer");
|
extensions->WGL_ARB_pbuffer = WGLQueryExtension(extensions, "WGL_ARB_pbuffer");
|
||||||
extensions->WGL_ARB_pixel_format = WGLQueryExtension(extensions, "WGL_ARB_pixel_format");
|
extensions->WGL_ARB_pixel_format = WGLQueryExtension(extensions, "WGL_ARB_pixel_format");
|
||||||
extensions->WGL_ARB_render_texture = WGLQueryExtension(extensions, "WGL_ARB_render_texture");
|
extensions->WGL_ARB_render_texture = WGLQueryExtension(extensions, "WGL_ARB_render_texture");
|
||||||
|
|
|
@ -160,6 +160,12 @@ typedef HDC (APIENTRY * wglGetCurrentReadDCARBPROC) (void);
|
||||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||||
#define WGL_SAMPLES_ARB 0x2042
|
#define WGL_SAMPLES_ARB 0x2042
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------*/
|
||||||
|
/*------------WGL_ARB_pixel_format_float ----------------------------*/
|
||||||
|
/*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool WGL_ARB_buffer_region;
|
bool WGL_ARB_buffer_region;
|
||||||
bool WGL_ARB_extensions_string;
|
bool WGL_ARB_extensions_string;
|
||||||
|
@ -172,6 +178,7 @@ typedef struct {
|
||||||
bool WGL_EXT_swap_control;
|
bool WGL_EXT_swap_control;
|
||||||
bool WGL_NV_render_depth_texture;
|
bool WGL_NV_render_depth_texture;
|
||||||
bool WGL_NV_render_texture_rectangle;
|
bool WGL_NV_render_texture_rectangle;
|
||||||
|
bool WGL_ARB_pixel_format_float;
|
||||||
wglGetExtensionsStringEXTPROC wglGetExtensionsStringEXT;
|
wglGetExtensionsStringEXTPROC wglGetExtensionsStringEXT;
|
||||||
|
|
||||||
wglGetExtensionsStringARBPROC wglGetExtensionsStringARB;
|
wglGetExtensionsStringARBPROC wglGetExtensionsStringARB;
|
||||||
|
|
Loading…
Reference in New Issue