LWJGL 0.6 Prerelease

Just a quick mention - 0.6 has been released as a prerelease.
Unless anything crops up - this will become the 0.6 release. But we just want to make sure that we don’t have any annoying bugs in there - like 0.5.

Yes, we have introduced yet some api changes - we’ll add some docs describing the changes, but for now you’ll have to wait for the final 0.6 to get that document and a whats changed doc

files:
http://sourceforge.net/project/showfiles.php?group_id=58488

changelog:
http://sourceforge.net/project/shownotes.php?release_id=156274

0.6 is due out Real Soon Now - a day or two, probably this weekend ::slight_smile:

oh, and please hammer away on the examples/tests!
post any problems to this thread, the LWJGL SourceForge Forum or to brian@matzon.dk

Is Mac OS X support going to make it into this release?

[quote]Is Mac OS X support going to make it into this release?
[/quote]
afaik, no :-/
It is being worked on, but the main man Gregory Pierce got tied up in Real Life when the war broke out (he works for CNN).

I can’t tell you how close it is to being done either - maybe Gregory could drop a line (swpalmer, where you looking at mac os x too??? - I know that someone else was interested in doing the mac os x port too).
For the record, LWJGL is pretty easy to port - so anybody with a bit of c/c++ experience can make a port…

Woah! Do you think it’s safe to jump into a pre-release release without testing the waters first? :o

[quote]Woah! Do you think it’s safe to jump into a pre-release release without testing the waters first? :o
[/quote]
hehe. it’s not - and that’s the point :slight_smile:

betatesting… and this is a way to accelerate it :wink:

the reason for the pre release is that we get a tested release, before we announce it to all the sites we can think of. 0.5 wasn’t announced because of the bugs found in their. Look at the download statistics, and you’ll see the difference it makes to have a release announced!

Um, I’m having a little trouble here. Version 0.6 has changed a lot I see… DisplayModes no longer have any depth, alpha or stencil values, there’s no Display.isCreated(), or in fact Display.create()… Ah, it’s all migrated to the GL constructor…

Do you have a sample Display and GL initialisation fragment to give me a few pointers? None of the examples seem to use anything beyond WxH@bpp - what is the loop we’re expected to go through this time to create a GL context? Something like this maybe:

get all available DisplayModes
filter for required mode features
foreach filtered mode dm
      Display.setDisplayMode(dm)
      if no exception thrown
            confirm dm.width = Display.width etc
                  if anything not correct, restart loop with next DisplayMode
            call GL constructor with required GL attributes
            if exception thrown
                  restart loop with next DisplayMode
            else
                  break and continue.

How do we know what values the OpenGL hardware supports for depth buffers etc? Or should we just try everything that would be likely to exist?

N.B. Display.java:132 - Javadoc mentions using getDisplayMode(), which doesn’t exist.

We went back to the old style of setting up the display - you can only query available whf, not the pixel format. Trying to fetch the available pixel formats from GL wasn’t worth the trouble. So yes - you’re back to guessing the modes, and catching failures.

  • elias

I just wrote an email to chman - pasting some of what I wrote here too, since it is usefull:


Basically, GL/Display/Window mode has been altered, along with new easy AL construction management.

Where you would before just do a 
Display.create(...)
gl.create(...)

you now do:

 windowed mode:
  just create a gl instance with required values (use the constructor with location/size)

 fullscreen:
  set display mode
  create a gl instance with required values(use the constructor with no location/size)

and when swapping buffer, we now use gl.paint(); instead. We also added a gl.tick(); method, which must get called. This method checks eventqueue and all other internal stuff that is needed...

regarding OpenAL, instead of doing opendevice, createcontext, makeContextCurrent and all that - you now do:

AL al = new AL(...);
al.create();
//use sucker
al.destroy();

In other words, when creating an OpenAL instance, the default device and a default context will be automagically created for you!

hope this helps a bit... will talk to the others about doing a small WHATSNEW document, and one describing 0.5 -> 0.6 upgrade path

yes documentation always lag behind… - just hammer us for info… (on second note, hammer Elias or Cas :))

