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

Offline MichaelJPCT

  • long
  • ***
  • Posts: 215
    • 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: 12094
    • 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

  • long
  • ***
  • Posts: 243
    • 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.