fix for matrox parhelia, they wont accept NULL buffer, despite the specs saying it's legit. Bugfinding: Javazoid

This commit is contained in:
Brian Matzon 2005-07-20 07:30:26 +00:00
parent 943edb85b3
commit fe3b071f0f
1 changed files with 10 additions and 3 deletions

View File

@ -31,6 +31,9 @@
*/ */
package org.lwjgl.opengl; package org.lwjgl.opengl;
import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil; import org.lwjgl.LWJGLUtil;
import org.lwjgl.Sys; import org.lwjgl.Sys;
@ -190,9 +193,13 @@ public final class Pbuffer implements Drawable {
} }
private static PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture) throws LWJGLException { private static PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture) throws LWJGLException {
if ( renderTexture == null ) if ( renderTexture == null ) {
return Display.getImplementation().createPbuffer(width, height, pixel_format, null, null); // Though null is a perfectly valid argument, Matrox Parhelia drivers expect
else // a 0 terminated list, or else they crash. Supplying NULL or 0, should
// cause the drivers to use default settings
IntBuffer defaultAttribs = BufferUtils.createIntBuffer(1);
return Display.getImplementation().createPbuffer(width, height, pixel_format, null, defaultAttribs);
} else
return Display.getImplementation().createPbuffer(width, height, pixel_format, return Display.getImplementation().createPbuffer(width, height, pixel_format,
renderTexture.pixelFormatCaps, renderTexture.pixelFormatCaps,
renderTexture.pBufferAttribs); renderTexture.pBufferAttribs);