Struggling to understand why I'm getting an error

I don’t think analogies are really helpful.

A uniform variable has the same value for every shader invocation resulting from a given draw call. They can be accessed from any shader stage (vertex, fragment, geometry, etc) in the program. You set the value with glUniform. Uniform variables are stored in the program object (this can be an issue if you’re using the same program from multiple threads).

There are also uniform blocks, which behave like a uniform variable of structure type, but the data is stored in a buffer object rather than in the program object. There are no specific calls to set the values; you just modify the buffer’s contents using e.g. glBufferSubData or glMapBuffer etc. This avoids the issue with multi-threading, and also allows you to change the values of all of the variables in one go by binding a different buffer object.

An input variable may have different values for different shader invocations. Vertex shader inputs take their values either from attribute arrays (glVertexAttribPointer) or if the attribute array is disabled (gl{Enable,Disable}VertexAttribArray) from a constant value set with glVertexAttrib. Fragment shader inputs get their values from the vertex shader outputs (assuming that no other stages are present), either by interpolating the values across the primitive or (if the variable has the flat qualifier) by using the value from one of the vertices for all fragments in the primitive.

Kinda sounds the same as what I said just a little further into the global space with the uniforms, anyways do you know of any good examples of passing in the vertices of multiple objects? I’m thinking of just normalising every object to it’s own space then mulitplying their heights and widths by the difference between their z axis and the users position, then multplying all the points against the result to get their relative positions before finally adding those positions to the player’s x & y values. While I could get the simple triangle up and running (and a view cone in an improperly setup environment) I’m struggling to setup & update multiple vertex arrays (the update part is because I’m testing new code and it’s easier to test it on the CPU than to deal with the GPU that I’m inexperienced with)

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.