Author Topic: Drawing a Graphic on a Separate Thread  (Read 3541 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Drawing a Graphic on a Separate Thread
« on: February 01, 2018, 03:35:33 am »
Hardware renderer in (lwjgl's frame) fullscreen throws a RuntimeException ("No OpenGL context found in the current thread."). I created a WorldProcessor with two threads as well as tried it the lwjgl way (GLContext.useContext()). Neither worked.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Drawing a Graphic on a Separate Thread
« Reply #1 on: February 01, 2018, 09:31:01 am »
Why would you want to do that? The GPU has to serialize the rendering anyway...

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Drawing a Graphic on a Separate Thread
« Reply #2 on: February 01, 2018, 05:34:44 pm »
It's a pre-splash graphic that's meant to run while the game is loading. Load time is as much as 20 seconds and I don't want a black or even just a static screen for that long.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Drawing a Graphic on a Separate Thread
« Reply #3 on: February 02, 2018, 09:35:50 pm »
So, do you have a response?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Drawing a Graphic on a Separate Thread
« Reply #4 on: February 05, 2018, 09:44:18 am »
Then why don't you do the loading in a different thread and let the main thread render the splash screen? That's what I'm doing in Naroth as well.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Drawing a Graphic on a Separate Thread
« Reply #5 on: February 06, 2018, 06:36:09 pm »
That makes sense, thanks.