Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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  
  Picking causes hiccup?  (Read 1593 times)
0 Members and 1 Guest are viewing this topic.
Offline Preston

Senior Member


Medals: 4



« Posted 2003-12-04 08:09:19 »

I've implemented picking in my application and with the help of the Tutorial and Xith3d's test classes it's pretty OK.

In my scenery there are several 3d objects but just a few of them shall be pickable. So I've just set these with setPickable(..) to true (plus the root scene's branchgroup).
Whilst picking works correcty, I see a hiccup in the animation flow of my scenery if I do
1  
PickRenderResult[] res = myView.pick(canvas3d, posx, posy, 2, 2);
and one of the pickable nodes is visible in the current view. Which means if I move the camera so they aren't visible anymore the above call doesn't cause any hiccups.

(The pick() method is being called after the myView.RenderOnce() method call, no multithreading problems. The Xith3d version is the 2003-11-24_cvs community build.)

Does anybody have experienced anything similar? Or is it related to my application only? (Difficult to judge where the problem could be.)


Nota bene: Xith3DPickRenderTest runs smoothly without hiccups on the same machine.
Offline Jens

Senior Member




Java for games!


« Reply #1 - Posted 2003-12-04 09:40:33 »

When do you perform picking (for instance after a mouse click, a mouse move, ...)?

Xith3D Getting Started Guide (PDF,HTML,Source)
Offline Preston

Senior Member


Medals: 4



« Reply #2 - Posted 2003-12-04 10:30:58 »

Quote
When do you perform picking (for instance after a mouse click, a mouse move, ...)?


Well, in the main-loop-thread. The other thread, the Swing one, stores all key events/mouseclicks/mouspos. The main-thread does do basically every 1/50 seconds:
° do simulation(),
° do renderOnce()
° if stored mouseklick do picking

If the pickable 3d objects aren't in the frustum the picking doesn't cause any hiccups.
If however any pickable object is in the frustum, the same picking call does cause hiccups.

Probably I am doing something silly. Would an jnlp example help? Hardly I guess...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jens

Senior Member




Java for games!


« Reply #3 - Posted 2003-12-04 11:19:24 »

Maybe some code can help.

What you can do is to store the picking results in a class variable to avoid to much garbage collection, but actually this should not matter, if you only pick when you click the mouse. I have an app which performs picking everytime the mouse moves without hiccups.

Xith3D Getting Started Guide (PDF,HTML,Source)
Offline Preston

Senior Member


Medals: 4



« Reply #4 - Posted 2003-12-04 13:44:17 »

Quote
Maybe some code can help.

Since it's not a too small application I don't know which parts I should quote...

Quote
What you can do is to store the picking results in a class variable to avoid to much garbage collection, but actually this should not matter, if you only pick when you click the mouse.

I avoided the picking result at all by just calling the myView.pick(...) method but with no effect: still hiccup.
Maybe something is strange in my scenegraph (I remember Kev once stored an empty Shape3d or such).
However if I empty it completely there's nothing to pick. ;-)

Quote
I have an app which performs picking everytime the mouse moves without hiccups.

Does you do something different compared to the Xith3d picking tutorial example?

Would really makes me wonder: if no pickable object is in the frustum the scenery's animation is smooth as it should... I think this is strange.
Offline Yuri Vl. Gushchin

Senior Member




Speak Java!


« Reply #5 - Posted 2003-12-04 16:13:09 »

Hi,

Sorry for that, but looks like I missed this topic because of my English: I just treated hiccup as something like "lock up" or "hang up"...

OK, now back to the subject.

I guess you are using standard build of JOGL. If so, then you WILL have a flash/flicker/short pause on your animation caused by call to any picking method [the actual sympthoms depend on the graphic card and driver].

The reason for that is following: current official abd CVS versions of JOGL do not expose explicit control over SwapBuffers calls to the applications that use JOGL. For On-screen contexts, especially on Windows, JOGL explicitly calls SwapBuffers or equivalent code just after rendering of next frame finished, i.e. right after returning from GLEventListener.display(...).

