Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
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  
  Background Loading  (Read 1078 times)
0 Members and 1 Guest are viewing this topic.
Offline cborders

Junior Member





« Posted 2005-12-10 06:01:43 »

I just thought of this and wondered if it was possible.  If I had an OpenGL context that was shared between a Display and a Pbuffer, could I load data into the Pbuffer in the background while using the Display to render.  That way, if I had a large open world I could load data that was getting close enough to see, so that it would be in memory once I got close enough to see it.  Like I said I don't know if this would work and it's rather late so if I'm talking crazy, just let me know!
Offline princec
« League of Dukes »

JGO Kernel


Medals: 196
Projects: 3


Eh? Who? What? ... Me?


« Reply #1 - Posted 2005-12-12 01:25:47 »

You forget that only one thread can own the context at a time...

Cas Smiley

Offline cborders

Junior Member





« Reply #2 - Posted 2005-12-12 02:45:21 »

 Roll Eyes Oh, yeah
Games published by our own members! Check 'em out!
Try the Free Demo of Revenge of the Titans
Offline princec
« League of Dukes »

JGO Kernel


Medals: 196
Projects: 3


Eh? Who? What? ... Me?


« Reply #3 - Posted 2005-12-12 12:53:17 »

The way I've got it rigged is you can have a separate resource loading thread that loads stuff from disk into ByteBuffers. But then what it does is queue GL code up in the main thread so that I don't need to do any fiddly thread context switching. It's still fiddly and I've not really used it in anger. Er, or at all, even. The main problem being it's usually quite difficult to know what you need to load next until the time comes when you actually need to display it. Especially as some things need to be loaded with dependencies - consider loading a GL model for example, it'll have to bring in a bunch of textures asynchronously as well, etc, etc.

I find it generally just easier to load everything on demand and as much as feasible up front during the splash screen Smiley

Cas Smiley

Offline kevglass
« League of Dukes »

JGO Kernel


Medals: 54
Projects: 20


Mentally unstable, best avoided.


« Reply #4 - Posted 2005-12-12 13:02:22 »

I use this sorta thing

http://www.cokeandcode.com/code/src/render/org/newdawn/state/loading/
http://www.cokeandcode.com/code/src/render/org/newdawn/state/

which just queues up a bunch of little tasks  that need loading and loads one per frame. It doesn't make it perfect, but it does give a slightly better refresh at spash screen / load time

Didn't Weston have a wonderfully threaded texture loader in the Shared Code section at one point?

Kev

Offline princec
« League of Dukes »

JGO Kernel


Medals: 196
Projects: 3


Eh? Who? What? ... Me?


« Reply #5 - Posted 2005-12-12 13:58:49 »

You can do it in SPGL with another thread if you like but as you've noticed from the applet framework the splash screen is synchronous and just uses a callback to paint the progress bar Wink

Cas Smiley

Offline g666

Junior Member





« Reply #6 - Posted 2005-12-12 22:01:14 »

I guess loading while displaying an animation would be pointless as it would just make the loading slower. although if stuff could be loaded while the menu screen is showing then that could get rid of menu-game load times.

desperately seeking sanity
Offline princec
« League of Dukes »

JGO Kernel


Medals: 196
Projects: 3


Eh? Who? What? ... Me?


« Reply #7 - Posted 2005-12-13 00:19:22 »

Well, it has it's place in user interface design: the user should never be left waiting for something without feedback if it's going to take more than a second or two.

Cas Smiley

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (143 views)
2013-05-17 21:29:12

alaslipknot (151 views)
2013-05-16 21:24:48

gouessej (182 views)
2013-05-16 00:53:38

gouessej (175 views)
2013-05-16 00:17:58

theagentd (186 views)
2013-05-15 15:01:13

theagentd (171 views)
2013-05-15 15:00:54

StreetDoggy (214 views)
2013-05-14 15:56:26

kutucuk (239 views)
2013-05-12 17:10:36

kutucuk (237 views)
2013-05-12 15:36:09

UnluckyDevil (243 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.155 seconds with 20 queries.