Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (492)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
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  
  Animator object utilizes all CPU  (Read 3903 times)
0 Members and 1 Guest are viewing this topic.
Offline OlegM

Senior Newbie




Java games rock!


« Posted 2004-11-15 23:01:42 »

When I run the sample from "Getting started with JOGL", the window appears and everything is drawn, but my system almost freezes - 100% cpu consumed. What are possible solutions to the problem?

Thanks in advance.
Offline OlegM

Senior Newbie




Java games rock!


« Reply #1 - Posted 2004-11-16 00:44:46 »

Please help! I'm new to jogl, and have absolutely no idea how to fix the problem.

My video card - Ati FireGL 8800.

program output:
Using ATI workaround of dispatching display() on event thread
Using ATI workaround of dispatching display() on event thread

Thanks.
Offline nnevatie

Junior Member




It is slightly better to be simple than correct.


« Reply #2 - Posted 2004-11-16 04:55:17 »

That's a known problem of the Animator class - it uses all CPU time because it basically renders at the full speed, without sleeps in the thread. You can use the following class to overcome the problem. I've created it for my own projects and I've been happy with the results. Pass the GLDrawable and the desired frame rate in the constructor (e.g. 50) and you're ready to go. This class requires JDK1.5 to compile.


[CODE]
import net.java.games.jogl.GLDrawable;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;


public class Renderer
   implements Runnable
{
   private GLDrawable                  glDrawable;
   private ScheduledExecutorService    scheduler;
   private boolean                     threadSet;
   private float                       framesPerSecond;




   public Renderer(GLDrawable glDrawable, float framesPerSecond)
   {
this.glDrawable = glDrawable;
       this.framesPerSecond = framesPerSecond;
   }

   public void start()
   {
       if (scheduler != null) stop();
       scheduler = Executors.newScheduledThreadPool(1, new RendererThreadFactory());
       scheduler.scheduleAtFixedRate(this, 0, (int) (1000.0f / framesPerSecond), TimeUnit.MILLISECONDS);
   }

   public void stop()
   {
       if (scheduler == null) return;
       scheduler.shutdown();
       scheduler = null;
   }

   /**
    * Render a single frame
    *
    */
   public void run()
   {
       if (!threadSet)
       {
           glDrawable.setRenderingThread(Thread.currentThread());
           threadSet = true;
       }
       try
       {
           glDrawable.display();
       }
       catch (Throwable t)
       {
           System.err.println("Throwable thrown during display:");
           t.printStackTrace();
       }
   }
}

class RendererThreadFactory
   implements ThreadFactory
{
   public Thread newThread(Runnable runnable)
   {
       Thread thread = new Thread(runnable);
       thread.setDaemon(false);
       thread.setPriority(Thread.NORM_PRIORITY);
       return thread;
   }
}
[/CODE]

ps. Sorry about the indentations of the code, which are propably a bit messed up.

Awards:
- Nobel Prize in Physics for inventing his Doomsday Machine
- Nobel Peace Prize for not using it

http://www.g0dmode.com -- a collection of things not real
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline OlegM

Senior Newbie




Java games rock!


« Reply #3 - Posted 2004-11-17 01:27:25 »

Thank you.

Unfortunately, the problem has transformed: now nothing appears on the screen at all (window is not shown), despite
the thread is working (run() method is executed repeatedly)

Here is my code (what am I doing wrong?)

import net.java.games.jogl.GLCanvas;
import net.java.games.jogl.GLDrawableFactory;
import net.java.games.jogl.GLCapabilities;
import net.java.games.jogl.Animator;

import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;

public class Main
{
   public static void main(String args[])
   {
       try
       {
           JFrame testFrame = new JFrame("TestFrame");
           testFrame.setSize( 512, 384 );

           GLCapabilities glCaps = new GLCapabilities();
           glCaps.setRedBits(8);
           glCaps.setBlueBits(8);
           glCaps.setGreenBits(8);
           glCaps.setAlphaBits(8);
           GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(glCaps);

           testFrame.getContentPane().setLayout(new BorderLayout());
           testFrame.getContentPane().add(canvas, BorderLayout.CENTER);

           //TestRenderer draws triangle
           canvas.addGLEventListener(new TestRenderer());

//            final Animator animator = new Animator(canvas);
           final Renderer renderer = new Renderer(canvas, 50);

           testFrame.addWindowListener(new WindowAdapter()
           {
               public void windowClosing(WindowEvent e)
               {
//                    animator.stop();
                   renderer.stop();
                   System.exit(0);
               }
           });
           testFrame.setVisible(true);
//            animator.start();
           renderer.start();
       }
       catch(Exception e)
       {
           e.printStackTrace();
       }
   }
}

