opengl - integer currupt in glsl -


i have strange behavior in rendering process. i'm passing 32-bit unisgned integer attribute shader. vertex-shader forwards attribute flat uint fragmentshader.

in fragment shader comparison. in case send in 1u , compare 1u. doesn't generate true. instead value compared to

0x3f800000 

generates true.

so, somehow initial 32-bit value:

0000 0000 0000 0000 0000 0000 0000 0001 

has become:

0011 1111 1000 0000 0000 0000 0000 0000 

all i'm doing this:

vertex:

layout(location = 3) in uint in_index flat out uint v_index; v_index = in_index; 

fragment:

if (v_index == 0x3f800000u){discard;} 

and fragments discarded. i'm using core 330.

and way, i've used floats , shorts , work fine.

@andon m. coleman solved me!

use glvertexattribipointer (...) instead of glvertexattribpointer (...).


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -