Meanz
01-11-2012, 01:01 AM
Hey folks.
I am having a few problems that I can't resolve on my own.
1.
I have a default shader for each of my Geometry objects.
A geometry object in my case is a vao with vertices, texture coords and normals. And also each geometry object has a shader. Or more precisely one frag and one vert shader with a shader program.
I was wondering if it is okay to create, compile and link a new shader for each geometry object. Or some prefer to call it a spatial or something like that. I could have used the same shader for all the geometry objects, but each geometry object might have different textures.
Would be lovely if you could reach a hand out on this one.
2.
I am trying to store my geometry objects, or pointers to them in a central place. So the renderer can iterate them and just call their draw functions on every frame.
But I can't figure out the best way to store them.
I do know this much.
There will be objects added and removed from the storage frequently. And it is going to be iterated every frame too.
So first I was thinking of creating an array that I can resize when needed. But I figured that resizing the array frequently would be to costly. So I am kinda stuck here, I am not too familiar with C++, in java I think I would have gone with a linkedlist, but I don't seem to be able to find something similar for c++.
I am having a few problems that I can't resolve on my own.
1.
I have a default shader for each of my Geometry objects.
A geometry object in my case is a vao with vertices, texture coords and normals. And also each geometry object has a shader. Or more precisely one frag and one vert shader with a shader program.
I was wondering if it is okay to create, compile and link a new shader for each geometry object. Or some prefer to call it a spatial or something like that. I could have used the same shader for all the geometry objects, but each geometry object might have different textures.
Would be lovely if you could reach a hand out on this one.
2.
I am trying to store my geometry objects, or pointers to them in a central place. So the renderer can iterate them and just call their draw functions on every frame.
But I can't figure out the best way to store them.
I do know this much.
There will be objects added and removed from the storage frequently. And it is going to be iterated every frame too.
So first I was thinking of creating an array that I can resize when needed. But I figured that resizing the array frequently would be to costly. So I am kinda stuck here, I am not too familiar with C++, in java I think I would have gone with a linkedlist, but I don't seem to be able to find something similar for c++.