LWJGL Forum

Archive => Resolved Bugs/RFE => Topic started by: kulpa on August 24, 2011, 21:02:24

Title: [FIXED] Pbuffer throws NullPointerException when created before any context
Post by: kulpa on August 24, 2011, 21:02:24
Pbuffer p = new Pbuffer(2, 2, new PixelFormat(), null);
isn't working.


[LWJGL] Xrandr extension version 1.3
[LWJGL] Using Xrandr for display mode switching
[LWJGL] XF86VidMode extension version 2.2
[LWJGL] Initial mode: 1600 x 900 x 24 @60Hz
[LWJGL] Pixel format info: r = 0, g = 0, b = 0, a = 0, depth = 24, stencil = 0, sample buffers = 0, samples = 0
Exception in thread "main" java.lang.NullPointerException
at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:224)
at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:190)
at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:166)
at net.uraniumlane.opengl3.OGLCapabilities.read(OGLCapabilities.java:18)
at net.uraniumlane.opengl3.OGLCore.init(OGLCore.java:53)
at net.uraniumlane.opengl3.OGLCore.main(OGLCore.java:99)


I'm using it to get openGL capabilities, so Display.getDrawable() == null.
Therefore we get a NPE in this line:
Pbuffer.java
224 shared_context = ((DrawableLWJGL)Display.getDrawable()).getContext(); // May be null

cheers, kulpae

ps:
this javadoc comment has to be updated, because withDepth(int depth) is now called withDepthBits(int depth):
PixelBuffer.java
41  * <code>PixelFormat pf = new PixelFormat().withDepth(24).withSamples(4).withSRGB(true);</code>
Title: Re: Pbuffer throws NullPointerException when created before any context
Post by: spasi on August 24, 2011, 23:19:12
Thanks, fixed.