Ok, upgrading my app…

I’m still a little confused, it was mentioned above, but I still don’t understand…

in GL constructor, what exactly is the int alpha, int depth and int stencil values and where do we get them? I only worry about widthxheightxbpp.

ADS values are those that your application requires. If you don’t need alpha, depth, or stencil, specify 0!

Cas :slight_smile:

Ok, got the display working… but now my texture loading doesn’t appear to be working. No changes have been made, and it worked fine prior to 0.6. Any ideas?


IntBuffer buf =
            ByteBuffer
                .allocateDirect(4)
                .order(ByteOrder.nativeOrder())
                .asIntBuffer();
        int bufPtr = Sys.getDirectBufferAddress(buf);

        //Create the texture
        gl.genTextures(1, bufPtr);

results in the following error:


An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x0
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.


Current Java thread:
      at org.lwjgl.opengl.CoreGL.genTextures(Native Method)
      at monkey.texture.TextureManager.loadTexture(TextureManager.java:235)
      at monkey.geometry.text.Font2D.setFontTexture(Font2D.java:82)
      at monkey.geometry.text.Font2D.<init>(Font2D.java:64)
      at test.TestMain.init(TestMain.java:158)
      at monkey.AbstractGame.start(AbstractGame.java:44)
      at test.TestMain.main(TestMain.java:196)

Dynamic libraries:
0x00400000 - 0x00406000       C:\Program Files\Java\j2re1.4.1\bin\javaw.exe
0x77F80000 - 0x77FFA000       C:\WINNT\system32\ntdll.dll
0x77DB0000 - 0x77E0B000       C:\WINNT\system32\ADVAPI32.dll
0x77E80000 - 0x77F31000       C:\WINNT\system32\KERNEL32.dll
0x77D30000 - 0x77D9D000       C:\WINNT\system32\RPCRT4.dll
0x77E10000 - 0x77E6F000       C:\WINNT\system32\USER32.dll
0x77F40000 - 0x77F79000       C:\WINNT\system32\GDI32.dll
0x78000000 - 0x78046000       C:\WINNT\system32\MSVCRT.dll
0x6D330000 - 0x6D45C000       C:\Program Files\Java\j2re1.4.1\bin\client\jvm.dll
0x77570000 - 0x775A0000       C:\WINNT\System32\WINMM.dll
0x6D1D0000 - 0x6D1D7000       C:\Program Files\Java\j2re1.4.1\bin\hpi.dll
0x6D300000 - 0x6D30D000       C:\Program Files\Java\j2re1.4.1\bin\verify.dll
0x6D210000 - 0x6D229000       C:\Program Files\Java\j2re1.4.1\bin\java.dll
0x6D320000 - 0x6D32D000       C:\Program Files\Java\j2re1.4.1\bin\zip.dll
0x10000000 - 0x1003B000       C:\WINNT\SYSTEM32\lwjgl.dll
0x5F580000 - 0x5F5A7000       C:\WINNT\System32\DINPUT.dll
0x69510000 - 0x695D7000       C:\WINNT\System32\OPENGL32.dll
0x6FAC0000 - 0x6FADF000       C:\WINNT\System32\GLU32.dll
0x51000000 - 0x51047000       C:\WINNT\System32\DDRAW.dll
0x728A0000 - 0x728A6000       C:\WINNT\System32\DCIMAN32.dll
0x6D000000 - 0x6D0FA000       C:\Program Files\Java\j2re1.4.1\bin\awt.dll
0x77800000 - 0x7781E000       C:\WINNT\System32\WINSPOOL.DRV
0x76620000 - 0x76630000       C:\WINNT\system32\MPR.dll
0x75E60000 - 0x75E7A000       C:\WINNT\System32\IMM32.dll
0x77A50000 - 0x77B3C000       C:\WINNT\system32\ole32.dll
0x6D180000 - 0x6D1D0000       C:\Program Files\Java\j2re1.4.1\bin\fontmanager.dll
0x72D90000 - 0x72E03000       C:\WINNT\System32\D3DIM.DLL
0x6D2D0000 - 0x6D2DE000       C:\Program Files\Java\j2re1.4.1\bin\net.dll
0x75050000 - 0x75058000       C:\WINNT\System32\WSOCK32.dll
0x75030000 - 0x75043000       C:\WINNT\System32\WS2_32.DLL
0x75020000 - 0x75028000       C:\WINNT\System32\WS2HELP.DLL
0x6D2E0000 - 0x6D2E8000       C:\Program Files\Java\j2re1.4.1\bin\nio.dll
0x60000000 - 0x60045000       C:\WINNT\System32\MSCTF.dll
0x77920000 - 0x77943000       C:\WINNT\system32\imagehlp.dll
0x72A00000 - 0x72A2D000       C:\WINNT\system32\DBGHELP.dll
0x690A0000 - 0x690AB000       C:\WINNT\System32\PSAPI.DLL

