Author Topic: accessing sampler2D in vertex shader  (Read 2058 times)

Offline MichaelJPCT

  • float
  • ****
  • Posts: 264
    • View Profile
accessing sampler2D in vertex shader
« on: September 06, 2020, 10:10:58 am »
hi Egon,
if i write a shader with sampler2D only in vertex shader but not in fragment shader, (other thing are similar to default shader) will jpct prepare the texture for the shader?
this is because i use pure color texture on some objects, texture color doesn't vary.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: accessing sampler2D in vertex shader
« Reply #1 on: September 07, 2020, 02:42:03 pm »
It should.

Offline AeroShark333

  • float
  • ****
  • Posts: 319
    • View Profile
Re: accessing sampler2D in vertex shader
« Reply #2 on: September 09, 2020, 04:55:02 pm »
I have tried myself and it should work (usually)...
Though I'd recommend using the 'additional color' variable you can assign to Object3D's, if you only want to use a single color.
Since not all devices allow texture access in the vertex shader stage.
However, these days I believe you can assume most devices do support it.