Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (739)
Games in Android Showcase (224)
games submitted by our members
Games in WIP (820)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Why doesn't GLJPanel work? (Works now thanks!!!)  (Read 3177 times)
0 Members and 1 Guest are viewing this topic.
Offline dockode

Senior Newbie




Java games rock!


« Posted 2003-12-18 20:50:20 »

I get an exception when I create a GLJPanel, that it can not set the pixel format.

I mean it's not terribly important to have a GLJPanel, but I think if it was included in JOGL it should function.

I'm running Windows XP by the way, I don't know if that has anything to do with it.

Other posts on the topic in this forum are somewhat confusing to me.
Offline SteveJohnson

Senior Newbie




Java games rock!


« Reply #1 - Posted 2003-12-18 22:49:40 »

Hello,

 When creating the GLJPanel turn double buffering off. call setDoubleBuffered(false) on the GLCapabilities object you use to create the GLJPanel. That seemed to clear up any problems for me.

,
steve
Offline dockode

Senior Newbie




Java games rock!


« Reply #2 - Posted 2003-12-19 20:57:09 »

Thanks very much.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline dockode

Senior Newbie




Java games rock!


« Reply #3 - Posted 2003-12-19 23:31:26 »

I tried what you said and I continue to get the same error!

Again, it's not of any importance to me if I don't get it working, althought I'd like to try.  Perhaps I am not doing it correctly.  If you would be so kind as to assist me with some example code on how to get a working GLJPanel up and running I'd be greatfull. Cheesy

Thanks again!
Offline GKW

Senior Devvie




Revenge is mine!


« Reply #4 - Posted 2003-12-19 23:46:37 »

Can you be a little more specific about what OS you are using and what rgba/doublebuffer ect you are requesting?
Offline dockode

Senior Newbie




Java games rock!


« Reply #5 - Posted 2003-12-20 16:12:18 »

I stated that I was running Windows XP on my computers, I have both Home and Pro versions.  As far as requesting anything, I would like to get a GLJPanel working.  I get an exception when I add the GLJPanel to a JPanel or a JFrame that says it could not set the pixel format.

All I would really like is a little code showing me how to set up the GLJPanel without getting that error.
Offline GKW

Senior Devvie




Revenge is mine!


« Reply #6 - Posted 2003-12-20 17:48:34 »

Post your code.  You are probably trying to request a surface that the software renderer does not support.  The ms opengl implementation is rather restrictive since it is incredibly old software.
Offline dockode

Senior Newbie




Java games rock!


« Reply #7 - Posted 2003-12-20 18:58:49 »

What I was doing was creating a program using the GLCanvas and thought, "gee... I wonder what that GLJPanel does different?"  So I simply removed the code to create the GLCanvas and put code to create a GLJPanel with the same variable name as the GLCanvas had before.

Because my code is rather large as it is right now,  I'd rather not post it.

I imagine it would be much easier to use one of Nehe's early tutorials to explain how to replace the GLCanvas with a GLJPanel.  Smaller code == less confusing.

If you would be so kind as to do that or something similar I would be very greatful.  Thankyou.
Offline SteveJohnson

Senior Newbie




Java games rock!


« Reply #8 - Posted 2003-12-20 21:28:03 »

Hello Again,

Try the following out, I just hacked it together for an example but seems to work. Try commenting out the setDoubleBuffered method in createGLJPanel and it won't work anymore.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
/*
 * Created on Dec 20, 2003
 *
 */

 
import net.java.games.jogl.*;

import javax.swing.*;
import java.awt.*;

/**
 * @author Stephen Johnson
 *
 *
 */

public class CsGLJPanelTesting extends JFrame implements GLEventListener
{
     
      public CsGLJPanelTesting()
      {
            super("CsGLJPanelTesting");
            String strSelection = getSelection();
            if(strSelection.equals("GLCanvas"))
                  createGLCanvas();
            else
                  createGLJPanel();
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.setSize(500,500);
            this.setVisible(true);
      }
     
      private String getSelection()
      {
            Object selection;
            String glpanels[] = {"GLCanvas","GLJPanel"};
            selection = JOptionPane.showInputDialog(this,
                                                                        "",
                                                                        "GL Panel Selection",
                                                                        JOptionPane.QUESTION_MESSAGE,
                                                                        null,
                                                                        glpanels,
                                                                        glpanels[0]
                                                                        );
            return (String) selection;
      }
     
      private void createGLJPanel()
      {
            GLCapabilities c = new GLCapabilities();
            c.setDoubleBuffered(false);
            GLJPanel panel = GLDrawableFactory.getFactory().createGLJPanel(c);
            panel.addGLEventListener(this);
            this.getContentPane().setLayout(new GridLayout(1,1));
            this.getContentPane().add(panel);
      }
     
      private void createGLCanvas()
      {
            GLCapabilities c = new GLCapabilities();
            GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(c);
            canvas.addGLEventListener(this);
            this.getContentPane().setLayout(new GridLayout(1,1));
            this.getContentPane().add(canvas);
      }
     
      public static void main(String argsv[])
      {
            CsGLJPanelTesting p = new CsGLJPanelTesting();
      }

      /* (non-Javadoc)
       * @see net.java.games.jogl.GLEventListener#init(net.java.games.jogl.GLDrawable)
       */

      public void init(GLDrawable glDrawable)
      {
            GL gl = glDrawable.getGL();
            gl.glClearColor(0.0f,0.0f,0.0f,0.0f);
            gl.glColor3d(1.0,1.0,1.0);      
           
      }

      /* (non-Javadoc)
       * @see net.java.games.jogl.GLEventListener#display(net.java.games.jogl.GLDrawable)
       */

      public void display(GLDrawable glDrawable)
      {
            GL gl = glDrawable.getGL();
            gl.glClear(GL.GL_COLOR_BUFFER_BIT);
            gl.glLoadIdentity();
            gl.glTranslated(0.0,0.0,-2.0);
            gl.glBegin(GL.GL_TRIANGLES);
                  gl.glVertex3d(0.0,0.0,0.0);
                  gl.glVertex3d(0.0,0.5,0.0);
                  gl.glVertex3d(0.5,0.0,0.0);
            gl.glEnd();
      }

      public void reshape(GLDrawable glDrawable, int x, int y, int width, int height)
      {
            GL gl = glDrawable.getGL();
            GLU glu = glDrawable.getGLU();
            gl.glViewport(x,y,width,height);
            gl.glMatrixMode(GL.GL_PROJECTION);
            gl.glLoadIdentity();
            glu.gluPerspective(65.0,width/height,1.0,20.0);
            gl.glMatrixMode(GL.GL_MODELVIEW);
      }

      /* (non-Javadoc)
       * @see net.java.games.jogl.GLEventListener#displayChanged(net.java.games.jogl.GLDrawable, boolean, boolean)
       */

      public void displayChanged(GLDrawable glDrawable, boolean arg1, boolean arg2) {
            // TODO Auto-generated method stub
           
      }

}


,
steve
Offline dockode

Senior Newbie




Java games rock!


« Reply #9 - Posted 2003-12-20 21:46:03 »

Thank You Steve.  Your code works for me.  I'll have to tinker around with GLJPanel to see what it can do ( performance wise Cheesy ).

Also thanks to GKW for your help.

Cheesy  Cheesy  Cheesy
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline lamster

Senior Newbie





« Reply #10 - Posted 2003-12-21 05:20:45 »

GKW:
A while back you posted an implementation of GLJPanel that uses pbuffers instead of the MS software renderer.  This looks great to me: I'd like to use your GLJPanel in a project I'm working on, however, when I try to use the 'jogl.jar' on your http://www.geocities.com/groundskeeperwiley/ page I get some exceptions during startup that do not occur with the latest official release jogl.jar:

[size=1]
net.java.games.jogl.GLException: pbuffer creation error: wglChoosePixelFormatARB
() failed
       at net.java.games.jogl.impl.windows.WindowsPbufferGLContext.createPbuffe
r(WindowsPbufferGLContext.java:221)
       at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent
(WindowsOnscreenGLContext.java:118)
       at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:230)
       at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:196)
       at net.java.games.jogl.GLCanvas.display(GLCanvas.java:88)
       at net.java.games.jogl.impl.windows.WindowsGLContextFactory.createGLCont
