I search how can i do a sum in opengl language, for example with the command "for".... In order to program different mathematicals aplications...
OpenGL(Open Graphics Library, IIRC) is a graphics library, not a language... Maybe your thinking of C or C++(they're probably the most commonly used languages that have OpenGL implementations)?
I think he means the OpenGL shading language, ie. GLSL. You already answered your own question though: to do loops in GLSL, you use "for"... what a surprise :)
Not all cards will be able to natively do looping though. Loops with a fixed number of iterations can almost always be unrolled, and will probably work anywhere. Non fixed ones will require conditional jumps. Some chipsets will only allow conditional jumps in vertex shaders, and only the most recent chipsets allow them in fragment shaders. Many older chipsets won't allow any conditional jumps at all (and compilation of code with a variable amount of iteration loops will fail).
Not all cards will be able to natively do looping though. Loops with a fixed number of iterations can almost always be unrolled, and will probably work anywhere. Non fixed ones will require conditional jumps. Some chipsets will only allow conditional jumps in vertex shaders, and only the most recent chipsets allow them in fragment shaders. Many older chipsets won't allow any conditional jumps at all (and compilation of code with a variable amount of iteration loops will fail).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement