Problem with GLJPanel

Hi,

I am new to JOGL. I tried to use GLJPanel and when I run the program, I encountered the following error message:

Exception in thread “main” net.java.games.jogl.GLException: Unable to set pixel format
at net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAndCreateContext(Windo
wsGLContext.java:493)
at net.java.games.jogl.impl.windows.WindowsOffscreenGLContext.create(WindowsOffscreenGLConte
xt.java:181)
at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLContext.java:135)
at net.java.games.jogl.impl.windows.WindowsOffscreenGLContext.makeCurrent(WindowsOffscreenGL
Context.java:128)
at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:254)
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.validate(Container.java:1067)
at java.awt.Window.show(Window.java:461)
at java.awt.Component.show(Component.java:1133)
at java.awt.Component.setVisible(Component.java:1088)
at RotatingPyramid.start(RotatingPyramid.java:55)
at RotatingPyramid.main(RotatingPyramid.java:62)

I am using JOGL ver 1.1.0-b04. My configuration is as follows:

GL_VENDOR: ATI Technologies Inc.
GL_RENDERER: Radeon 9200 DDR x86/SSE2
GL_VERSION: 1.3.3683 WinXP Release

Thanks.

Cheers,
-WK-

Please download beta 5 and see if the problem persists.

Hi,
i have noticed the same problem which also occures with beta 5.
I try to port a swing based application, which displays a lot of images, to jogl. My main class is inherited from JPanel, does implement GLEventListener and creates a GLJPanel. The GLJPanel is added to the main class after the GLEventListener (from the main class) is attached to it.
If i use a GLCanvas instead of a GLJPanel, jogl does initialize well. (But causes some other strange errors - i suppose because it’s not a that good idea to embed an awt component to a swing panel…) Anyway, here’s a little code snippet that demonstrates my JPanel/GLJPanel class. Please let me know if you see any mistakes.
Thanks in advance,
NOP NOP NOP…

class GlTest extends JPanel implements GLEventListener {
private GLJPanel glPanel;

public GlTextureComponent(int initTexId) {
    glPanel    = GLDrawableFactory.getFactory().createGLJPanel(new GLCapabilities());
    glPanel.addGLEventListener(this);
    this.add(glPanel);
}

public void init(GLDrawable glDrawable) {
    System.out.println("GLEventListener.init()");

    GL gl = glDrawable.getGL();
    gl.glDisable(GL.GL_DEPTH_TEST);     // Disables Depth Testing
    gl.glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
}

public void display(GLDrawable glDrawable) {
    System.out.println("GLEventListener.display()");

    GL gl = glDrawable.getGL();
    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
}

public void displayChanged(GLDrawable glDrawable, boolean modeChanged, boolean deviceChanged) {
    // do nothing
}

public void reshape(GLDrawable glDrawable, int x, int y, int width, int height) {
        System.out.println("reshape");
} 

public void paint(Graphics gr) {
    System.out.println("JPanel.Paint()");
}

}

Hello,

Try setting the capabilities to doublebuffer = false and then creating your GLJPanel. Seems to me I ran into the same problem and I think that fixes it(or something simular, one of the settings on the capabilities has to be changed).

,
steve

Thx a lot,
that fixed it.