I used also Frame and frame.show() with the same result, so my change to JFrame should not be the reason of the problem.

Thanks.
Offline nnevatie

Junior Member




It is slightly better to be simple than correct.


« Reply #4 - Posted 2004-11-17 08:43:59 »

Quote

Unfortunately, the problem has transformed: now nothing appears on the screen at all (window is not shown), despite
the thread is working (run() method is executed repeatedly)


That is really odd. I copy-pasted your code and tested to run it and it worked nicely for me. I'm using an ATI Radeon 9600 card with WinXP. Which HW/SW platform are you developing on?

Also, it seems that the Animator class uses an NVidia specific workaround (GLCanvas has a method willSetRenderingThread), which is not accessible outside the JOGL's internal package. Does anyone know, if this is a required thing for NVidia cards?

Cheers

Awards:
- Nobel Prize in Physics for inventing his Doomsday Machine
- Nobel Peace Prize for not using it

http://www.g0dmode.com -- a collection of things not real
Offline OlegM

Senior Newbie




Java games rock!


« Reply #5 - Posted 2004-11-17 13:42:34 »

Hello,

I'm using WinXP and ATI Fire GL 8800
Offline Corysia

Senior Newbie





« Reply #6 - Posted 2004-11-17 15:32:56 »

Query your GL strings and see which renderer you're using.  If it comes up with Microsoft, you're not getting hardware acceleration.
Offline OlegM

Senior Newbie




Java games rock!


« Reply #7 - Posted 2004-11-17 16:04:34 »

Could you please clarify what should I do?

"Query your GL strings and see which renderer you're using. "- how can I check it?

Also, "...you're not getting hardware acceleration" - but as I understand, OpenGL provides hardware acceleration, Microsoft or not - it doesn't matter.  (Am I wrong?)

sorry for stupid questions
Offline Corysia

Senior Newbie





« Reply #8 - Posted 2004-11-17 16:18:40 »

The Installable Client Driver (ICD) provides the hardware acceleration, not OpenGL itself.  OpenGL knows nothing about your hardware specifics, so it's up to the driver to do the work.

Add this into a test app:

1  
2  
3  
4  
System.out.println("OPENGL DRIVER INFORMATION");
System.out.println(" Version: " + gl.glGetString(GL.GL_VERSION));
System.out.println("Renderer: " + gl.glGetString(GL.GL_RENDERER));
System.out.println("  Vendor: " + gl.glGetString(GL.GL_VENDOR));


Under WinXP, if you get "Microsoft", you're getting the generic (non-accelerated) driver.  You want your card vendor's driver.

Another app that'll let you view the capabilities of your card is called PixelFormatEnumerator.  It will show you the different modes your card is capable of and in which modes you'll get acceleration.

Under *NIX, glxinfo will give you similar information.
Offline OlegM

Senior Newbie




Java games rock!


« Reply #9 - Posted 2004-11-17 16:51:46 »

OPENGL DRIVER INFORMATION
Version: 1.3.4650
Renderer: Fire GL 8x00/Fire GL E1 DDR Pentium 4 (SSE2)
Vendor: ATI Technologies Inc.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline OlegM

Senior Newbie




Java games rock!


« Reply #10 - Posted 2004-11-17 17:02:47 »

and opengl hardware acceleration in video card settings is on
Offline nnevatie

Junior Member




It is slightly better to be simple than correct.


« Reply #11 - Posted 2004-11-18 13:14:33 »

Does your program work correctly if you remove the renderer?

Awards:
- Nobel Prize in Physics for inventing his Doomsday Machine
- Nobel Peace Prize for not using it

http://www.g0dmode.com -- a collection of things not real
Offline OlegM

Senior Newbie




Java games rock!


« Reply #12 - Posted 2004-11-18 14:40:21 »

If I use the Animator object, programs works (not correctly, because it consumes all cpu), but at least i see the window with the triangle. If i use Renderer, nothing is shown at all - i'm in despair right now, and thinking of going back to c++, though i don't like it.
Offline nnevatie

Junior Member




It is slightly better to be simple than correct.


« Reply #13 - Posted 2004-11-18 20:42:00 »

Quote
If I use the Animator object, programs works (not correctly, because it consumes all cpu), but at least i see the window with the triangle. If i use Renderer, nothing is shown at all - i'm in despair right now, and thinking of going back to c++, though i don't like it.