Currently Xith3D picking mechanism uses OpenGL to perform picking, i.e. renders one frame in special GL_SELECT rendering mode. In this mode, no pixels are produced, but JOGL does not care about this and calls SwapBuffers anyway.

In typical configuration on Windows you have wait-for-vertical-retrace for SwapBuffers turned ON by default, so you see recognizable delay/pause/flicking (I guess you call this thing as "hiccup") because of driver is waiting for nearest VSYNC to perform nice buffer swapping.

This problem has been discussed already several times and I think I highlighted it somewhere on earlier threads of this forum. There is also discusson on this in JOGL forum: http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jogl;action=display;num=1063385846 "Vote time: RFE - Developer controlled swap buffer".

To eliminate this problem, you need modified version of JOGL (only java-side code have to be modified), a version that lets you disable automatic buffer swapping for pick rendering passes.

CanvasPeerImpl in Xith3D already contains all the neccessary code to add this functionality - there is commented out line in renderStart(...) method:

1  
        // canvas.setNoSwapBuffers(pickMode);


In my local version I have this uncommented, because of I work with modified version of JOGL, which includes this and some other minor patches from JOGL IssueZilla.

Because of this is ready and easy to add, I am just waiting for official JOGL release, which will have the functionality of disabling automatic swap buffers control, to uncomment this code and forget about this issue.

Yuri

Yuri Vl. Gushchin
JProof Group
Offline Preston

Senior Member


Medals: 4



« Reply #6 - Posted 2003-12-04 17:54:45 »

Quote

Sorry for that, but looks like I missed this topic because of my English: I just treated hiccup as something like "lock up" or "hang up"...

No problem. Could well be that "hiccup" is the utterly wrong word for what I tried to say - because I am no English man neither (those have noticed that for long).

Quote
I guess you are using standard build of JOGL.

Yes.

Quote
If so, then you WILL have a flash/flicker/short pause on your animation caused by call to any picking method [the actual sympthoms depend on the graphic card and driver].

I see. With the Detonator driver I am using, the "short pause" in the animation is well visible.

(Thanks for the good technical explanation why this effect is visible)

Quote
This problem has been discussed already several times and I think I highlighted it somewhere on earlier threads of this forum.

This time I checked the FAQ first (who maintains it? smiley), then did a search on this forum with keyword "picking" (unfortunately no regexp allowed in the search, hehe) and no result popped up... Still I could well have missed the important stuff.
The Jogl forum I didn't read during the last weeks...

Quote
To eliminate this problem, you need modified version of JOGL (only java-side code have to be modified), a version that lets you disable automatic buffer swapping for pick rendering passes.
(..)
In my local version I have this uncommented, because of I work with modified version of JOGL, which includes this and some other minor patches from JOGL IssueZilla.

Oh, I see.

Quote
Because of this is ready and easy to add, I am just waiting for official JOGL release, which will have the functionality of disabling automatic swap buffers control, to uncomment this code and forget about this issue.

Sounds perfect. If we could expect this to happen to Jogl within the next two months I'm well able to wait. Otherweise I'm going to ask (you) for a Jogl-newbie-guide to make the Jogl sources compatible with that uncommented line of code in Xith3d.

Thanks again for your help, Yuri.
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.

pw (24 views)
2014-07-24 01:59:36

Riven (22 views)
2014-07-23 21:16:32

Riven (18 views)
2014-07-23 21:07:15

Riven (21 views)
2014-07-23 20:56:16

ctomni231 (50 views)
2014-07-18 06:55:21

Zero Volt (45 views)
2014-07-17 23:47:54

danieldean (36 views)
2014-07-17 23:41:23

MustardPeter (39 views)
2014-07-16 23:30:00

Cero (54 views)
2014-07-16 00:42:17

Riven (54 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!