cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

realhet
Miniboss

glVertexAttribPointer() normalized byte[3] is much slower than float[3]

Hi!

I ran into a weird problem: I want to compress my normal vectors, so I converted them to signed bytes from floats.

It turned out that the FPS slows down insanely (7FPS instead of 42) when I use char[3] instead of float[3] data type.

I also tested the same thing with ANGLE project. In Direct3D the same thing works correctly: I got the same FPS with reduced memory usage.

I do it with VBO's. What do I do wrong? o.O

Is the GL_BYTE, tupleSize:3, Normalized=true thing bad on OpenGL? If so, is there a solution to this?

Thank You!

0 Likes
1 Solution
nou
Exemplar

Try use byte[4]. GPU can have problems with read/write which are not aligned at least to 4 bytes.

View solution in original post

0 Likes
2 Replies
nou
Exemplar

Try use byte[4]. GPU can have problems with read/write which are not aligned at least to 4 bytes.

0 Likes

This 32bit align was it, thx!

I've tried byte[2], and byte[1] too: they'r bad also.

Only byte[4] and GL_INT_10_10_10_2 worked perfectly.

So from now I'll mix the vertex data with the normals, and compress them onto short[4]. Hope that will do fine on any kind of hardware.

0 Likes