Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (568)
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  
  3d object  (Read 3163 times)
0 Members and 1 Guest are viewing this topic.
Offline hhfjkehfe

Senior Newbie





« Posted 2012-06-17 17:15:25 »

Hi , I am new java game dev but I am not newbie in Java  Grin. Since one of the paradigm of Java is to keep it simple as possible I want to show me a tut just how to make a 3d object add move it.
Offline Z-Man
« Reply #1 - Posted 2012-06-17 17:27:33 »

First you'll need something to help you with 3D rendering, for simply drawing a cube I'd suggest LWJGL, then I'd take a look at some tutorials for whatever tool you choose to use for your 3D rendering. (LWJGL Tutorials)

Some of the other 3D rendering tools can be found in JGO's Java Gaming Resources section under 3D Enginges and Libraries

EDIT:
I forgot to mention that LWGL is simply a Java binding to OpenGL, it isn't a full game library. This means you'll have to write more boilerplate code than you would if you chose a 3D game library. LWJGL is still a good choice IMHO
Offline hhfjkehfe

Senior Newbie





« Reply #2 - Posted 2012-06-17 18:12:28 »

Ok.I have an error
1  
2  
Description   Resource   Path   Location   Type
Access restriction: The type DisplayMode is not accessible due to restriction on required library C:\Program Files\Java\jre7\lib\rt.jar   main.java   /javax.media/src   line 3   Java Problem

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  
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

public class DisplayExample {
   public void start() {
      try {
         Display.setDisplayMode(new DisplayMode(800,600));
         Display.create();
      } catch (LWJGLException e) {
         e.printStackTrace();
         System.exit(0);
      }
     
      // init OpenGL here
     
      while (!Display.isCloseRequested()) {
         
         // render OpenGL here
       
         Display.update();
      }
     
      Display.destroy();
   }
   
   public static void main(String[] argv) {
      DisplayExample displayExample = new DisplayExample();
      displayExample.start();
   }
}
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline hhfjkehfe

Senior Newbie





« Reply #3 - Posted 2012-06-18 19:04:58 »

Help?
Offline ra4king

JGO Kernel


Medals: 347
Projects: 3
Exp: 5 years


I'm the King!


« Reply #4 - Posted 2012-06-18 19:16:13 »

I have never seen that error before in my life. Did you break Java? Grin

Funny thing, DisplayMode is in the LWJGL JAR file, not rt.jar. Maybe it's using the AWT DisplayMode class? But that's "restricted" either :/

Offline Z-Man
« Reply #5 - Posted 2012-06-18 20:25:32 »

How did you setup LWGJL? It looks like you get that kind of error when you try to replace a standard Java class with a custom class. I quick google found this maybe it'll help.
Offline Rorkien
« Reply #6 - Posted 2012-06-18 20:30:19 »

Restriction? Hmm
It could be windows requiring administrator privileges to access the jars, or something is blocking them (antivirus?).

Does this error pops out on every code you type?
Offline sproingie

JGO Kernel


Medals: 202



« Reply #7 - Posted 2012-06-19 04:34:06 »

Check the runtime environment you have selected in Eclipse.  If you have something funky like j2me selected, you'll get this when you try to use jars with classes that are incompatible with your environment.

Sometimes it's just Eclipse being stupid (shocker, I know) and removing lwjgl.jar from your depencies and adding it back might fix it.
Offline hhfjkehfe

Senior Newbie





« Reply #8 - Posted 2012-06-20 11:40:32 »

Ok.On testing i got this ndowCreationTest
The following keys are available:
ESCAPE:         Exit test
ARROW Keys:     Move window when in non-fullscreen mode
L:              List selectable display modes
0-8:            Selection of display modes
F:              Toggle fullscreen
SHIFT-F:        Toggle fullscreen with Display.destroy()/create() cycle
Found 24 display modes
Problem retrieving mode with 640x480x24@-1
Problem retrieving mode with 800x600x24@-1
Problem retrieving mode with 1024x768x24@-1
Offline hhfjkehfe

Senior Newbie





« Reply #9 - Posted 2012-06-20 12:22:35 »

And now i got error on line 8
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  
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

 class DisplayExample {
   public void start() {
      try {
         Display.setDisplayMode(new DisplayMode(800,600));
         Display.create();
      } catch (LWJGLException e) {
         e.printStackTrace();
         System.exit(0);
      }
     
      // init OpenGL here
     
      while (!Display.isCloseRequested()) {
         
         // render OpenGL here
       
         Display.update();
      }
     
      Display.destroy();
   }
   
   public static void main(String[] argv) {
      DisplayExample displayExample = new DisplayExample();
      displayExample.start();
   }
}
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline hhfjkehfe

Senior Newbie





« Reply #10 - Posted 2012-06-23 19:15:42 »

help?
Offline ra4king

JGO Kernel


Medals: 347
Projects: 3
Exp: 5 years


I'm the King!


« Reply #11 - Posted 2012-06-24 03:00:57 »

Well "I get an error" is not very descriptive for us Wink

Offline hhfjkehfe

Senior Newbie





« Reply #12 - Posted 2012-07-01 12:29:35 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
   at java.lang.ClassLoader.loadLibrary(Unknown Source)
   at java.lang.Runtime.loadLibrary0(Unknown Source)
   at java.lang.System.loadLibrary(Unknown Source)
   at org.lwjgl.Sys$1.run(Sys.java:73)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
   at org.lwjgl.Sys.loadLibrary(Sys.java:95)
   at org.lwjgl.Sys.<clinit>(Sys.java:112)
   at org.lwjgl.opengl.Display.<clinit>(Display.java:132)
   at InputExample.start(InputExample.java:11)
   at InputExample.main(InputExample.java:71)

Where is the problem?
Offline ra4king

JGO Kernel


Medals: 347
Projects: 3
Exp: 5 years


I'm the King!


« Reply #13 - Posted 2012-07-01 19:16:06 »

Well that's because you haven't included the natives in the java.library.path Smiley

If you're using Eclipse, see here how to set LWJGL properly.
Click here for Netbeans.

Click here for the LWJGL wiki for more info.

Offline hhfjkehfe

Senior Newbie





« Reply #14 - Posted 2012-07-02 07:57:30 »

Ok.Now how to make a 3d object and how to move it ?
Offline ra4king

JGO Kernel


Medals: 347
Projects: 3
Exp: 5 years


I'm the King!


« Reply #15 - Posted 2012-07-02 09:00:00 »

Ehhh learn OpenGL Smiley

Offline hhfjkehfe

Senior Newbie





« Reply #16 - Posted 2012-07-02 09:29:59 »

But I want it for java.
Offline gouessej
« Reply #17 - Posted 2012-07-02 17:05:13 »

But I want it for java.
But ra4king is right anyway. You have to understand the basis of OpenGL even though you plan to use it with a Java binding (JOGL, LWJGL) and as far as I know, Nehe tutorials have been ported to both APIs.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

Pippogeek (40 views)
2014-09-24 16:13:29

Pippogeek (31 views)
2014-09-24 16:12:22

Pippogeek (21 views)
2014-09-24 16:12:06

Grunnt (47 views)
2014-09-23 14:38:19

radar3301 (29 views)
2014-09-21 23:33:17

BurntPizza (65 views)
2014-09-21 02:42:18

BurntPizza (37 views)
2014-09-21 01:30:30

moogie (43 views)
2014-09-21 00:26:15

UprightPath (53 views)
2014-09-20 20:14:06

BurntPizza (55 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!