Andrei R.
Andrei R.

Reputation: 2462

GLSL: Passing char array to fragment shader

I have an unsigned char[4096][4096] array with intensity values, and I want to pass them properly to fragment shader.
Though it seems I need glVertexAttribPointer() (guess it is because I need data in fragment, not vertex shader) or glTexImage2D() with type = GL_UNSIGNED_BYTE, I couldn't achieve desired results.
Examples I've found did not help me either due to use of float/int vectors in them.

How can I access byte array data from fragment shaders?

Upvotes: 2

Views: 1688

Answers (1)

genpfault
genpfault

Reputation: 52083

GL_R8UI for glTexImage2D()'s internalFormat + texelFetch() for exact texel access in the shader.

Upvotes: 1

Related Questions