Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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.

share|improve this question

closed as off topic by rjzii, Mark Trapp, Jim G., Walter, Yusubov Oct 4 '12 at 20:53

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

1 Answer

up vote 4 down vote accepted

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.

share|improve this answer
    
I do now know how I could miss that. That book seems to be precisely what I've been looking for this entire time. –  Cubic Sep 27 '12 at 18:11
    
@Cubic: Yeah, it's very useful. :) –  Mason Wheeler Sep 27 '12 at 18:17
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.