1

I'm trying to have something like an integer array uniform for my fragment shader (I only need read access). Since it's a fairly large chunk of data (not so large that uploading it in every frame would be impossible, but enough to make me want to rather not do it). Essentially I want to just pass it a uniform telling the shader where this "array" is. I believe I can use a 1D texture for this, but I don't know how (actually, I don't know how to do many things because I just can't seem to find a reference for GLSL 3.3, I only ever find references for the C API).

This sounds like a rather basic question and I'm sure it's been answered already somewhere, but I keep searching and can't quite find what I'm looking for.

1 Answer 1

4

Have a look at this OpenGL tutorial. The chapter on textures explains how to do exactly what you're looking for--deal with a texture as specifically an array of numeric values instead of as graphical data--but the whole thing is worth reading.

2
  • I do now know how I could miss that. That book seems to be precisely what I've been looking for this entire time. Commented Sep 27, 2012 at 18:11
  • @Cubic: Yeah, it's very useful. :) Commented Sep 27, 2012 at 18:17

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.