Make Display, Pbuffer and AWTGLCanvas fail on null PixelFormats

This commit is contained in:
Elias Naur 2005-12-29 22:30:14 +00:00
parent a8aabe008e
commit 6ea1739399
3 changed files with 6 additions and 0 deletions

View File

@ -147,6 +147,8 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
*/ */
public AWTGLCanvas(GraphicsDevice device, PixelFormat pixel_format, Drawable drawable) throws LWJGLException { public AWTGLCanvas(GraphicsDevice device, PixelFormat pixel_format, Drawable drawable) throws LWJGLException {
super(implementation.findConfiguration(device, pixel_format)); super(implementation.findConfiguration(device, pixel_format));
if (pixel_format == null)
throw new NullPointerException("Pixel format must be non-null");
addHierarchyListener(this); addHierarchyListener(this);
this.drawable = drawable; this.drawable = drawable;
this.pixel_format = pixel_format; this.pixel_format = pixel_format;

View File

@ -646,6 +646,8 @@ public final class Display {
* @throws LWJGLException * @throws LWJGLException
*/ */
public static void create(PixelFormat pixel_format, Drawable shared_drawable) throws LWJGLException { public static void create(PixelFormat pixel_format, Drawable shared_drawable) throws LWJGLException {
if (pixel_format == null)
throw new NullPointerException("Pixel format must be non-null");
if (isCreated()) if (isCreated())
throw new IllegalStateException("Only one LWJGL context may be instantiated at any one time."); throw new IllegalStateException("Only one LWJGL context may be instantiated at any one time.");
if (pixel_format == null) if (pixel_format == null)

View File

@ -178,6 +178,8 @@ public final class Pbuffer implements Drawable {
* with the Display context (if created). * with the Display context (if created).
*/ */
public Pbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture, Drawable shared_drawable) throws LWJGLException { public Pbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture, Drawable shared_drawable) throws LWJGLException {
if (pixel_format == null)
throw new NullPointerException("Pixel format must be non-null");
this.width = width; this.width = width;
this.height = height; this.height = height;
this.peer_info = createPbuffer(width, height, pixel_format, renderTexture); this.peer_info = createPbuffer(width, height, pixel_format, renderTexture);