Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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  
  Tips for starting LWJGL (scroll down)  (Read 1919 times)
0 Members and 1 Guest are viewing this topic.
Offline ShadowProtocol

Senior Newbie





« Posted 2010-11-18 21:13:26 »

Hi, thanks to all of you at java-gaming.org, I finally know how to create a new project in Eclipse and link my JOGL 2.0 library I've downloaded   Cheesy

I recently acquired this book, http://www.amazon.com/gp/product/0321712617/ref=s9_simh_gw_p14_d0_i1?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=1KMCRT135XYZ2WBBV4VH&pf_rd_t=101&pf_rd_p=470938631&pf_rd_i=507846 which is brand new and teaches OpenGL 5 from the beginning.

Instead of LWJGL, I want to work more closely to the original OpenGL calls and really learn how to work with 3D coordinates and then slowly add functions and new classes to form the framework of a game, and then keep starting over making better new code until I really have the skill to make more difficult projects.

I created this topic to find out if any game projects have ever been completed in JOGL, if any source code is available for these games, or if any game tutorials were started that use JOGL that I could look at as a supplement to working alongside the OpenGL 5 book i mentioned earlier.

**I found a tutorial by someone named kevglass on cokeandcode.com for LWJGL, but the source code he posts is different from the code found within the step-by-step tutorial, and jumping around makes it difficult for me to learn. Also he starts off with the beginning of the GameWindow class with more complicated methods before starting with main(), so the jumping around really frustrates the hell out of me.**

So yea, if you have any resources for JOGL that include tiny game projects with available source, that would really be great!
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2010-11-18 22:03:45 »

There is no OpenGL 5.

LWJGL is as close to the original OpenGL API as you can get in Java (and still be safe) IMHO. JOGL is virtually the same but in a different style. You can't get any closer to the metal.

<edit> Oh and almost no JOGL games exist. Maybe TUER. Heh.

Cas Smiley

Offline ShadowProtocol

Senior Newbie





« Reply #2 - Posted 2010-11-18 22:34:45 »

I said OpenGL 5 because I still had OpenGL SuperBible 5th edition in my head sorry Tongue

I want to use LWJGL, but can you link me to the docs? Are they sufficient to learn just using the docs or do I have to learn OpenGL from the book and THEN learn LWJGL?  If LWJGL is worth my time, its gonna cut away from my time reading other OpenGL material..
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #3 - Posted 2010-11-18 22:40:20 »

You can learn OpenGL using LWJGL. A few of the commands have been Java-fied slightly: in general, any command where you pass in a pointer and a GL type and maybe number of elements, in LWJGL you pass in a Direct buffer of the appropriate type, which will be read from its specified position() up to its limit().

Also in LWJGL you can statically import the appropriate GLnn classes so the actual code looks more like C.

Cas Smiley

Offline ShadowProtocol

Senior Newbie





« Reply #4 - Posted 2010-11-18 22:55:41 »

Where are these magical docs I can learn OpenGL from? lol..

Thanks cas Smiley You show up in java boards and lwjgl/opengl topics as far back as 2005, so I know you're definitely the guy to speak to!

Also in LWJGL you can statically import the appropriate GLnn classes so the actual code looks more like C.

I'm trying to get as far away from C as possible. I just need some docs I can read to learn how to actually USE lwjgl after I include it in my project Tongue I've been fiddling with install for 3 days now, its been bad enough the only good tutorial for lwjgl is from cokeandcode.com and doesn't explain the OpenGL calls, just the structure of the game itself (which is gonna be awesome)
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2010-11-18 23:41:21 »

Oh, I go back much further than that... 2001 I think. Not that I'm necessarily the one to listen to. Listen carefully to Spasi, Riven, Kevglass, Matzon, etc. as well, because they all know lots more about things than me. I just "sound" clever.

There's no escaping C when it comes to OpenGL - all the example code on the internets you'll find is C, so it's handy to know you can make code look very similar and sometimes identical to its C counterpart with LWJGL.

There were some NeHe LWJGL tutorials kicking about somewhere.

Cas Smiley

Offline ShadowProtocol

Senior Newbie





« Reply #6 - Posted 2010-11-18 23:43:42 »

Haha ok great, well I know C++ so I'm somewhat familiar with C - I understand what you meant though.. that because most of what I'll find online is about C when it comes to OpenGL, I'll have an easier time porting the code over to Java.

Still, the LWJGL docs..where are they?  :scratches head:


Found the documentation and wiki on the website. The documentation doesn't have a general overview of the library tho, explaining what each category controls, but I see the wiki has links to some tutorials. Just wish there was a tutorial for setting up the window to draw on.

All good though - the kevglass asteroids tutorial does, I'll just have to ignore some of the functions and start with main()

Think thats a good plan, cas?
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2010-11-19 01:05:04 »

It's not much more complicated than:
1  
2  
3  
4  
5  
6  
Display.create();
while (!Display.isCloseRequested()) {
Display.update();
// Draw stuff here etc
Display.sync(60);
}


Cas Smiley

Offline ShadowProtocol

Senior Newbie





« Reply #8 - Posted 2010-11-19 02:47:58 »

I'm patiently working my way through the Asteroids 3D tutorial, and its actually fantastic. Here are my tips to having an easier time understanding what is going on:

1) Open the web page with the tutorials
2) Download the source code
3) Read through the first section (first few paragraphs)
4) Follow along by opening up the source code for the file GameWindow.java (kevglass doesn't completely run you through the creation of the game, you'll want to open up the .java files so you can see some of the functions he skipped (first ones being main() and findDisplayMode())
5) Open IDE (preferably eclipse) and start coding the project from scratch while following steps 3-4
6) Optimize and re-comment where you can so the project becomes YOUR WORDS so YOU understand it for the 2nd project you make on your own (with this one as a reference Smiley)

I was overwhelmed but now I'm moving right along. I also re-wrote findDisplayMode() to use an enhanced for loop:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
private DisplayMode findDisplayMode(int width, int height, int bpp) throws LWJGLException {
      DisplayMode[] modes = Display.getAvailableDisplayModes();
      DisplayMode mode = null;
     
      for (DisplayMode availableMode : modes) {
         if ((availableMode.getBitsPerPixel() == bpp) || (mode == null)) {
            if ((availableMode.getWidth() == width) && (availableMode.getHeight() == height)) {
               mode = availableMode;
            }
         }
      }
     
      return mode;
   }
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.

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

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

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

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (44 views)
2014-07-16 23:30:00

Cero (60 views)
2014-07-16 00:42:17

Riven (57 views)
2014-07-14 18:02:53
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

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!