I can’t seem to figure out how to determine what my largest pbuffer size is. in c++, at least according to the documentation for both WGL_pbuffer and SGIX_pbuffer, there is a flag to say “create largest possible if this is too big”, after which one can query that buffer for its size. Is there a way to do something similar in jogl, or is there some function to call that can tell me the maximum size?
I cannot say, but you should define the unit of size that is of interest to you, # of addressable pixels or memory.
There could also be a lot of factors which could play a part::
- whether double buffering or not
- the # of red, green, blue, alpha, & depth bits
- maybe whether or not you are using a floating point pBuffer or not.
I think any program is just going to have ask for what it wants, and report back when there are problems.
I looked at that previous thread, and it helped, but thought it time to find out via code, so I wrote the following code:
` public void getPBufferSz(GL gl, GLCapabilities caps){
GLDrawableFactory factory = GLDrawableFactory.getFactory();
GLPbuffer tstBuffer;
// check width until it no longer works
int sz = 512;
boolean stillWorking = true;
int highVal = 0;
do{
try{
tstBuffer = factory.createGLPbuffer(caps, null, sz, 1, null);
stillWorking = tstBuffer != null;
if (stillWorking) tstBuffer.destroy();
}catch(Exception ex){
stillWorking = false;
}
if (stillWorking){
highVal = sz;
sz *= 2;
}
}while(stillWorking);
System.out.println("max width " + highVal);
// check height until it no longer works
sz = 512;
stillWorking = true;
highVal = 0;
do{
try{
tstBuffer = factory.createGLPbuffer(caps, null, 1, sz, null);
stillWorking = tstBuffer != null;
if (stillWorking) tstBuffer.destroy();
}catch(Exception ex){
stillWorking = false;
}
if (stillWorking){
highVal = sz;
sz *= 2;
}
}while(stillWorking);
System.out.println("max height " + highVal);
// check girth until it no longer works
sz = 512;
stillWorking = true;
do{
try{
tstBuffer = factory.createGLPbuffer(caps, null, sz, sz, null);
stillWorking = tstBuffer != null;
if (stillWorking) tstBuffer.destroy();
}catch(Exception ex){
stillWorking = false;
}
if (stillWorking){
highVal = sz;
sz *= 2;
}
}while(stillWorking);
System.out.println("max girth " + highVal);
}`
Now you have to already have a PBuffer, or Drawable to run this, but using Render GeForce 8800 GTX/PCI/SSE2, version 2.1.2 gets the following sysout:
max width 33554432
max height 8388608
max girth 4096
This suggests that on this renderer it not address bound. However, if one is copying to texture or pingpong-ing , the practical limit would be the lower of the max girth and GL_MAX_TEXTURE_SIZE.
FYI, the capabilities used were:
caps = new GLCapabilities(); caps.setDoubleBuffered(false); caps.setPbufferFloatingPointBuffers(true); caps.setRedBits(floatBits); caps.setGreenBits(floatBits); caps.setBlueBits(floatBits); caps.setAlphaBits(floatAlphaBits); caps.setDepthBits(floatDepthBits);
Any comments?
Sorry forgot this:
int floatBits = 32; int floatAlphaBits = 32; int floatDepthBits = 0;