Author Topic: Access canvas in GLCanvasRender from LWJGL  (Read 2678 times)

Offline ErDetEnAnd?

  • int
  • **
  • Posts: 87
    • View Profile
Access canvas in GLCanvasRender from LWJGL
« on: September 28, 2008, 10:06:25 pm »
Hello!

I need to paint on the canvas after it has been painted in lwjgl (when the canvas has been displayed and repainted from jpct). Does anyone have any ideas?

 - Lwjgl suggests that one overrides the paint/paintGL method, but since the JPCT render gives the canvas this approach is not possible.

Thanks in advance.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Access canvas in GLCanvasRender from LWJGL
« Reply #1 on: September 29, 2008, 12:00:10 am »
You want to paint some GL related stuff to that canvas or some AWT stuff?

Offline ErDetEnAnd?

  • int
  • **
  • Posts: 87
    • View Profile
Re: Access canvas in GLCanvasRender from LWJGL
« Reply #2 on: September 29, 2008, 04:32:50 pm »
Some AWT/Swing.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Access canvas in GLCanvasRender from LWJGL
« Reply #3 on: September 29, 2008, 04:46:41 pm »
I'm not sure how well it works to combine them on one canvas...anyway, you can use an IPaintListener to execute your code in the AWT event thread: http://www.jpct.net/doc/com/threed/jpct/IPaintListener.html

Offline ErDetEnAnd?

  • int
  • **
  • Posts: 87
    • View Profile
Re: Access canvas in GLCanvasRender from LWJGL
« Reply #4 on: September 30, 2008, 09:19:46 pm »
Drawing on canvas in IPaintListener.finishedPainting() using the graphics from the canvas, doesn't have any effect. However, using another canvas is sufficient.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Access canvas in GLCanvasRender from LWJGL
« Reply #5 on: September 30, 2008, 10:30:23 pm »
Drawing on canvas in IPaintListener.finishedPainting() using the graphics from the canvas, doesn't have any effect. However, using another canvas is sufficient.
Fine. I'm not sure if it is supposed to work to paint into the GLRenderers graphics context...my uneducated guess would be, that it isn't.