No need to go back to c++ because of this Wink. I checked the Animator source once again and I noticed that it calls setNoAutoRedrawMode(true) on the GLDrawable. Can you try to call that on the GLCanvas after it is created. Does this make a difference when using the Renderer class?

Edit: Here's a new version of the Renderer class, which should be more compliant with the Animator class. Can you test it and see if it fixes your problem?:

[CODE]
import net.java.games.jogl.GLDrawable;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;


public class Renderer
   implements Runnable
{
   private GLDrawable                  glDrawable;
   private ScheduledExecutorService    scheduler;
   private boolean                     threadSet;
   private float                       framesPerSecond;




   public Renderer(GLDrawable glDrawable, float framesPerSecond)
   {
       this.glDrawable = glDrawable;
       this.framesPerSecond = framesPerSecond;
   }

   public void start()
   {
       glDrawable.setNoAutoRedrawMode(true);
       if (isRunning()) stop();
       scheduler = Executors.newScheduledThreadPool(1, new RendererThreadFactory());
       scheduler.scheduleAtFixedRate(this, 0, (int) (1000.0f / framesPerSecond), TimeUnit.MILLISECONDS);
   }

   public void stop()
   {
       if (!isRunning()) return;
       scheduler.shutdown();
       scheduler = null;
       glDrawable.setNoAutoRedrawMode(false);
   }

   public boolean isRunning()
   {
       return scheduler != null;
   }

   /**
    * Render a single frame
    *
    */
   public void run()
   {
       if (!threadSet)
       {
           glDrawable.setRenderingThread(Thread.currentThread());
           threadSet = true;
       }
       // XXX: Catch for debug only
       try
       {
           glDrawable.display();
       }
       catch (Throwable t)
       {
           System.out.println("Throwable thrown during display:");
           t.printStackTrace();
           System.exit(1);
       }
   }
}

class RendererThreadFactory
   implements ThreadFactory
{
   public Thread newThread(Runnable runnable)
   {
       Thread thread = new Thread(runnable);
       thread.setDaemon(false);
       thread.setPriority(Thread.NORM_PRIORITY);
       return thread;
   }
}
[/CODE]


Awards:
- Nobel Prize in Physics for inventing his Doomsday Machine
- Nobel Peace Prize for not using it

http://www.g0dmode.com -- a collection of things not real
Offline OlegM

Senior Newbie




Java games rock!


« Reply #14 - Posted 2004-11-18 22:47:01 »

Thanks a lot!

setNoAutoRedrawMode(true) helps, but....
still some questions

window appears, everything is drawn, cpu is not consumed, but
1. I cannot move the window (and close, and do anything with it)
2. If I switch to another application, and then go back, only glDrawable is redrawn - frame title bar and frame borders disappear, and, what is worse and suprising - cpu starts being used 100%

Thank you very much for your help, but if you can help with above problems, it'll be great - I still cannot use jogl because of them.
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #15 - Posted 2004-11-18 23:00:49 »

Have you tried passing the argument -Dsun.java2d.noddraw=true on the Java command line? Some of the problems you're reporting sound like driver-level issues.
Offline OlegM

Senior Newbie




Java games rock!


« Reply #16 - Posted 2004-11-18 23:20:46 »

Yes, tried, but if didn't help. I also tried with different versions of drivers, but it didn't help also. We can see now that ATI Fire GL 8800 is not a best choice if you want to work with Jogl Smiley Hope that buying other card is not the only solution for the problem.

Thank you.
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #17 - Posted 2004-11-19 00:24:39 »

When you get some of the bad behavior where it isn't clear what's happening, could you use Ctrl-Break to get a thread dump and post the results? Maybe the system is stuck somewhere non-obvious.
Offline OlegM

Senior Newbie




Java games rock!


« Reply #18 - Posted 2004-11-19 01:19:48 »

just after i switch to other application and go back, the program starts using 100% cpu, here is the dump:

Full thread dump Java HotSpot(TM) Client VM (1.5.0-b64 mixed mode, sharing):

"Thread-4" prio=5 tid=0x02f37a18 nid=0xe70 runnable [0x034ef000..0x034efb68]
       at net.java.games.jogl.impl.windows.WGL.NativeEventLoop(Native Method)
       at net.java.games.jogl.impl.windows.WindowsGLContextFactory$NativeWindowThread.run(WindowsGLContextFactory.java:
270)

"DestroyJavaVM" prio=5 tid=0x00036958 nid=0xbfc waiting on condition [0x00000000..0x0007fae8]

