Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
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  
  JOGL swapBuffer / flush  (Read 3224 times)
0 Members and 1 Guest are viewing this topic.
Offline DavidYazel

Junior Member




Java games rock!


« Posted 2003-07-16 11:48:40 »

I did have a question though regarding JOGL.  I know that in LWJGL that the flush takes a long time.  So basically you can send all the commands to the card but when you call flush there is this long pause while it actually finishes rendering.  It seems like the request to draw the Drawable and the resulting callback to the event listener does not return until the flush is complete.

Is there anyway I can have the flush operate on another thread so that I can be building the next frame?  I would need to have some way to detect that the frame was actually done before I start to render the next one, but I think this would be a valuable peice of parallalism.

I have not confirmed the time delta between exiting the draw callback and returning from the call to Drawable draw, but I suspect it is a significant period of time.

David Yazel
Xith3D Project Founder
http://xith3d.dev.java.net

It may look complicated, but in the end it is just a bunch of triangles
Offline DavidYazel

Junior Member




Java games rock!


« Reply #1 - Posted 2003-07-17 17:19:08 »

I am bumping this to the top.

Any ideas?

David Yazel
Xith3D Project Founder
http://xith3d.dev.java.net

It may look complicated, but in the end it is just a bunch of triangles
Offline elias

Senior Member





« Reply #2 - Posted 2003-07-17 18:09:39 »

You might be confusing a glFlush, which simply makes the OGL driver dump it's outstanding OGL commands to the card, witha buffer swap that flips the back buffer to the front.

The buffer swap will wait for all outstanding OGL commands to complete before flipping the buffers, making sure that a complete buffer is shown on the monitor.

So ,waht does this mean to you? Simple, you _can't_ render the next frame without the previous being finished. However, you can do the non-rendering work if you like. You'd simply order your render loop work like this:

Render frame x
update world state according to physics, network etc for frame x + 1
swap buffers
render frame x + 1
...

Now, I may have completely missed your question, because I'm writing this out of LWJGL knowledge. Maybe you really wanted some way to work around a jogl limitation?

- elias

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 #3 - Posted 2003-07-17 20:20:07 »

I will just point out that it is interesting that you make an assumption that its a limitation in JOGL that David is seeking to resolve.

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 elias

Senior Member





« Reply #4 - Posted 2003-07-18 04:10:17 »

Sorry about that. It stems from me hearing about jogl's implicit buffer swap, which could very well be a limitation to the loop order I proposed.

- elias

Offline ckline

Senior Newbie





« Reply #5 - Posted 2003-07-18 12:11:48 »

Quote
I know that in LWJGL that the flush takes a long time.  So basically you can send all the commands to the card but when you call flush there is this long pause while it actually finishes rendering.  It seems like the request to draw the Drawable and the resulting callback to the event listener does not return until the flush is complete.


As another person mentioned, there is a difference between and explicit glFlush(), an explicit glFinish(), and an implicit finish caused by a buffer swap.

In general, glFlush() is a bad thing because it forces the driver to finish executing all glCommands before returning control to the caller. When using glFinish() or doing a buffer swap (which JOGL does internally at the end of each frame), it merely tells the graphics driver to begin processing commands and then returns control back to the user. This facilitates parallelism by allowing your app to continue processing while the card is busy flushing queued events.

So, in general, if you're using JOGL you neither have to nor need to do make calls to glFlush(), glFinish(), or SwapBuffers(HDC). Calling glFlush() explicity shouldn't cause any harm, but it will certainly kill your performance.

-chris
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 (16 views)
2014-08-28 18:26:30

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

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

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

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

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

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

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

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

BurntPizza (34 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!