Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (769)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: Flicker on: 2008-10-07 21:53:41
Fair enough.

Interestingly, your nanoTime comment might be it! I was using it because I wanted accuracy better than currentTimeMillis, but if it's an issue, maybe that's a good trade-off (no flicker for worse accuracy). Is there a better timer to use to get millisecond accuracy (not just precision) than nanoTime?


Anyway, here is the basic loop for the image presentation:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
      :
      while( !m_stop_running && stimulus_iterator.hasNext() )
      {
         TimedStimulus item = stimulus_iterator.next();

         // Load image into ByteBuffer
         //
         loadStimulus( item );
         
         // Determine how long to wait before display
         //
         // Time to present - (elapsed time since last stimulus) - (typical time to render)
         //
         sleep_time = item.getTime() +
               ( m_start - System.nanoTime() ) -
               ( m_average_image_render_time );
         
         // If we have plenty of time, then sleep until we're ready
         //
         if( sleep_time > 0 )
         {
            try
            {
               Thread.sleep( sleep_time / Constants.NANOSECONDS_PER_MILLISECOND );
            }
            catch( InterruptedException ex )
            {
               continue;
            }
         }
         
         // Skip the image if it's over 5 seconds late
         //
         else if( sleep_time < -5 * Constants.NANOSECONDS_PER_SECOND )
         {
            log.warn( "Image display late " + sleep_time + " nsec. Skipping." );
            continue;
         }
         
         // Present the stimulus
         //
         try
         {
            m_gl_canvas.display();
         }
         catch( GLException glx )
         {
            log.warn( "Error displaying image: " + glx.getLocalizedMessage() );
         }
         
      } // end loop over timed stimulus items in the task
      :



The display method looks like this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
      :
      // Draw to the buffer as RGB bytes
      // m_buffer populated in the loadImage() call in main loop
      //
      GL gl = drawable.getGL();
      gl.glPushAttrib( GL.GL_COLOR_BUFFER_BIT );
      gl.glDrawPixels( 800, 600, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, m_buffer );
      gl.glPopAttrib();
      gl.glFlush();
      :



Thanks for your help!
2  Game Development / Newbie & Debugging Questions / Flicker on: 2008-10-07 20:21:04
Hi,

I've got a JOGL project that is displaying an animated, flickering box. Unfortunately, sometimes (typically about 30 seconds into the program) the flickering stops for a second or so (it should change about every 1/8 of a second) before picking up again.


specifying -verbose:gc indicates that it isn't the garbage collection. What else could cause this? How can I check these causes?


Many thanks!
3  Java Game APIs & Engines / JOGL Development / OS Dependant Differences? on: 2008-04-30 18:54:07
Hi,

I have a simple 'slide show' program in which a new picture is displayed on a GLCanvas every n ms. I'm using the FPSAnimator class to call the display method in my GLEventListener. What I'm seeing on Windows XP is what I would expect. On OS X (10.5) I get a flickering between the front and back buffers once the second image is displayed. On openSUSE (10.2) I get just a black screen with flashes of the image when it is first shown.

I can fix the OS X problem by manually swapping the buffers (i.e. setting setAutoSwapBufferMode to false on the GLCanvas), but that doesn't appear to help things in SUSE -- it just leaves everything black.


Any suggestions on what my problem is?


Many thanks,
-C
Pages: [1]
 
EgonOlsen (1668 views)
2018-06-10 19:43:48

EgonOlsen (1705 views)
2018-06-10 19:43:44

EgonOlsen (1155 views)
2018-06-10 19:43:20

DesertCoockie (1583 views)
2018-05-13 18:23:11

nelsongames (1183 views)
2018-04-24 18:15:36

nelsongames (1707 views)
2018-04-24 18:14:32

ivj94 (2531 views)
2018-03-24 14:47:39

ivj94 (1756 views)
2018-03-24 14:46:31

ivj94 (2833 views)
2018-03-24 14:43:53

Solater (969 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
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!