"Thread-3" prio=5 tid=0x02efd590 nid=0xcf4 in Object.wait() [0x034af000..0x034afbe8]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x22abb8d0> (a java.awt.EventQueue$1AWTInvocationLock)
       at java.lang.Object.wait(Object.java:474)
       at java.awt.EventQueue.invokeAndWait(EventQueue.java:846)
       - locked <0x22abb8d0> (a java.awt.EventQueue$1AWTInvocationLock)
       at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:203)
       at net.java.games.jogl.GLCanvas.display(GLCanvas.java:75)
       at Renderer.run(Renderer.java:62)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
       at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
       at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.j
ava:65)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.
java:142)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166
)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)

"AWT-EventQueue-0" prio=7 tid=0x02f3d170 nid=0xe44 runnable [0x0346f000..0x0346fc68]
       at net.java.games.jogl.impl.windows.WGL.wglMakeCurrent(Native Method)
       at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLContext.java:142)
       - locked <0x22fff020> (a net.java.games.jogl.impl.windows.WindowsOnscreenGLContext)
       at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent(WindowsOnscreenGLContext.java:110)
       - locked <0x22fff020> (a net.java.games.jogl.impl.windows.WindowsOnscreenGLContext)
       at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:254)
       - locked <0x22fff020> (a net.java.games.jogl.impl.windows.WindowsOnscreenGLContext)
       at net.java.games.jogl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:238)
       at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
       at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
       at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
       at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
       at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

"AWT-Windows" daemon prio=7 tid=0x00a9af28 nid=0xc24 runnable [0x0333f000..0x0333fce8]
       at sun.awt.windows.WToolkit.eventLoop(Native Method)
       at sun.awt.windows.WToolkit.run(WToolkit.java:269)
       at java.lang.Thread.run(Thread.java:595)

"AWT-Shutdown" prio=5 tid=0x00a9abd8 nid=0x5a4 in Object.wait() [0x032ff000..0x032ffd68]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x22fe2ec8> (a java.lang.Object)
       at java.lang.Object.wait(Object.java:474)
       at sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:259)
       - locked <0x22fe2ec8> (a java.lang.Object)
       at java.lang.Thread.run(Thread.java:595)

"Java2D Disposer" daemon prio=10 tid=0x00acbf90 nid=0xd20 in Object.wait() [0x032bf000..0x032bf9e8]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x22fe2f50> (a java.lang.ref.ReferenceQueue$Lock)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
       - locked <0x22fe2f50> (a java.lang.ref.ReferenceQueue$Lock)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
       at sun.java2d.Disposer.run(Disposer.java:107)
       at java.lang.Thread.run(Thread.java:595)

"Low Memory Detector" daemon prio=5 tid=0x00a6c7f0 nid=0xdd0 runnable [0x00000000..0x00000000]

"CompilerThread0" daemon prio=10 tid=0x00a6b3c8 nid=0xcb4 waiting on condition [0x00000000..0x02bcf8c0]

"Signal Dispatcher" daemon prio=10 tid=0x00a6a6e0 nid=0xed8 waiting on condition [0x00000000..0x00000000]

"Finalizer" daemon prio=9 tid=0x00a67a58 nid=0xc4c in Object.wait() [0x02b4f000..0x02b4fc68]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x22f79228> (a java.lang.ref.ReferenceQueue$Lock)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
       - locked <0x22f79228> (a java.lang.ref.ReferenceQueue$Lock)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
       at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x00a66578 nid=0xe40 in Object.wait() [0x02b0f000..0x02b0fce8]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x22f792a8> (a java.lang.ref.Reference$Lock)
       at java.lang.Object.wait(Object.java:474)
       at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
       - locked <0x22f792a8> (a java.lang.ref.Reference$Lock)

"VM Thread" prio=10 tid=0x00a63cd8 nid=0xed4 runnable

"VM Periodic Task Thread" prio=10 tid=0x00a6da00 nid=0xdd4 waiting on condition
Offline nnevatie

Junior Member




It is slightly better to be simple than correct.


« Reply #19 - Posted 2004-11-19 08:42:29 »

I would place my bet on:

"AWT-EventQueue-0" prio=7 tid=0x02f3d170 nid=0xe44 runnable [0x0346f000..0x0346fc68]
  at net.java.games.jogl.impl.windows.WGL.wglMakeCurrent(Native Method)

Smiley

Awards:
- Nobel Prize in Physics for inventing his Doomsday Machine
- Nobel Peace Prize for not using it

