Impossible GLJPanel

I just copied Test.java and TestRenderer.java from “How to: Getting started with JOGL” and everything works fine.
Anyway when I change this line
GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(glCaps);

with this one:

GLJPanel canvas = GLDrawableFactory.getFactory().createGLJPanel(glCaps);

things stop working and I get this exception:

net.java.games.jogl.GLException: Unable to set pixel format

  at net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAndCreateContext(WindowsGLContext.java:286)

  at net.java.games.jogl.impl.windows.WindowsOffscreenGLContext.create(WindowsOffscreenGLContext.java:157)

  at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLContext.java:117)

  at net.java.games.jogl.impl.windows.WindowsOffscreenGLContext.makeCurrent(WindowsOffscreenGLContext.java:116)

  at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:162)

  at net.java.games.jogl.GLJPanel.reshape(GLJPanel.java:131)

  at java.awt.Component.setBounds(Component.java:1664)

  at java.awt.BorderLayout.layoutContainer(BorderLayout.java:691)

  at java.awt.Container.layout(Container.java:1020)

  at java.awt.Container.doLayout(Container.java:1010)

  at java.awt.Container.validateTree(Container.java:1092)

  at java.awt.Container.validateTree(Container.java:1099)

  at java.awt.Container.validateTree(Container.java:1099)

  at java.awt.Container.validateTree(Container.java:1099)

  at java.awt.Container.validate(Container.java:1067)

  at java.awt.Window.show(Window.java:461)

  at com.compleasy.as.lab.jogl.Test.main(Test.java:50)

If I delete these lines:

glCaps.setRedBits(8);
glCaps.setBlueBits(8);
glCaps.setGreenBits(8);
glCaps.setAlphaBits(8);

nothing changes.
Has anyone been able to use GLJPanel ?
I tryed all sort of things without any success.
Thanks,

Antonio

P.S.: I’m using a GeForce3 on w2k, jdk 1.4.2-b28

Gee, I had the same error for some time. Stuck to using a GLCanvas. But it is causing me problems in Linux (I think). I managed to get a BSOD in Windows Xp using the GLJPanel and adding it to a JFrame.

On one comp, it couldn’t create a offscreen buffer.
On the other comp, it just died, (BSOD).

Hello,

I get the same problem in WinXP with GeForce 440 Go…

I can only speak to the windows version but it does work with the latest september 5th release of jogl. Currently it only supports the microsoft software renderer.

I found the workaround for this problem already.

This does not work only if you have DoubleBuffered == true in GLCapabilities.

After setDoubleBuffered(false) everything started to work OK.

Maybe it makes sense to make this check directly inside WindowsGLContext.glCapabilities2PFD(…)

Yuri

It already checks to see if double buffering should be enabled but maybe we need to throw in a don’t care if we really don’t want it. Until then that is the correct workaround.

It sets WGL.PFD_DOUBLEBUFFER also for off-screen contexts, and this causes pbs.

BTW, for me now this is not so important as far as I have workaround…

Yuri

Yep, easy enough to fix, though probably not in WindowsGLContext since that function also needs to work with pbuffers which can be doublebuffered.

Anyway, I am wondering why not to override protected choosePixelFormatAndCreateContext(…) and put in WindowsOffscreenGLContext, WindowsOnscreenGLContext and WindowsPbufferGLContext whatever we need there. This may solve at least this point and may make code more clean…

Yuri

I tried that workaround in wurm mostly out of curiosity, and while I did get it to start, I got some weird errors about the GLJPanel not supporting multitexturing and such.

Seems broken.

What are the benefits of using a GLJPanel over a GLJCanvas anyway? =)

It is broken and it says so in the docs. Right now on windows GLJPanel only supports the microsoft software renderer which only supports opengl 1.1. I don’t think it even supports vertex arrays much less multitexturing. Once we are able to use pbuffers instead of dibs for rendering then you will get to use all the functions your icd supports. It is up to Ken but I don’t think choosepixelformat needs to be overridden when you can just change the capabilities member to singlebuffered prior to picking a pixel format. It would avoid a lot of code bloat with one line of code.

So what are the (potential) benefits?

About the only benfit is that you won’t have any problems integrating a jogl app into a all swing framework. Getting a glcanvas to play nice with tabbed panes and internal frames can be a bitch.

Aah, of course.