active rendering with AWTGLRenderer

Started by raft, July 22, 2005, 07:59:44 PM

Previous topic - Next topic

raft

hi,

how can one do active rendering with AWTGLRenderer. such an animation loop doesnt cause Canvas to be painted immediately

Canvas canvas = frameBuffer.enableGLCanvasRenderer(IRenderer.MODE_OPENGL);
//..
while(running) {
   world.renderScene(frameBuffer);
   world.draw(frameBuffer);
   //..
   canvas.repaint(); // this wont make the canvas to be painted immediately, but later
}

if canvas.repaint() is replaced with

canvas.paint(someGraphics);

this also fails since animation loop doesnt run in AWT-Thread's context. If we run these in AWT-Thread then we block the AWT-Thread and cause AWT and Swing events not to be dispatched. i looked for a method to dispatch all waiting AWT events and return but couldnt find.

so what is the solution ? i'm missing something i guess

and one more thing: although GLCanvasRenderer initializes fine on my box, OpenGL renderer doesnt. it complains about the VideoMode. (i tried all available modes FrameBuffer.getVideoModes(..) returns) lwjgl demos also work fine. i find this strange since  both GLCanvasRenderer and OpenGL renderer uses lwgl

thx
r a f t

raft

the only solution i can think of is to use:

SwingUtilities.invokeAndWait(new Runnable() {
   public void run() {
       canvas.paint(someGraphics);
   }
});

instead of canvas.repaint(). but one can easily fall into deadlock trap and spend hours with java debugger as i did :evil:

is there any other way ?
r a f t

EgonOlsen

Quote from: "raft"and one more thing: although GLCanvasRenderer initializes fine on my box, OpenGL renderer doesnt. it complains about the VideoMode. (i tried all available modes FrameBuffer.getVideoModes(..) returns) lwjgl demos also work fine. i find this strange since  both GLCanvasRenderer and OpenGL renderer uses lwgl
I don't really know about the active rendering stuff...i *think* there isn't a good solution to that but i'm not a SWING guy, so i don't really know much about it.
About the video modes...is this still a Voodoo3 you are using? If it is, you can only do 16bit color depth and z-buffer depth. The difference between the AWTGLRenderer and the normal OpenGL renderer is, that the first one simply uses the desktop settings and the latter has to set it all explicitly. Why this doesn't work on you box...i don't know, but *if* you are talking about the V3 here, it's not wondering me either. Does it work in windowed mode?

raft

yes, it is still a Voodoo3. neither fullscreen nor windowed mode works. there is also a strange thing here, GraphicsDevice.isFullScreenSupported() returns false and hence i cant switch to fullscreen mode via GraphicsDevice. but lwjgl demos runs fine in fullscreen mode, and an attempt to enable OpenGL renderer first switches to fullscreen mode then comes back

OpenGL renderer first was complaning about DRI (direct rendering interface) wasnt enabled, so i installed mesa, set my desktop resolution to 1024x768x16 and enabled DRI. then it begun to complain about videomode.

despite my desktop color depth is 16 bits, all VideoMode's returned by FrameBuffer.getVideoModes() use a 24 bit ZBuffer depth. may this be the answer ?

i tried these in linux only. win xp supports full screen via GraphicsDevice
r a f t

EgonOlsen

All modes are reporting 24bit for the zbuffer because that's what Config says by default. LWJGL doesn't report this value any longer since version 0.idontknow, so i had to take it from Config. Try to set it to 16 or even 0 in Config before getting the video modes and see if that helps.

raft

yes, it did help. opengl renderer initializes both with 16 and 0  :D

thx
r a f t