http://www.g0dmode.com -- a collection of things not real
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #20 - Posted 2004-11-19 12:50:55 »

Try putting -DATI_WORKAROUND=false on the command line.
Offline OlegM

Senior Newbie




Java games rock!


« Reply #21 - Posted 2004-11-19 18:19:45 »

It did not change anything. Also, when stopping the program with ctrl + C I encounter this exception (maybe it"ll help you)

Throwable thrown during display:
net.java.games.jogl.GLException: Error swapping buffers
       at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.swapBuffers(WindowsOnscreenGLContext.java:140)
       at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:292)
       at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:208)
       at net.java.games.jogl.GLCanvas.display(GLCanvas.java:75)
       at Renderer.run(Renderer.java:62)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
       at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
       at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.j
ava:65)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.
java:142)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166
)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #22 - Posted 2004-11-19 19:19:05 »

Try adding the following snippets of code to your application.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
// At the top of your class
import java.lang.reflect.*;


// Before you visualize the window (and definitely before you start
// the Renderer)
try {
  Method method = GLCanvas.class.getDeclaredMethod("willSetRenderingThread", new Class[] {});
  method.setAccessible(true);
  method.invoke(canvas, (Object[]) null);
} catch (Exception e) {
  e.printStackTrace();
}

Offline OlegM

Senior Newbie




Java games rock!


« Reply #23 - Posted 2004-11-19 20:30:21 »

No changes at all Sad. The only thing worth mentioning - new code has the same effect as canvas.setNoAutoRedrawMode(true); (that helped me to visualize the window the first time)
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #24 - Posted 2004-11-19 21:12:58 »

Are you running all of the following?

  • the snippet of new code (willSetRenderingThread())
  • setRenderingThread()
  • setNoAutoRedrawMode(true)
  • -DATI_WORKAROUND=false
  • -Dsun.java2d.noddraw=true

Basically given that you're seeing bad behavior when doing work on the AWT thread, you want to try to get work off the AWT thread and onto your animation thread. I suspect a driver bug related to multithreading; the only question is how to work around it.
Offline OlegM

Senior Newbie




Java games rock!


« Reply #25 - Posted 2004-11-19 21:39:51 »

Yes, I run everything.

Thanks for advice. Hope with your help, guys, I'll make it work sooner or later.
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #26 - Posted 2004-11-19 22:24:29 »

I don't know what other significant differences there are between JOGL's Animator class and nnevatie's Renderer class.

What happens if you switch back to using the Animator and do a Thread.sleep() at the end of your display() method? Does the CPU consumption go down, and does your scene animate properly (instead of getting stuck in wglMakeCurrent?
Offline OlegM

Senior Newbie




Java games rock!


« Reply #27 - Posted 2004-11-19 22:42:33 »

I switched back to Animator class, and added Thread.sleep(..) to the end of my display() method.
What is happening after program starts, by steps:

1. CPU Consumption is small (as it should be), and everything is drawn ok.
2. Window is not responding - movement, etc.
3. If I switch to another application, and go back, scene is redrawn, but window border and title - not, and then cpu full consuming starts.

As you can see, behaviour is exactly the same as before.
After last changes there is no difference in work when using Animator or nnevatie's Renderer.
So, initial problem (cpu consumption) has now two solutions, but the new one (with the frame) still exists.
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #28 - Posted 2004-11-19 23:06:25 »

Have you tried -DATI_WORKAROUND=true in addition to the other command-line arguments and program changes?

Could you try running with a 1.4.2 JDK? I don't think there should have been any changes in the Windows AWT in 1.5 that could have affected behavior like this, but I do most of my testing with 1.4.2.

Are you running the latest drivers for your board?

Is your machine a multiprocessor? If so, have you tried disabling one of the CPUs in boot.ini?
Offline OlegM

Senior Newbie




Java games rock!


« Reply #29 - Posted 2004-11-19 23:10:21 »

Thanks everyone! Now it works! Suggestions were right - ATI's drivers are ....!! well, not very good. As I've written before, I experimented with different drivers (4 ATI drivers), but have forgotten to check work with default Microsoft driver. And - everything works perfectly now! I'm really sorry that I have made so much disturbance for everyone posting these endless problem messages.
The program works fine with both Animator and nnevatie's Renderer.

Thank you very much guys!

...These problems almost made me insane (I laughed hysterically after the program started working at last) Smiley

Again, thanks a lot!
Pages: [1] 2
  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.

Nickropheliac (16 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

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

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

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

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

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

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

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

BurntPizza (49 views)
2014-08-09 21:09:32
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!