Ok I will try to describe what I’m trying to do.
*Render 2d sprites using immediate mode.
*Render each game loop, send data every loop.
*Make an array of class Asset, which has basic rendering variables. x,y,width,height,pivotx,pivoty,rotation,sprite,color.
*When you call a render method, add new asset with specified variables into my array. I also have an array or vec3 to store my rotation data(pivotx, pivoty, rotation). If rotation that I passed to my Asset class is not 0, I will add a new vec3 to me rotation array and take a stamp of where I put it in an array. If rot was 0, just make that stamp point to location 0 at my rotations array. That place always contains vec3(0, 0, 0), basically no rotation.
*After I’m done rendering my game, make a FloatBuffer out of my rotations array. All the elements that are not null are put into my FloatBuffer. It is then sent as a uniform vec3 to my vertex shader.
*After sending my rotations data, go through my asset arrray. Now render stuff using the information from Asset class. I pass glNormal3f(asset.rotationHandle, 0, 0); for my vertices to assign their pointer to my rotations array.
*In my vertex shader, gl_Normal.x is a pointer to my rotations array. That array has information of where is the pivot to rotate the vertex around, and by how much.
The problem is that I cannot access that array with my int index = int(gl_Normal.x) . I did some testing and I found out that you cannot access UNIFORM arrays with such an index. If I create an array inside my void main() I can access it however I want.
Is there anyway to copy all the data from uniform array to local(right?) array? This would really give a huge performance boost when rotating stuff. I really hope there is a way to access my uniform array.