ext(WindowsGLContextFactory.java:94)
       at net.java.games.jogl.GLJPanel.reshape(GLJPanel.java:159)
       at java.awt.Component.setBounds(Unknown Source)
       at java.awt.Component.resize(Unknown Source)
       at java.awt.Component.setSize(Unknown Source)
       at java.awt.Component.resize(Unknown Source)
       at java.awt.Component.setSize(Unknown Source)
       at javax.swing.JViewport.setViewSize(Unknown Source)
       at javax.swing.ViewportLayout.layoutContainer(Unknown Source)
       at java.awt.Container.layout(Unknown Source)
       at java.awt.Container.doLayout(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validate(Unknown Source)
       at java.awt.Window.show(Unknown Source)
       at java.awt.Component.show(Unknown Source)
       at java.awt.Component.setVisible(Unknown Source)
       at LevelEdit.LevelEdit.init(LevelEdit.java:246)
       at LevelEdit.LevelEdit.<init>(LevelEdit.java:210)
       at LevelEdit.LevelEdit$LevelEditManager.newEditor(LevelEdit.java:202)
       at LevelEdit.LevelEdit.main(LevelEdit.java:186)
Cannot Create Pbuffer
Exception in thread "main" net.java.games.jogl.GLException: Unable to set pixel
format
       at net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAn
dCreateContext(WindowsGLContext.java:303)
       at net.java.games.jogl.impl.windows.WindowsOffscreenGLContext.create(Win
dowsOffscreenGLContext.java:164)
       at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(Windows
GLContext.java:120)
       at net.java.games.jogl.impl.windows.WindowsOffscreenGLContext.makeCurren
t(WindowsOffscreenGLContext.java:120)
       at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:230)
       at net.java.games.jogl.GLJPanel.reshape(GLJPanel.java:170)
       at java.awt.Component.setBounds(Unknown Source)
       at java.awt.Component.resize(Unknown Source)
       at java.awt.Component.setSize(Unknown Source)
       at java.awt.Component.resize(Unknown Source)
       at java.awt.Component.setSize(Unknown Source)
       at javax.swing.JViewport.setViewSize(Unknown Source)
       at javax.swing.ViewportLayout.layoutContainer(Unknown Source)
       at java.awt.Container.layout(Unknown Source)
       at java.awt.Container.doLayout(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validateTree(Unknown Source)
       at java.awt.Container.validate(Unknown Source)
       at java.awt.Window.show(Unknown Source)
       at java.awt.Component.show(Unknown Source)
       at java.awt.Component.setVisible(Unknown Source)
       at LevelEdit.LevelEdit.init(LevelEdit.java:246)
       at LevelEdit.LevelEdit.<init>(LevelEdit.java:210)
       at LevelEdit.LevelEdit$LevelEditManager.newEditor(LevelEdit.java:202)
       at LevelEdit.LevelEdit.main(LevelEdit.java:186)
[/size]

Any idea what I'm doing wrong?  I swapped out the latest release jogl.jar for your jogl.jar, kept the release dll, and am running on WindowsXP with an ATI card; am I missing a necessary extension?

Thanks for your GLJPanel work and any info on general restrictions or debugging advice you can provide,
lamster
Offline GKW

Senior Devvie




Revenge is mine!


« Reply #11 - Posted 2003-12-22 01:50:02 »

Post your code that is related to creating the gljpanel or the glcapabilities you use.  Also exactly what model of ati card do you have?  I have only tested my code on nvidia cards so I have no idea if they work elsewhere.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 
Ecumene (48 views)
2017-09-30 02:57:34

theagentd (72 views)
2017-09-26 18:23:31

cybrmynd (182 views)
2017-08-02 12:28:51

cybrmynd (180 views)
2017-08-02 12:19:43

cybrmynd (187 views)
2017-08-02 12:18:09

Sralse (193 views)
2017-07-25 17:13:48

Archive (744 views)
2017-04-27 17:45:51

buddyBro (876 views)
2017-04-05 03:38:00

CopyableCougar4 (1423 views)
2017-03-24 15:39:42

theagentd (1316 views)
2017-03-24 15:32:08
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!