Author Topic: shared shader but unshared uniform parameter?  (Read 1706 times)

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
shared shader but unshared uniform parameter?
« on: June 05, 2017, 08:31:36 am »
http://www.jpct.net/forum2/index.php/topic,3965.msg27866.html#msg27866

i search the forum and found the above thread and maybe it's the same question as i have.
i hope to use 1 shader instance for multiple objects but their uniform parameters are different.
is the solution in the above thread the only solution?
is it more troublesome than using 1 shader for each object? is it worth the trouble?

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
Re: shared shader but unshared uniform parameter?
« Reply #1 on: June 06, 2017, 06:50:56 am »
i found that it's not too much trouble.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: shared shader but unshared uniform parameter?
« Reply #2 on: June 06, 2017, 07:42:29 am »
You can use an http://www.jpct.net/jpct-ae/doc/com/threed/jpct/IRenderHook.html implementation und override the setCurrentShader() method in that one.