Local Time = Fri May 02 08:14:05 2003
Elapsed Time = 3
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.1-b21 mixed mode)
#
# An error report file has been saved as hs_err_pid1528.log.
# Please refer to the file for further information.
#


Does the rest of your gl calls work? And did you try the debug version (-ea)?

  • elias

You’re right Elias, no gl calls work. As soon as I removed all the texture calls, glShadeMode failed.

Here’s how I build the gl object:


try {
            //create the Display. 
            DisplayMode mode = getValidDisplayMode(width, height, bpp);
            if (null == mode) {
                throw new MonkeyRuntimeException("Bad display mode");
            }
            
            if(fullscreen) {
                Display.setDisplayMode(mode);
                gl = new GL(title, bpp, 0, 0, 0);
            } else {
                int x, y;
                x = Toolkit.getDefaultToolkit().getScreenSize().width - 
                        (width/2);
                y = Toolkit.getDefaultToolkit().getScreenSize().height -
                        (height/2);
                gl = new GL(title, x, y, width, height, bpp, 0, 0, 0);
            }
            //Display.create(mode, fullscreen, title);

            LoggingSystem.getLoggingSystem().getLogger().log(
                Level.INFO,
                "Created display.");
        } catch (Exception e) {
            LoggingSystem.getLoggingSystem().getLogger().log(
                Level.SEVERE,
                "Failed to create display due to " + e);
            System.exit(1);
        }
        
        glu = new GLU(gl);

here is the error again with the -ea flag turned on.


Removed 0 duplicate displaymodes
May 2, 2003 9:52:46 AM monkey.system.DisplaySystem getValidDisplayMode
INFO: Setting mode to 640 x 480 x 32 @60Hz
May 2, 2003 9:52:46 AM monkey.system.DisplaySystem initDisplay
INFO: Created display.

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x0
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.


Current Java thread:
      at org.lwjgl.opengl.CoreGL.genTextures(Native Method)
      at monkey.texture.TextureManager.loadTexture(TextureManager.java:235)
      at monkey.geometry.text.Font2D.setFontTexture(Font2D.java:82)
      at monkey.geometry.text.Font2D.<init>(Font2D.java:64)
      at test.TestMain.init(TestMain.java:158)
      at monkey.AbstractGame.start(AbstractGame.java:44)
      at test.TestMain.main(TestMain.java:196)

