Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (488)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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  
  Noob LWJGL Question  (Read 3638 times)
0 Members and 1 Guest are viewing this topic.
Offline vydias

Senior Newbie




Welcome to my world!


« Posted 2003-02-18 22:18:19 »

I've only downloaded the LWJGL dll and jar and message around with the example code a bit but I'm interested in diving into development of building a full blow 3D engine using LWJGL or one of the other java 3d libraries for the second generation of our current game project.

I wouldn't want to start from scratch with the 3d engine though and I was wondering if the community has built and impressive terrain rendering engines (fractal or other) that are available for use.

I'd also be interested in finding out if I would have a problem creating the LWJGL's screen buffer after I've already created a screen buffer by using Java bufferstrategies, and if its not a problem how would I go about getting this to work? Would I need to reset the screen buffer back to the original configuration and then recreate it with LWJGL (would lead to problems with java 1.4.1 or less since recreating your graphics config more then once often crashes your system) or is there a way I could pass my current graphics device configuration to the LWJGL's screen device. If there was a way to pass my current graphics config to the LWJGL it would be a smooth transition between 2d and 3d rendering.
Offline Chman

Junior Member




Nothing more that... Java games are cool !


« Reply #1 - Posted 2003-02-19 07:55:23 »

Quote

I wouldn't want to start from scratch with the 3d engine though and I was wondering if the community has built and impressive terrain rendering engines (fractal or other) that are available for use.


See http://chman-area.tuxfamily.org/gt/GT41.ZIP , it's a tutorial ported from GameTutorials.com on Terrain Rendering... this may help you (no fractal anyway Sad )
Offline princec

JGO Kernel


Medals: 367
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #2 - Posted 2003-02-19 08:25:33 »

LWJGL and AWT are completely, totally separate. If you are using LWJGL there is no need to have any part of the AWT installed provided you can be bothered to write your own GUI code. I've rolled my own and I've seen two others that are both excellent quality as well, so it's not vastly difficult to do, and the end result is much nice than AWT.

As far as a framework for doing Stuff is concerned I've put some handy things together in the Shaven Puppy Game Library (http://sourceforge.net/projects/spgl) but what's there is generally a bit buggy and in flux a lot of the time because I'm using it for my own game and it gets "developed" quite a lot.

Cas Smiley

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

Senior Newbie




Welcome to my world!


« Reply #3 - Posted 2003-02-19 17:20:43 »

My problem is that I have a ton of code based entirely on java2D and If there was away for me to easily change my drawing mode from 2d to 3d within our game then we could make any transition over to using LWJGL much simpler in the interum, before going entirely to a 3d game with 3d overlays for the interface.

When you say write your own GUI code are your talking about creating the GUI using LWJGL opengl? For example in Jbuilder I can place a 3d opengl panel onto a form that already has a 2d screen buffer and draw 2d stuff for the interface to the 2d screen and 3d stuff inside opengl panel.  I was just curious if there was or will be support for both a 2d and 3d screen buffer using LWJGL.  Either by passing in my current 2d graphics config to the LWJGL (switching modes) or creating an openGL panel using LWJGL that doesn't require me ditch my current 2d drawing buffer.

As you stated before its not that difficult to create the GUI using LWJGL but it doesn't allow developers who have large projects already completed to easily migrate over to LWJGL without a great deal of overhead if they want to add 3d functionality to their 2d projects.
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #4 - Posted 2003-02-19 18:21:40 »

Quote
When you say write your own GUI code are your talking about creating the GUI using LWJGL opengl? For example in Jbuilder I can place a 3d opengl panel onto a form that already has a 2d screen buffer and draw 2d stuff for the interface to the 2d screen and 3d stuff inside opengl panel.  I was just curious if there was or will be support for both a 2d and 3d screen buffer using LWJGL.


Sorry, nope.  The OpenGL context created by LWJGL has nothing to do with the AWT.  You can't embed it into an AWT frame, or use AWT-based drawing routines on it in any way.

Generally, if you're doing anything like this, LWJGL is not for you.  Sorry!  You'd probably do a lot better giving GL4Java a try.

Hellomynameis Charlie Dobbie.
Offline princec

JGO Kernel


Medals: 367
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2003-02-19 19:16:29 »

...or even Java3D, which seems to be just right for this sort of thing. I mean, it's got to be useful to someone, somewhere...

Cas Smiley

Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #6 - Posted 2003-02-19 19:41:44 »

Additional:  I thought I should explain this a little more.

The problem you're hitting is that LWJGL's use of OpenGL has been designed for a very different purpose than that which Java2D was designed for.  These differencies manifest themselves in a complete lack of interoperability! Wink

However, the path between your Java2D app and GL4Java is quite easy, then when/if you've moved away from Java2D, the path to LWJGL becomes easy as well.

However, that's probably some time in the future.  You may not even need the features of LWJGL over GL4Java.

Hellomynameis Charlie Dobbie.
Offline gregorypierce

Senior Member




I come upon thee like the blue screen of death....


« Reply #7 - Posted 2003-03-01 03:22:32 »

I will say this much, for all the pain that it causes some folks, the code path for providing it is trivially simple. The only thing LWJGL needs to do is allow something to pass it a window handle (HWND) during its construction instead of only creating it itself. Then developers have the option of providing that HWND from a standard Java component in 8 lines of code. Doesn't break anything, doesn't require AWT, and doesn't cause any performance problems... and I know this because I've had to do this for a client who has embedded it into an application.... a Swing application no less. Took a lot of work making sure that nothing overlapped the heavyweight component, but they are happy with the results.

Sending people to GL4Java or Java3D just to render in a window is totally unnecessary.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline Captain-Goatse

Junior Member




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #8 - Posted 2003-03-01 03:41:38 »

I think gl4java is the solution, if you have any questions, PM me I can give you some protips.
Offline princec

JGO Kernel


Medals: 367
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #9 - Posted 2003-03-01 09:43:05 »

I'll investigate that idea Gregory seeing as windowed mode has taken on a nasty life of its own. My debugging hack has escaped quarantine and mutated into a feature...

Cas Smiley

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

Senior Member




I come upon thee like the blue screen of death....


« Reply #10 - Posted 2003-03-01 13:26:29 »

All you need to do is split the create method into two methods Java_org_lwjgl_Display_nCreate and Java_org_lwjgl_Display_nCreateFromWindow. The only difference in Java_org_lwjgl_Display_nCreateFromWindow is that the method takes a Window handle from something else (even a C or .Net application) and when told to render, renders to that window. To get the Window handle of an AWT component or Swing component it trivially simple as well, just extract out the JAWT_DrawingSurfaceInfo and get the hWnd from it to initialize your component. From there just override paint for that component and have it call the appropriate Java_org_lwjgl_Display_nCreateFromWindow. If I wasn't wrapped up with this GUI creation task I would do it myself. Took me a weekend to get down perfectly.

From there its up to the user to decide if they want to have an AWT capable version of the system or not. If they want to render into a Java component - they need to bind with AWT, no way around that... same thing SWT does. If they want to have no dependence on AWT they can have the library create its own component.

Piece of cake. Email me if you want to discuss - me@gregorypierce.com

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
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.

TehJavaDev (17 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (68 views)
2014-08-11 02:49:23

BurntPizza (45 views)
2014-08-09 21:09:32

BurntPizza (36 views)
2014-08-08 02:01:56
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!