Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (108)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java 3D / Re: Some noobish GL4Java questions on: 2002-12-28 23:20:31
Quote
But I have no idea get the sample Applets turned into applications which maybe also should run in fullscreen.

I had the same problem some days ago..
Here's my solution (without fullscreen)
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  
// create a panel which supports OpenGL (true for double buffering)
GLJPanel thePanel = new GLJPanel(true);
JFrame theFrame = new JFrame();

// insert frame init code like setting size etc.

// put the openGL panel into the frame
theFrame.getContentPane().add(thePanel);
            theFrame.setVisible(true);

// add an opengl listener
thePanel.addGLEventListener( new GLEventListener() {
      /** @see gl4java.drawable.GLEventListener#init(GLDrawable) */
      public void init(GLDrawable arg0) {
      }

      /** @see gl4java.drawable.GLEventListener#preDisplay(GLDrawable) */
      public void preDisplay(GLDrawable in_Draw) {
            in_Draw.getGL().glMatrixMode(GLEnum.GL_PROJECTION_MATRIX);
            in_Draw.getGL().glLoadIdentity();
                                   
            in_Draw.getGLU().gluPerspective(45.0f,
                  (float)in_Draw.getSize().width /
                  (float)in_Draw.getSize().height,
                  0.1f, 100.0f);
      }

      /** @see 4java.drawable.GLEventListener#display(GLDrawable) */
      public void display(GLDrawable arg0) {
            arg0.getGL().glClearColor(0, 0, 0, 0);
            arg0.getGL().glClear(GL_COLOR_BUFFER_BIT);
            // insert your display code here
     }

      /** @see gl4java.drawable.GLEventListener#postDisplay(GLDrawable) */
      public void postDisplay(GLDrawable arg0) {
      }

      /** @see gl4java.drawable.GLEventListener#cleanup(GLDrawable) */
      public void cleanup(GLDrawable arg0) {
      }

      /**@see gl4java.drawable.GLEventListener#reshape(GLDrawable, int, int) */
      public void reshape(GLDrawable arg0, int arg1, int arg2) {
      }
});      

// call this to invoke the paint function
thePanel.paint(theFrame.getContentPane().getGraphics());

This method may be far from optimal (especially placing the matrice setting code in the preDisplay might be nonsense) but at least it works. Smiley

btw: there isn't any new GLEventAdapter class like these for WindowAdapter etc., is there?
2  Java Game APIs & Engines / Java 3D / Re: Problem with Java3D in standalone application on: 2002-11-24 14:10:39
*doh*
well, thank you Smiley
3  Java Game APIs & Engines / Java 3D / Problem with Java3D in standalone application on: 2002-11-24 11:26:08
Hello,

after reading parts of the Java3D Tutorial and testing the example applet I tried to turn the whole thing into a standalone application. I dont really like the way it was suggested in the tutorial using a class which executes my applet class as an application so I simply want to make an application which uses Java3d. My problem is that with unmodified code from the example (apart from removing applet code and adding application code) nothing shows up inside my window, it just stays gray.
Basically this is my code:
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  
public class CApplication3d {
      public static void main(String[] args) {
            CApplication3d app3d = new CApplication3d();
      }
     
      Canvas3D m_Canvas3d;
      JFrame m_Frame;
           
      private CApplication3d() {
            m_Frame = new JFrame("A window");
           
            m_Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            m_Frame.pack();
            m_Frame.setSize(400, 300);
            m_Frame.setResizable(false);
            m_Frame.setVisible(true);

            GraphicsConfiguration gConfig = SimpleUniverse.getPreferredConfiguration();
           
            m_Canvas3d = new Canvas3D(gConfig);
           
            m_Frame.getContentPane().add(m_Canvas3d);
           
            BranchGroup scene = createSceneGraph();
            scene.compile();
           
            SimpleUniverse simpleUni = new SimpleUniverse(m_Canvas3d);
           
            simpleUni.getViewingPlatform().setNominalViewingTransform();
           
            simpleUni.addBranchGraph(scene);
           
      }

      private BranchGroup createSceneGraph() {
            BranchGroup branchgrp = new BranchGroup();
            branchgrp.addChild(new ColorCube(0.4));
           
            return branchgrp;
      }
}
(Sorry for posting a whole site of code but I failed describing what I'm doing with less text..)

I guess there is something the Applet class did what I forgot to include in my app.
I already searched sun's java forum, this one, tried to find a simple Java3d app which is not an applet with google but wasnt able to find anything solving my problem.
4  Java Game APIs & Engines / Java 3D / Wherer to get Java3d Documentation on: 2002-11-01 15:19:30
Hello,

after making a small Pong clone with Java to get comfortable with the language I felt the desire to find out about Java's 3d capabilities. But I stumbled about the following problem: where's the damn (oops..) documentation for the 3D API? I got the documentation from java.sun.com as well as a large Java introduction/tutorial thing, but I couldnt find anything about rendering 3D graphics with Java. Am I wrong believing there is such a thing as a Java3d Api?
After browsing through the board I found some threads about using OpenGl or DirectX with Java.. could anyone be so kind to point me to some kind of overview about the different possibilities for 3D rendering with Java? I havent found much decent information on the web nor by searching this board, yet.

[edit]/me says hello to everyone :)[/edit]
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (16 views)
2014-07-30 21:08:39

Riven (23 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (42 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43
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!