Dynamic libraries:
0x00400000 - 0x00406000       C:\Program Files\Java\j2re1.4.1\bin\javaw.exe
0x77F80000 - 0x77FFA000       C:\WINNT\system32\ntdll.dll
0x77DB0000 - 0x77E0B000       C:\WINNT\system32\ADVAPI32.dll
0x77E80000 - 0x77F31000       C:\WINNT\system32\KERNEL32.dll
0x77D30000 - 0x77D9D000       C:\WINNT\system32\RPCRT4.dll
0x77E10000 - 0x77E6F000       C:\WINNT\system32\USER32.dll
0x77F40000 - 0x77F79000       C:\WINNT\system32\GDI32.dll
0x78000000 - 0x78046000       C:\WINNT\system32\MSVCRT.dll
0x6D330000 - 0x6D45C000       C:\Program Files\Java\j2re1.4.1\bin\client\jvm.dll
0x77570000 - 0x775A0000       C:\WINNT\System32\WINMM.dll
0x6D1D0000 - 0x6D1D7000       C:\Program Files\Java\j2re1.4.1\bin\hpi.dll
0x6D300000 - 0x6D30D000       C:\Program Files\Java\j2re1.4.1\bin\verify.dll
0x6D210000 - 0x6D229000       C:\Program Files\Java\j2re1.4.1\bin\java.dll
0x6D320000 - 0x6D32D000       C:\Program Files\Java\j2re1.4.1\bin\zip.dll
0x10000000 - 0x1008A000       C:\WINNT\SYSTEM32\lwjgl_d.dll
0x5F580000 - 0x5F5A7000       C:\WINNT\System32\DINPUT.dll
0x69510000 - 0x695D7000       C:\WINNT\System32\OPENGL32.dll
0x6FAC0000 - 0x6FADF000       C:\WINNT\System32\GLU32.dll
0x51000000 - 0x51047000       C:\WINNT\System32\DDRAW.dll
0x728A0000 - 0x728A6000       C:\WINNT\System32\DCIMAN32.dll
0x6D000000 - 0x6D0FA000       C:\Program Files\Java\j2re1.4.1\bin\awt.dll
0x77800000 - 0x7781E000       C:\WINNT\System32\WINSPOOL.DRV
0x76620000 - 0x76630000       C:\WINNT\system32\MPR.dll
0x75E60000 - 0x75E7A000       C:\WINNT\System32\IMM32.dll
0x77A50000 - 0x77B3C000       C:\WINNT\system32\ole32.dll
0x6D180000 - 0x6D1D0000       C:\Program Files\Java\j2re1.4.1\bin\fontmanager.dll
0x72D90000 - 0x72E03000       C:\WINNT\System32\D3DIM.DLL
0x6D2D0000 - 0x6D2DE000       C:\Program Files\Java\j2re1.4.1\bin\net.dll
0x75050000 - 0x75058000       C:\WINNT\System32\WSOCK32.dll
0x75030000 - 0x75043000       C:\WINNT\System32\WS2_32.DLL
0x75020000 - 0x75028000       C:\WINNT\System32\WS2HELP.DLL
0x6D2E0000 - 0x6D2E8000       C:\Program Files\Java\j2re1.4.1\bin\nio.dll
0x60000000 - 0x60045000       C:\WINNT\System32\MSCTF.dll
0x77920000 - 0x77943000       C:\WINNT\system32\imagehlp.dll
0x72A00000 - 0x72A2D000       C:\WINNT\system32\DBGHELP.dll
0x690A0000 - 0x690AB000       C:\WINNT\System32\PSAPI.DLL

Local Time = Fri May 02 09:52:46 2003
Elapsed Time = 1
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.1-b21 mixed mode)
#
# An error report file has been saved as hs_err_pid1028.log.
# Please refer to the file for further information.
#
Selecting NT display mode check
Querying 3D Prophet NVidia Series device
Querying NetMeeting driver device
Found 114 displaymodes


You’re missing a


gl.create();
gl.determineAvailableExtensions();

Don’t worry, you weren’t to know…

Cas :slight_smile:

That did it, thank you.

Oh so you have to create the GL context by gl.create() ?

So how about a simple piece of source code that shows us

a.) how to initialize the display correctly
b.) how to do buffer flipping correctly

That would shorten this thread IMO. LWJGL is a tool for me…i just want to use it, not collect almost all information i need from a multi-paged thread and guess the stuff that’s still missing.

Your wish, is my command ;D
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java

This is actually work in progress - but serves to show how to initialize and switch between fullscreen and windowed mode, including how to use the isDirty method.

This is work in progresss, so I will update it as I go along - or it might turn into a DefaultApplication class, which shows how all application using lwjgl should initialize / deinitialized (including adding shutdown hooks for VM closing (ressetting display))