Added GLX_ARB_multisample support to Pbuffers

This commit is contained in:
Elias Naur 2004-02-15 15:46:10 +00:00
parent 3122d0b1ba
commit 5c3e17c8a3
6 changed files with 21 additions and 10 deletions

View File

@ -81,9 +81,11 @@ public class Pbuffer {
* @param alpha Minimum bits per pixel in alpha buffer
* @param depth Minimum bits per pixel in depth buffer
* @param stencil Minimum bits per pixel in stencil buffer
* @param samples Minimum samples in multisample buffer (corresponds to GL_SAMPLES_ARB in GL_ARB_multisample spec).
Pass 0 to disable multisampling. This parameter is ignored if GL_ARB_multisample is not supported.
*/
public Pbuffer(int width, int height, int bpp, int alpha, int depth, int stencil) throws Exception {
handle = nCreate(width, height, bpp, alpha, depth, stencil);
public Pbuffer(int width, int height, int bpp, int alpha, int depth, int stencil, int samples) throws Exception {
handle = nCreate(width, height, bpp, alpha, depth, stencil, samples);
vbo_tracker = new VBOTracker();
}
@ -150,7 +152,8 @@ public class Pbuffer {
int bpp,
int alpha,
int depth,
int stencil) throws Exception;
int stencil,
int samples) throws Exception;
/**
* Destroys the Pbuffer. The buffer must not be current.

View File

@ -234,7 +234,7 @@ public class PbufferTest {
private void initPbuffer() {
try {
pbuffer = new Pbuffer(512, 512, mode.bpp, 0, 0, 0);
pbuffer = new Pbuffer(512, 512, mode.bpp, 0, 0, 0, 0);
pbuffer.makeCurrent();
initGLState(256, 256, 0.5f);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex_handle);

View File

@ -45,10 +45,10 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_getPbufferCaps
/*
* Class: org_lwjgl_opengl_Pbuffer
* Method: nCreate
* Signature: (IIIIII)I
* Signature: (IIIIIII)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate
(JNIEnv *, jclass, jint, jint, jint, jint, jint, jint);
(JNIEnv *, jclass, jint, jint, jint, jint, jint, jint, jint);
/*
* Class: org_lwjgl_opengl_Pbuffer

View File

@ -80,10 +80,10 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_getPbufferCaps
* Signature: (IIII)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate
(JNIEnv *env, jclass clazz, jint width, jint height, jint bpp, jint alpha, jint depth, jint stencil)
(JNIEnv *env, jclass clazz, jint width, jint height, jint bpp, jint alpha, jint depth, jint stencil, jint samples)
{
int bpe = convertToBPE(bpp);
const int attrib_list[] = {GLX_RENDER_TYPE, GLX_RGBA_BIT,
int attrib_list[] = {GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DOUBLEBUFFER, False,
GLX_RED_SIZE, bpe,
GLX_GREEN_SIZE, bpe,
@ -92,8 +92,16 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate
GLX_DEPTH_SIZE, depth,
GLX_STENCIL_SIZE, stencil,
GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
None, None, /* for ARB_multisample */
None, None, /* */
None};
int num_configs;
if (samples > 0 && extgl_Extensions.GLX_ARB_multisample) {
attrib_list[18] = GLX_SAMPLE_BUFFERS_ARB;
attrib_list[19] = 1;
attrib_list[20] = GLX_SAMPLES_ARB;
attrib_list[21] = samples;
}
GLXFBConfig *configs = glXChooseFBConfig(getCurrentDisplay(), getCurrentScreen(), attrib_list, &num_configs);
if (num_configs == 0) {
XFree(configs);

View File

@ -65,7 +65,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_getPbufferCaps(JNIEnv *env,
return 0;
}
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate(JNIEnv *env, jclass clazz, jint width, jint height, jint bpp, jint alpha, jint depth, jint stencil) {
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate(JNIEnv *env, jclass clazz, jint width, jint height, jint bpp, jint alpha, jint depth, jint stencil, jint samples) {
/* CGLPixelFormatObj pixel_format;
CGLContextObj context;
int dummy;

View File

@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_getPbufferCaps
* Signature: (IIII)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_nCreate
(JNIEnv *env, jclass clazz, jint width, jint height, jint bpp, jint alpha, jint depth, jint stencil)
(JNIEnv *env, jclass clazz, jint width, jint height, jint bpp, jint alpha, jint depth, jint stencil, jint samples)
{
int iPixelFormat;
unsigned int num_formats_returned;