Author Topic: active rendering with AWTGLRenderer  (Read 3884 times)

Offline raft

  • quad
  • ******
  • Posts: 1970
    • View Profile
    • http://www.aptalkarga.com
active rendering with AWTGLRenderer
« on: July 22, 2005, 07:59:44 pm »
hi,

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

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
Code: [Select]

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
Code: [Select]
r a f t

Offline raft

  • quad
  • ******
  • Posts: 1970
    • View Profile
    • http://www.aptalkarga.com
active rendering with AWTGLRenderer
« Reply #1 on: July 23, 2005, 05:43:26 am »
the only solution i can think of is to use:
Code: [Select]

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 ?
Code: [Select]
r a f t

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11769
    • View Profile
    • http://www.jpct.net
Re: active rendering with AWTGLRenderer
« Reply #2 on: July 23, 2005, 01:46:55 pm »
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?

Offline raft

  • quad
  • ******
  • Posts: 1970
    • View Profile
    • http://www.aptalkarga.com
active rendering with AWTGLRenderer
« Reply #3 on: July 23, 2005, 05:10:47 pm »
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
Code: [Select]
r a f t

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11769
    • View Profile
    • http://www.jpct.net
active rendering with AWTGLRenderer
« Reply #4 on: July 24, 2005, 11:51:47 am »
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.

Offline raft

  • quad
  • ******
  • Posts: 1970
    • View Profile
    • http://www.aptalkarga.com
active rendering with AWTGLRenderer
« Reply #5 on: July 24, 2005, 12:37:18 pm »
yes, it did help. opengl renderer initializes both with 16 and 0  :D

thx
Code: [Select]
r a f t