Question

Apple suggests using the GLubyte data type for color data on iOS, so I am trying to get this to work. The result I get is that all color components <255 are completely black, and only components of colors set to 255 really are that color.

What I am doing: -Save the color of a single object in my own Color class in GLubytes (range 0-255) -Pass the colors to the shader in a vertex attribute array with type GLubyte (still range 0-255) -In the fragment shader, use the color directly or divide components by 255, both do not work.

EDIT: this does work, the problem was somewhere else in my code.

Was it helpful?

Solution 2

This does just work fine, the problem was somewhere else in my code.

OTHER TIPS

Where does Apple recommend using GLubyte for vertex attributes? I think you have misinterpreted that hint. What you actually want to do is store those values in a 256x1 grayscale (GL_LUMINANCE) texture and pass it as a uniform to the shader. This would be indeed faster than using arrays.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top