2005-02-20 06:24:22 -05:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2002-2004 LWJGL Project
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* * Neither the name of 'LWJGL' nor the names of
|
|
|
|
* its contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
|
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Include file to access public window features
|
|
|
|
*
|
|
|
|
* @author elias_naur <elias_naur@users.sourceforge.net>
|
|
|
|
* @version $Revision$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
#include "extgl_glx.h"
|
|
|
|
#include "context.h"
|
|
|
|
|
|
|
|
XVisualInfo *getVisualInfoFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info) {
|
|
|
|
XVisualInfo *vis_info;
|
|
|
|
if (!peer_info->glx13) {
|
|
|
|
XVisualInfo template;
|
|
|
|
template.visualid = peer_info->config.glx_config.visualid;
|
|
|
|
template.depth = peer_info->config.glx_config.depth;
|
|
|
|
template.screen = peer_info->screen;
|
|
|
|
int num_infos;
|
|
|
|
vis_info = XGetVisualInfo(peer_info->display, VisualIDMask | VisualScreenMask | VisualDepthMask, &template, &num_infos);
|
|
|
|
if (vis_info == NULL) {
|
|
|
|
throwException(env, "Could not find VisualInfo from peer info");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// Check the assumption from GLX 1.3 docs that a VisualInfo is uniquely identified by its
|
|
|
|
// {VisualID, screen, depth} tuple
|
|
|
|
if (num_infos != 1) {
|
|
|
|
XFree(vis_info);
|
|
|
|
throwException(env, "No unique VisualInfo matches peer info");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
GLXFBConfig *configs = getFBConfigFromPeerInfo(env, peer_info);
|
|
|
|
if (configs == NULL)
|
|
|
|
return NULL;
|
2005-11-20 08:19:39 -05:00
|
|
|
vis_info = lwjgl_glXGetVisualFromFBConfig(peer_info->display, configs[0]);
|
2005-02-20 06:24:22 -05:00
|
|
|
if (vis_info == NULL)
|
|
|
|
throwException(env, "Could not get VisualInfo from GLX 1.3 config");
|
|
|
|
XFree(configs);
|
|
|
|
}
|
|
|
|
return vis_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
GLXFBConfig *getFBConfigFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info) {
|
2005-02-21 10:35:09 -05:00
|
|
|
int attribs[] = {GLX_FBCONFIG_ID, peer_info->config.glx13_config.config_id, None, None};
|
2005-02-20 06:24:22 -05:00
|
|
|
int num_elements;
|
2005-11-20 08:19:39 -05:00
|
|
|
GLXFBConfig *configs = lwjgl_glXChooseFBConfig(peer_info->display, peer_info->screen, attribs, &num_elements);
|
2005-02-20 06:24:22 -05:00
|
|
|
if (configs == NULL) {
|
|
|
|
throwException(env, "Could not find GLX 1.3 config from peer info");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// Check that only one FBConfig matches the config id
|
|
|
|
if (num_elements != 1) {
|
|
|
|
XFree(configs);
|
|
|
|
throwException(env, "No unique GLX 1.3 config matches peer info");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return configs;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int convertToBPE(int bpp) {
|
|
|
|
int bpe;
|
|
|
|
switch (bpp) {
|
2006-05-13 06:03:19 -04:00
|
|
|
case 0:
|
|
|
|
bpe = 0;
|
|
|
|
break;
|
2005-02-20 06:24:22 -05:00
|
|
|
case 32:
|
|
|
|
case 24:
|
|
|
|
bpe = 8;
|
|
|
|
break;
|
|
|
|
case 16: /* Fall through */
|
|
|
|
default:
|
|
|
|
bpe = 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return bpe;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GLXFBConfig *chooseVisualGLX13FromBPP(JNIEnv *env, Display *disp, int screen, jobject pixel_format, int bpp, int drawable_type, bool double_buffer) {
|
|
|
|
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
|
|
|
|
int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I"));
|
|
|
|
int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I"));
|
|
|
|
int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I"));
|
|
|
|
int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I"));
|
|
|
|
int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "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"));
|
|
|
|
bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z"));
|
2006-06-12 09:01:05 -04:00
|
|
|
bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
|
2005-02-20 06:24:22 -05:00
|
|
|
|
|
|
|
int bpe = convertToBPE(bpp);
|
|
|
|
int accum_bpe = convertToBPE(accum_bpp);
|
|
|
|
attrib_list_t attrib_list;
|
|
|
|
initAttribList(&attrib_list);
|
2006-06-12 09:01:05 -04:00
|
|
|
int render_type = floating_point ? GLX_RGBA_FLOAT_BIT : GLX_RGBA_BIT;
|
|
|
|
putAttrib(&attrib_list, GLX_RENDER_TYPE); putAttrib(&attrib_list, render_type);
|
2005-02-20 06:24:22 -05:00
|
|
|
putAttrib(&attrib_list, GLX_DOUBLEBUFFER); putAttrib(&attrib_list, double_buffer ? True : False);
|
|
|
|
putAttrib(&attrib_list, GLX_DRAWABLE_TYPE); putAttrib(&attrib_list, drawable_type);
|
|
|
|
putAttrib(&attrib_list, GLX_DEPTH_SIZE); putAttrib(&attrib_list, depth);
|
|
|
|
putAttrib(&attrib_list, GLX_RED_SIZE); putAttrib(&attrib_list, bpe);
|
|
|
|
putAttrib(&attrib_list, GLX_GREEN_SIZE); putAttrib(&attrib_list, bpe);
|
|
|
|
putAttrib(&attrib_list, GLX_BLUE_SIZE); putAttrib(&attrib_list, bpe);
|
|
|
|
putAttrib(&attrib_list, GLX_ALPHA_SIZE); putAttrib(&attrib_list, alpha);
|
|
|
|
putAttrib(&attrib_list, GLX_STENCIL_SIZE); putAttrib(&attrib_list, stencil);
|
|
|
|
putAttrib(&attrib_list, GLX_AUX_BUFFERS); putAttrib(&attrib_list, num_aux_buffers);
|
|
|
|
putAttrib(&attrib_list, GLX_ACCUM_RED_SIZE); putAttrib(&attrib_list, accum_bpe);
|
|
|
|
putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe);
|
|
|
|
putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe);
|
|
|
|
putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha);
|
2006-05-15 15:37:29 -04:00
|
|
|
if (stereo) {
|
|
|
|
putAttrib(&attrib_list, GLX_STEREO); putAttrib(&attrib_list, True);
|
|
|
|
}
|
2005-02-24 05:44:34 -05:00
|
|
|
// Assume the caller has checked support for multisample
|
|
|
|
if (samples > 0) {
|
2005-02-20 06:24:22 -05:00
|
|
|
putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1);
|
|
|
|
putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples);
|
|
|
|
}
|
|
|
|
putAttrib(&attrib_list, None); putAttrib(&attrib_list, None);
|
|
|
|
int num_formats = 0;
|
2005-11-20 08:19:39 -05:00
|
|
|
GLXFBConfig* configs = lwjgl_glXChooseFBConfig(disp, screen, attrib_list.attribs, &num_formats);
|
2005-02-20 06:24:22 -05:00
|
|
|
if (num_formats > 0) {
|
|
|
|
return configs;
|
|
|
|
} else {
|
|
|
|
if (configs != NULL)
|
|
|
|
XFree(configs);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GLXFBConfig *chooseVisualGLX13(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffer) {
|
|
|
|
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
|
|
|
|
int bpp;
|
|
|
|
if (use_display_bpp) {
|
|
|
|
bpp = XDefaultDepthOfScreen(XScreenOfDisplay(disp, screen));
|
|
|
|
GLXFBConfig *configs = chooseVisualGLX13FromBPP(env, disp, screen, pixel_format, bpp, drawable_type, double_buffer);
|
|
|
|
if (configs != NULL)
|
|
|
|
return configs;
|
|
|
|
else
|
|
|
|
bpp = 16;
|
|
|
|
} else
|
|
|
|
bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I"));
|
|
|
|
return chooseVisualGLX13FromBPP(env, disp, screen, pixel_format, bpp, drawable_type, double_buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static XVisualInfo *chooseVisualGLXFromBPP(JNIEnv *env, Display *disp, int screen, jobject pixel_format, int bpp, bool double_buffer) {
|
|
|
|
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
|
|
|
|
int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I"));
|
|
|
|
int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I"));
|
|
|
|
int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I"));
|
|
|
|
int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I"));
|
|
|
|
int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "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"));
|
|
|
|
bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z"));
|
|
|
|
|
|
|
|
int bpe = convertToBPE(bpp);
|
|
|
|
int accum_bpe = convertToBPE(accum_bpp);
|
|
|
|
attrib_list_t attrib_list;
|
|
|
|
initAttribList(&attrib_list);
|
|
|
|
putAttrib(&attrib_list, GLX_RGBA);
|
|
|
|
putAttrib(&attrib_list, GLX_DOUBLEBUFFER);
|
|
|
|
putAttrib(&attrib_list, GLX_DEPTH_SIZE); putAttrib(&attrib_list, depth);
|
|
|
|
putAttrib(&attrib_list, GLX_RED_SIZE); putAttrib(&attrib_list, bpe);
|
|
|
|
putAttrib(&attrib_list, GLX_GREEN_SIZE); putAttrib(&attrib_list, bpe);
|
|
|
|
putAttrib(&attrib_list, GLX_BLUE_SIZE); putAttrib(&attrib_list, bpe);
|
|
|
|
putAttrib(&attrib_list, GLX_ALPHA_SIZE); putAttrib(&attrib_list, alpha);
|
|
|
|
putAttrib(&attrib_list, GLX_STENCIL_SIZE); putAttrib(&attrib_list, stencil);
|
|
|
|
putAttrib(&attrib_list, GLX_AUX_BUFFERS); putAttrib(&attrib_list, num_aux_buffers);
|
|
|
|
putAttrib(&attrib_list, GLX_ACCUM_RED_SIZE); putAttrib(&attrib_list, accum_bpe);
|
|
|
|
putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe);
|
|
|
|
putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe);
|
|
|
|
putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha);
|
|
|
|
if (stereo)
|
|
|
|
putAttrib(&attrib_list, GLX_STEREO);
|
2005-02-24 05:44:34 -05:00
|
|
|
// Assume the caller has checked support for multisample
|
|
|
|
if (samples > 0) {
|
2005-02-20 06:24:22 -05:00
|
|
|
putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1);
|
|
|
|
putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples);
|
|
|
|
}
|
|
|
|
putAttrib(&attrib_list, None);
|
2005-11-20 08:19:39 -05:00
|
|
|
return lwjgl_glXChooseVisual(disp, screen, attrib_list.attribs);
|
2005-02-20 06:24:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
XVisualInfo *chooseVisualGLX(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, bool double_buffer) {
|
|
|
|
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);
|
|
|
|
int bpp;
|
|
|
|
if (use_display_bpp) {
|
|
|
|
bpp = XDefaultDepthOfScreen(XScreenOfDisplay(disp, screen));
|
|
|
|
XVisualInfo *vis_info = chooseVisualGLXFromBPP(env, disp, screen, pixel_format, bpp, double_buffer);
|
|
|
|
if (vis_info != NULL)
|
|
|
|
return vis_info;
|
|
|
|
else
|
|
|
|
bpp = 16;
|
|
|
|
} else
|
|
|
|
bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I"));
|
|
|
|
return chooseVisualGLXFromBPP(env, disp, screen, pixel_format, bpp, double_buffer);
|
|
|
|
}
|
|
|
|
|
2005-02-24 05:44:34 -05:00
|
|
|
static void dumpVisualInfo(JNIEnv *env, Display *display, GLXExtensions *extension_flags, XVisualInfo *vis_info) {
|
2005-02-20 06:24:22 -05:00
|
|
|
int alpha, depth, stencil, r, g, b;
|
|
|
|
int sample_buffers = 0;
|
|
|
|
int samples = 0;
|
2005-11-20 08:19:39 -05:00
|
|
|
lwjgl_glXGetConfig(display, vis_info, GLX_RED_SIZE, &r);
|
|
|
|
lwjgl_glXGetConfig(display, vis_info, GLX_GREEN_SIZE, &g);
|
|
|
|
lwjgl_glXGetConfig(display, vis_info, GLX_BLUE_SIZE, &b);
|
|
|
|
lwjgl_glXGetConfig(display, vis_info, GLX_ALPHA_SIZE, &alpha);
|
|
|
|
lwjgl_glXGetConfig(display, vis_info, GLX_DEPTH_SIZE, &depth);
|
|
|
|
lwjgl_glXGetConfig(display, vis_info, GLX_STENCIL_SIZE, &stencil);
|
2005-02-24 05:44:34 -05:00
|
|
|
if (extension_flags->GLX_ARB_multisample) {
|
2005-11-20 08:19:39 -05:00
|
|
|
lwjgl_glXGetConfig(display, vis_info, GLX_SAMPLE_BUFFERS_ARB, &sample_buffers);
|
|
|
|
lwjgl_glXGetConfig(display, vis_info, GLX_SAMPLES_ARB, &samples);
|
2005-02-20 06:24:22 -05:00
|
|
|
}
|
|
|
|
printfDebugJava(env, "Pixel format info: r = %d, g = %d, b = %d, a = %d, depth = %d, stencil = %d, sample buffers = %d, samples = %d", r, g, b, alpha, depth, stencil, sample_buffers, samples);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffered, bool force_glx13) {
|
|
|
|
if ((*env)->GetDirectBufferCapacity(env, peer_info_handle) < sizeof(X11PeerInfo)) {
|
|
|
|
throwException(env, "Handle too small");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle);
|
2005-02-24 05:44:34 -05:00
|
|
|
GLXExtensions extension_flags;
|
|
|
|
if (!extgl_InitGLX(display, screen, &extension_flags)) {
|
2005-02-20 06:24:22 -05:00
|
|
|
throwException(env, "Could not init GLX");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!extension_flags.GLX13 && force_glx13) {
|
|
|
|
throwException(env, "GLX13 is required, but is not available");
|
|
|
|
return false;
|
|
|
|
}
|
2005-02-24 05:44:34 -05:00
|
|
|
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"));
|
|
|
|
if (samples > 0 && !extension_flags.GLX_ARB_multisample) {
|
|
|
|
throwException(env, "Samples > 0 specified but there's no support for GLX_ARB_multisample");
|
|
|
|
return false;
|
|
|
|
}
|
2006-07-10 11:29:29 -04:00
|
|
|
bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z"));
|
2006-06-12 09:01:05 -04:00
|
|
|
if (floating_point && !extension_flags.GLX_ARB_fbconfig_float) {
|
|
|
|
throwException(env, "Floating point specified but there's no support for GLX_ARB_fbconfig_float");
|
|
|
|
return false;
|
|
|
|
}
|
2005-02-20 06:24:22 -05:00
|
|
|
peer_info->glx13 = extension_flags.GLX13;
|
|
|
|
if (peer_info->glx13) {
|
|
|
|
GLXFBConfig *configs = chooseVisualGLX13(env, display, screen, pixel_format, use_display_bpp, drawable_type, double_buffered);
|
2005-03-28 05:29:16 -05:00
|
|
|
if (configs == NULL) {
|
|
|
|
throwException(env, "Could not choose GLX13 config");
|
|
|
|
return false;
|
|
|
|
}
|
2005-02-20 06:24:22 -05:00
|
|
|
if (isDebugEnabled()) {
|
2005-11-20 08:19:39 -05:00
|
|
|
XVisualInfo *vis_info = lwjgl_glXGetVisualFromFBConfig(display, configs[0]);
|
2005-02-20 06:24:22 -05:00
|
|
|
if (vis_info != NULL) {
|
2005-02-24 05:44:34 -05:00
|
|
|
dumpVisualInfo(env, display, &extension_flags, vis_info);
|
2005-02-20 06:24:22 -05:00
|
|
|
XFree(vis_info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int config_id;
|
2005-11-20 08:19:39 -05:00
|
|
|
int result = lwjgl_glXGetFBConfigAttrib(display, configs[0], GLX_FBCONFIG_ID, &config_id);
|
2005-02-20 06:24:22 -05:00
|
|
|
XFree(configs);
|
|
|
|
if (result != Success) {
|
2005-03-28 05:29:16 -05:00
|
|
|
throwException(env, "Could not get GLX_FBCONFIG_ID from GLXFBConfig");
|
2005-02-20 06:24:22 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
peer_info->config.glx13_config.config_id = config_id;
|
|
|
|
} else {
|
|
|
|
XVisualInfo *vis_info = chooseVisualGLX(env, display, screen, pixel_format, use_display_bpp, double_buffered);
|
|
|
|
if (vis_info == NULL) {
|
|
|
|
throwException(env, "Could not choose visual");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
peer_info->config.glx_config.visualid = vis_info->visualid;
|
|
|
|
peer_info->config.glx_config.depth = vis_info->depth;
|
|
|
|
peer_info->screen = vis_info->screen;
|
|
|
|
if (isDebugEnabled())
|
2005-02-24 05:44:34 -05:00
|
|
|
dumpVisualInfo(env, display, &extension_flags, vis_info);
|
2005-02-20 06:24:22 -05:00
|
|
|
XFree(vis_info);
|
|
|
|
}
|
|
|
|
peer_info->display = display;
|
|
|
|
peer_info->screen = screen;
|
|
|
|
peer_info->drawable = None;
|
|
|
|
return true;
|
|
|
|
}
|