Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (542)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (604)
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  
  jogl vs. lwjgl speed test  (Read 14244 times)
0 Members and 1 Guest are viewing this topic.
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #30 - Posted 2003-07-18 06:04:55 »

The only legal place to perform OpenGL calls is within the methods of your GLEventListener.

To state again: I'd suggest doing the heavyweight work in a worker thread and informing your rendering thread of its progress. Your application will be more cleanly separable this way. A similar approach is used in updating Swing progress bars.
Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #31 - Posted 2003-07-18 12:12:00 »

Err, but you just implied that the rendering thread (the thread that goes into GLContext and calls all GLEventListener) is the only thread that CAN perform those calls.

Defining lists for complex meshes, rendering to textures and even defining the textures cannot be done outside that thread.


I really don't understand why you can't just, say, add a swapBuffers() method, even if you only allow it to be called from within an GLEventListener call.

Play Minecraft!
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #32 - Posted 2003-07-18 13:06:38 »

The worker thread does the heavy lifting of bringing in the data from disk and the rendering thread only does the glTexture2D call, which is relatively lightweight.

We'll think about exposing swapBuffers(); please feel free to file an RFE on the JOGL Issues page. Please keep the following in mind, though: if the loading isn't separated into worker and rendering threads, you're going to get e.g. one redraw every second or so while the textures are being loaded. While this is happening, if your application window is obscured and revealed again, you're going to see damaged regions for a long period of time.

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

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #33 - Posted 2003-07-18 13:53:58 »

That's usually not an issue in fullscreen games.

I really don't want to make a singlethreaded game multithreaded just to work around an artificial restriction.
I'll file the RFE now.

Play Minecraft!
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #34 - Posted 2003-07-18 14:59:37 »

Resource loading is usually best done in another thread anyway.  Your main game loop can remain single threaded.

Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #35 - Posted 2003-07-18 15:25:58 »

The point is that the decision to make it multithreaded should be mine to make. There's no point at all in Jogl not exposing the swapBuffers() call.

It's really weird as it is now, as the opengl api forces you to only have one thread doing opengl commands at a time (makes sense, since opengl isn't thread safe), but forces you to use several threads if you want to have progress information.

Play Minecraft!
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #36 - Posted 2003-07-18 17:18:35 »

Can you do something like this in your rendering function?

1  
2  
3  
4  
5  
6  
7  
if( resource < numResources)
{
   loadResource( resource++ );
   // *** GL calls to advance the progressbar ***
}

// JOGL will swap buffers here

Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #37 - Posted 2003-07-18 18:35:44 »

Not exactly like that, since I'm both loading normal textures, defining dynamic textures, building lists, and (when jogl supports it) building and filling vertex buffer objects.

I was considering adding an elaborate scheme of a list of Runnables, but then realized how much of an overkill that was for a very simple task with a very simple solution. Wink

/me puts on zealot suit

Play Minecraft!
Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #38 - Posted 2003-07-18 18:36:14 »

Hey, cool, this is the first BBS I've ever seen that supports CTCP ACTION. =D

Play Minecraft!
Offline AndersDahlberg

Junior Devvie





« Reply #39 - Posted 2003-07-18 18:56:36 »

/me is happy now when the "old" forums are back!

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

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #40 - Posted 2003-07-18 20:23:07 »

What is "CTCP ACTION" and how do I do it ?

Yeah - I was oversimplifying the resource loading. although there is probably an easy Oo way to do something similar to SwingUtilities invokeLater or invokeAndWait.. I guess that is what you were getting at with the Runnables.  I don't think it has to be messy though. If you have objects that manage differnt aspect of the resource creation - dump them all in a list/array whatever and process that list where GL calls are allowed.

I don't mean to be arguing the point though, cause it seem that the swapBuffers call would be simple enough to add, and relatively harmless..  I'm not an OpenGL program yet so I shouldn't even be talking Smiley

Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #41 - Posted 2003-07-18 20:31:41 »

Long version:

CTCP ACTION is a "hack" in the irc protocol to allow for emotes.

Normally, CTCP (client-to-client-protocol) commands are sent as privmsgs to clients, and usually require a notice back, like CTCP TIME and CTCP PING <number>.
CTCP ACTION is a special CTCP command that's usually sent to channels instead of other clients, and doesn't require a return value.
The clients then display that as an emote. a CTCP ACTION "freaks out" from MonkeyBoy would usually be displayed as "** MonkeyBoy freaks out"

To send a CTCP ACTION (or emote) in most irc clients, you just enter "/ me jumps around" (without the space between / and me) in the desired room, but entering "/ctcp #room ACTION jumps around" usually works as well.


Short version:

Type "/ me freaks out", without the space between the "/" and the "me".  Wink


[edit: "client-to-client-commands"? heh]

Play Minecraft!
Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #42 - Posted 2003-07-18 20:35:39 »

Oh, and a CTCP is just a privmsg (if it's a request) or a notice (if it's a reply) surrounded by (char)1.. So you could even go "/privmsg #room ^AACTION jumps around^A" if you wanted to. Wink

Play Minecraft!
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #43 - Posted 2003-07-19 00:09:27 »

/me gets it now.

Offline gregorypierce

Senior Devvie




I come upon thee like the blue screen of death....


« Reply #44 - Posted 2003-07-19 12:55:06 »

Well I haven't yet seen the restriction of not having swapBuffers(). The newbie tutorial on texturing (not that you're a newbie) is finally ready. Once I push that out I will see how I would solve your specific problem.

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 Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #45 - Posted 2003-07-19 13:09:55 »

Isn't the argument that all other opengl implementations have a manual swapbuffers good enough?

Even jogl has it, but for some reason, it's not available.
Exposing it would solve a very simple problem with a very simple solution instead of forcing the developers to build an overly complicated framework just for doing a very simple procedural load and repaint method.


I KNOW it's possible to work around it, but I'm saying I shouldn't have to.

Play Minecraft!
8: Undefined index: online
File: /home/jgo/public_html/Themes/default/Display.template.php (main sub template - eval?)
Line: 161