Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (115)
games submitted by our members
Games in WIP (562)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  2D in LWJGL  (Read 9767 times)
0 Members and 1 Guest are viewing this topic.
Offline princec

JGO Kernel


Medals: 379
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Posted 2003-01-10 09:05:52 »

A question for all concerned with LWJGL:

Although I think OpenGL is probably the most useful graphics driver available, there remains a very large proportion of computers out there without OpenGL drivers. This matters not for those programming 3D using LWJGL, as they're stuffed either way. But for people only doing simpler 2D operations you get 2fps from the standard MS OpenGL driver.

The large proportion of computers I'm thinking about are anything over about 3-4 years old, and nearly all laptops.

You might not care about these computers but the fact is they make up the majority of all the PCs in the world, and this means they're a proper target for games sales. I don't want to get into a religious discussion about hardcore gamers and marketing etc. so don't start that here.

In order to do 2D, though, you may ask "Well why not just use VolatileImage and friends?" And the answer is because it relies on the AWT, which is a complex beast, and most importantly of all, it's not freely distributable.

I'm proposing doing a simplified 2D API for LWJGL, which will look a little like DirectDraw or SDL in that it will give you the most basic blitting operations and the ability to grab memory addresses of bits of video memory so you can poke them directly.

Who is interested? What are your thoughts? Should it be an add-on or should we bundle it into LWJGL? (It won't be big).

Cas Smiley

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #1 - Posted 2003-01-10 10:35:26 »

Well - you know I am in Grin - this is one of my future projects - Java's current 2D support sucks!

I am not in total agreance of what the purpose of this kit is - you seem to want the 2d kit, because of the sheer availability of cards that cannot do 3d. I want a 2d kit, because 3d adds lots of stuff I am not very interrested in, while doing a tetris close for instance...

One concern of mine have been to do a strictly 2d api, or only somekind of interface to something that can draw on screen. By using 2d only, you miss out on all the nice features of capable HW.  M$ already deprecated DirectDraw, in favor of Direct3D...

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #2 - Posted 2003-01-10 10:38:36 »

Quote
Should it be an add-on or should we bundle it into LWJGL?


That really depends on the size of the library - sdl is ~ 100 kB packed.

If included in lwjgl, we need to change it's purpose from 3d only to general purpose game library - which the name does actually imply - sort of ...

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

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #3 - Posted 2003-01-10 11:05:55 »

ohh - totally forgot:
http://jsdl.sourceforge.net/

Offline SpongeBob

Junior Member




Who lives in a pinnapple under the sea


« Reply #4 - Posted 2003-01-11 01:38:42 »

Or try SDL4Java on Sourceforge at the end of this month.
Offline princec

JGO Kernel


Medals: 379
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2003-01-11 10:14:05 »

So do we reckon it's best to just leave it well alone and let the SDL guys do it? After all, SDL's got a bunch more stuff in it that does other things like loading images etc. hasn't it?

Cas Smiley

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #6 - Posted 2003-01-11 10:29:50 »

well sdl might be nice for some - but its dependencies wehigh in at ~ 500 kB - a bit much, not excessively much, but still...
besides I tried it jsdl, based on sdl 1.2.0 with the 1.2.5 lib ( cannot find 1.2.0) - and it was buggy as hell!

Fwiw - I'd settle for a simple 2d blitting thingy for lwjgl. What I'd really like though (which is a lot more work) is to use ogl for doing 2d, that way we will get access to fast HW and effects - which just can't be done as fast (think rotating, translucensy and so forth).

Offline SpongeBob

Junior Member




Who lives in a pinnapple under the sea


« Reply #7 - Posted 2003-01-11 12:53:42 »

Quote

well sdl might be nice for some - but its dependencies wehigh in at ~ 500 kB - a bit much, not excessively much, but still...


Unless your coding applets or must have your game fit on a single 3.5" floppy, ~500 kb is really small.
Offline princec

JGO Kernel


Medals: 379
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2003-01-11 13:14:40 »

Spongebob, if you're trying to code a demo that people can be bothered to download then 500kb is huge considering it's just supporting code.

Remember, over 5Mb and downloads drop of drastically (and that's one of the fundamental reasons Java has really failed on the desktop).

And every meg under 5Mb downloads increase significantly.

Worth bearing in mind.

Cas Smiley

Offline SpongeBob

Junior Member




Who lives in a pinnapple under the sea


« Reply #9 - Posted 2003-01-11 20:07:47 »

princec, 500 KB is not 5 megs.  Also, at last I checked LWJGL dlls weigh in more than 500 KB (actually on Windows it was 790528 bytes or 772 kilobytes).
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #10 - Posted 2003-01-11 20:12:03 »

gl dll shouldn't be counted, as it is _always_ available

Offline SpongeBob

Junior Member




Who lives in a pinnapple under the sea


« Reply #11 - Posted 2003-01-11 20:19:06 »

Quote

gl dll shouldn't be counted, as it is _always_ available


Didnt count the gl dll in my total since I have a graphics card which puts it past the basic 1.1 version (bigger dll in otherwords compared to a basic Windows install).  And OpenGL is only always present on Windows computers.
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #12 - Posted 2003-01-11 20:35:36 »

lwjgl.dll : 220
OpenAL32.dll: 88
lwjgl.jar: 120

total: 428

how does that even 772 kB ?

428 compresses to 213 kB, zip archive

Offline SpongeBob

Junior Member




Who lives in a pinnapple under the sea


« Reply #13 - Posted 2003-01-11 20:53:17 »

I only counted the DLLs in my original figure which includes a lwjgl_d.dll.  I am guessing you are not including this because its a debug dll?

Anyways, even without that dll LWJGL approaches your "~500 KB".  Thats funny since SDL dll is only 220 KB.
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #14 - Posted 2003-01-11 22:48:59 »

Quote
I only counted the DLLs in my original figure which includes a lwjgl_d.dll.  I am guessing you are not including this because its a debug dll?

yep

Quote
Anyways, even without that dll LWJGL approaches your "~500 KB".

well, lwjgl is 14,4% smaller than 500 kB  Tongue

Quote
Thats funny since SDL dll is only 220 KB.

except jsdl needs smpeg.dll too and the jar:

sdl.jar: 101
SDL4Java.dll : 24
SDL.dll : 220
smpeg.dll : 220

total: 565 kB - am amazing 32 % more than lwjgl Tongue

and if this would be included in lwjgl, we're looking at 565 + 428 = 993 kB of support code!

lwjgl wouldn't be so light anymore...

but going back on topic  Grin - sdl does a lot more than basic blitting - it is a game library in itself!
So using sdl for basic stuff seems like overkill - better to roll our own, though this will take some more time...

Offline SpongeBob

Junior Member




Who lives in a pinnapple under the sea


« Reply #15 - Posted 2003-01-12 00:06:26 »

Quote

except jsdl needs smpeg.dll too and the jar:

and if this would be included in lwjgl, we're looking at 565 + 428 = 993 kB of support code!


SDL does not require smpeg.dll.  JSDL does due to how it was designed by its coders.  Your point is moot since JSDL will not work with LWJGL anyways and I dont think that was ever princec intent.
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #16 - Posted 2003-01-12 06:09:51 »

Quote

SDL does not require smpeg.dll.  JSDL does due to how it was designed by its coders.


yeah - ok, the Java binding for sdl requires the the smpeg.dll, because the don't dynamically load it - like lwjgl loads opengl/al dynamically.

Quote
Your point is moot since JSDL will not work with LWJGL anyways and I dont think that was ever princec intent.


See - thats what happens when a thread goes OT - I get confused  Grin
You're right.

But having evaluated the sdl binding (jsdl) using current version, I can only say that it is waaaay to buggy to be of any use.

- looking forward to sdl4java...

Offline Harley Rana

Junior Member




Java games rock!


« Reply #17 - Posted 2003-01-20 06:28:58 »

Hey with some fast java 2D i'll be very happy!
I like the idea of a simple api to access the backbuffer, and some simple drawing functions. Any extra stuff can be in a util library.

SDL is more a game library, with all its extra features. All we really need is some fast 2D.

Question of bundling with lwjgl, id say they aren't that similar and don't need to be together.  I can't see when you'll be using both in one project.

Just thinking about demos, don't most of the demo writters create most/all of their graphics stuff themselves?

Offline CDU

Senior Newbie




Java games rock!


« Reply #18 - Posted 2003-01-20 08:17:31 »

Mmmhhh do u know TinyPTC Huh

Little library (who exist for Java). With it, u can initialize video mode and draw pixel very quickly... but only pixel draw (not rectangle, copy block or other 2d functions).



Offline Harley Rana

Junior Member




Java games rock!


« Reply #19 - Posted 2003-01-20 22:52:03 »

Yes i know TinyPTC.  Have you looked at the source?
It hardly does anything.  And it still uses the java rendering system.  
I was thinking of video back buffer access, so you could draw onto the backbuffer then swap buffers to display.  I would also like to see some drawing functions like draw/fill Polygon, drawOval,etc.

I like the way its done in SDL, uses a platform neutral public interface, with a platform specifc backend.  Using directx 5 on windows for example.

As size is very important for many projects, having just the basic drawing facilitys in the core library, with supporting librarys to give people the option.

Offline CDU

Senior Newbie




Java games rock!


« Reply #20 - Posted 2003-01-21 07:56:27 »

Ya SDL is great...

What kind of function do u want to developp Huh
base functions (copy, rectangle...) or advanced functions (scrolling, layers, various 2d effect library ...) ??

Offline princec

JGO Kernel


Medals: 379
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #21 - Posted 2003-01-21 11:20:45 »

What's needed is a general-purpose library for allocating, locking, unlocking, and deallocating video RAM for starters - this can't be done from Java minus AWT.

Then what's needed is a blitting function which will copy areas of memory from A to B in various formats, using MMX, SSE or Altivec depending on what's available, which also is not available from Java. Under Win32 it's possible we get some blitting functions for free in DirectX but I'm not so sure they support alpha which is a definite requirement. At the end of the day you can still write your own blit routines direct to the memory but we're confident the C/#asm routines will be a lot faster.

The API will be very, very, simple, and might have some GL-like state in it. I'm thinking of a design right now.

Cas Smiley

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #22 - Posted 2003-01-21 11:58:51 »

As far as I know, the old DirectDraw interface only allows non-alpha'd bliting, so using that is not really practical.

A point to bear in mind could be making coversion into a Gl texture nice and easy, so people can use the 2d routines for altering textures on the fly Smiley

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline vrm

Junior Member




where I should sign ?


« Reply #23 - Posted 2003-01-27 18:20:58 »

and for images, if you won't  use AWT, what would you use ? an extra lib ?
Offline princec

JGO Kernel


Medals: 379
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #24 - Posted 2003-01-27 22:04:50 »

I seem to get by without it...

Cas Smiley

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #25 - Posted 2003-01-28 02:59:13 »

vrm: If you look in the spgl, you'll see that all images used, are processed ahead of time by the awt package, and then saved in raw form as a .jgimage.

Offline vrm

Junior Member




where I should sign ?


« Reply #26 - Posted 2003-01-28 05:19:28 »

won't help the game download time  Grin
Offline Jacko

Junior Member





« Reply #27 - Posted 2003-01-28 08:12:29 »

The jgimage format is compressed, and I've always got a smaller file size than the png its created from.
Offline princec

JGO Kernel


Medals: 379
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #28 - Posted 2003-01-28 09:54:03 »

Weird, I never noticed that before.
They zip up further a teeny little bit too.
I was wondering whether to do a little more clever compression on them as well, perhaps storing deltas, or deltas of colour planes, which often compress better.

Cas Smiley

Offline mill

Junior Member




popcorn freak


« Reply #29 - Posted 2003-04-28 10:36:18 »

cas: i'd suggest you finish lwjgl first and then start on the 2d stuff.

why not put lwjgl2d on top of lwjgl directly? that would make it a tad bigger.

as a side note i don't 100% agree with your download size theory. 5 mb is small nowaways and the percentage of people having fast internet access is very high here in sweden.

besides, i'm thinking of making my current game very big, perhaps hundred mbs. people might think "whoah, it seems like a proper game" or something Smiley of course, a small 15 mb version wil be available too. it's the music that takes up space. a couple of songs in mp3 format = big file size.

i don't have any costs for traffic so i don't care!

Pages: [1] 2
  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.

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

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

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

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

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

BurntPizza (29 views)
2014-09-19 03:14:18

Dwinin (46 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24: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!