Hi all,
I posted a thread yesterday regarding VBO/Displaylist for speed but during writing it I realized that the problem wasn’t the VBO’s but the calculations around them.
I am currently doing as follows:
Fill 160 VBO’s with 1024 triangles each (3072 vertices). After that I store the buffer ids into a hashmap that looks something like this:
Hashmap<Position, Buffer>.
When my view has changed I do an unproject on each corner of my application against z=0 to get a rectangle (getRedrawViewport) containing what coordinates I can see. I don’t think that the unproject is a problem because I get the same fps when I move my camera and when I don’t.
My loop in the display function to pick up the correct hashmaps looks like this:
(Containers.getContainersize() is the size of the VBOs, they are all of the same size)
for (int i=(int) Math.floor(getRedrawViewport().getX()/Containers.getContainersize());i<Math.ceil(getRedrawViewport().getMaxX()/Containers.getContainersize());i++){
for (int j=(int) Math.floor(getRedrawViewport().getY()/Containers.getContainersize());j<Math.ceil(getRedrawViewport().getMaxY()/Containers.getContainersize());j++){
CurrentPos=new Point2D.Double(i,j);
int[] ids = Containers.GetBufferIds(CurrentPos);
//Draw the buffers
}
}
What is the quickest way to do this because I don’t think I’m doing it right.
If you want more info just give a shout.
Thanks in advance.