each particle is assigned a random value which controls the particle life span. This parameter is then multiplied by particle velocity. I guess i could precompute life span expectancy of the longest living particle before sending it to the shader, but i would like to have a solution which will work for all the different particle effects i plan to make in the future
Now that i think about it, i can deal with this by modifying the emitter interface in the application to make sure all emitters can calculate this on their own. I guess that should work.
Thanks a lot for the tip, you've been very helpful!
Is there a way to sort polygons in glsl?
hmmm
looks like there's another problem :)
here's the prototype for texture1d function:
vec4 texture1D( sampler1D, float [,float bias] )
it takes in float, not int, which suggests i would have to send in float values from 0 to 1 in my application. How can i be sure about the precision?
looks like there's another problem :)
here's the prototype for texture1d function:
vec4 texture1D( sampler1D, float [,float bias] )
it takes in float, not int, which suggests i would have to send in float values from 0 to 1 in my application. How can i be sure about the precision?
I think you want texelFetch(), not texture1D().
See the section here about "direct texel fetches"
Also you have to be really careful when sending integers as attributes, opengl sends it's attributes as floats, even if you specify the attribute type as int. (spent a week figuring out this nasty mistake before when I sent '1' as an attribute it came out as integer 1,080,000,000).
Make sure you use glVertexAttribIPointer instead of glVertexAttribPointer for integers.
See the section here about "direct texel fetches"
Also you have to be really careful when sending integers as attributes, opengl sends it's attributes as floats, even if you specify the attribute type as int. (spent a week figuring out this nasty mistake before when I sent '1' as an attribute it came out as integer 1,080,000,000).
Make sure you use glVertexAttribIPointer instead of glVertexAttribPointer for integers.
i'm not sure if this is supported in my version of glsl (at least i can't find it in the specs). again, i'm using opengl 2.0
It might not be, not integer samples anyway. I think you need shader4 extension for integer operations in glsl.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement