LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: napier on July 30, 2004, 18:59:22

Title: Sample code and demo using LWJGL
Post by: napier on July 30, 2004, 18:59:22
I've put together a sample application and toolkit that wraps many commonly used GL features such as:


Zip file is here:  http://potatoland.com/code/lwjgl/lwjgl_demo_1.zip

I did this for my own use (got tired of allocateDirect().order(ByteOrder.nativeOrder()).asDoubleBuffer() .put() .flip() etc.), and I thought it could be useful to have these functions in a simple toolkit.  This is a smorgasbord of useful functions with minimal structure, aimed at beginners that want to get running with LGL.  

My questions: Is this useful, does it work, is there a need for this or something like it?  

If yes, I'm happy to incorporate suggestions, fixes, functions, etc. and put together some demos.  

Obvious immediate needs: this uses version .8, is only tested in Windows, has some known bugs (native cursor problems).
Title: Sample code and demo using LWJGL
Post by: Matzon on July 30, 2004, 21:01:15
nice, here's some random comments:

The reason for your cursor woes, is because you're not loading a 1 bit transparent gif - the alpha channel must be either 0xff or 0x00, and if off - the rest of the data should also be 0x00
To confirm you can check the gif data. You may also fix it easily with a for(int i=0; i<jpixels.length;i++) {
if((jpixels[i] >> 24 & 0xff) != 0xff) {
jpixels[i] = 0;
}
}
which basically says, if the alpha channel isn't 0xff, then all of the argb channels are 0'ed. Ordinarily you wouldn't have to think of rgb, if a was 0x00, however the win32 native cursor stuff is buggy - and I actually volunteered to fixed some months ago :roll: - for now the above solution works fine

All of the buffer utils has been implemented in a BufferUtils package

Other than that this is some good example code - would be nice to get it updated to latest CVS version ;)
Title: Sample code and demo using LWJGL
Post by: napier on July 31, 2004, 01:59:14
Thanks for the tip on the cursor code, I'll put that in.  I'm planning to move this code over to the latest version, just working up the energy to take the plunge.
Title: Sample code and demo using LWJGL
Post by: funsheep on August 08, 2004, 15:27:43
Hi. I have tried to get this code working under Mac OS X and Linux.
under os x the app says:

Current display frequency is 0
--------> Can't find a compatible Display Mode!!! <---------
Setting display mode to null
Bus error


i am using lwjgl 0.9a.

under linux, it says that it can't find some key mapping things (don't know what it exactly was).

regards,
funsheep
Title: Sample code and demo using LWJGL
Post by: elias on August 08, 2004, 18:24:02
Can you be a little more specific on the linux error message? Also list your Linux OS name and version.

- elias
Title: Sample code and demo using LWJGL
Post by: napier on August 09, 2004, 03:20:25
funsheep,

This code was written using version .8 so that might be part of problem if you're using .9.

I'm planning to port it over to .9, also will test on OS X.

napier