Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (763)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (852)
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 (489 views)
2018-06-10 19:43:48

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

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

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

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

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

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

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

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

Solater (559 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
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!