errfet
10-27-2011, 03:42 PM
Hello.
I`ve been playing around with VBO for few days, and so far, I can use it to draw objects. There is one question that I haven`t found answer for. What if I want to display, lets say, two boxes (A and B), but each one has different transformation matrix.
Should I do following steps, or is there any other, better method?
1.PushMatrix
2.Create transformation matrix for A
3.compute new coordiates for each point that A consists of.
4.load newly computed cordinates into VBO buffer
5.PopMatrix
6.Do the same for box B
7.Draw scene
Boxes are defined like this:
class Point{
public:
GLfloat x, y, z;
}
class Box{
public:
Point points[8];
Glfloat dx, dy, dz; //displacements
Glfloat angle_x, angle_y, angle_z; //rotation
}
There is another question, should I declare one global VBO that keeps coordinates of each point of A and B, or should I make local VBO for each box?
I`ve been playing around with VBO for few days, and so far, I can use it to draw objects. There is one question that I haven`t found answer for. What if I want to display, lets say, two boxes (A and B), but each one has different transformation matrix.
Should I do following steps, or is there any other, better method?
1.PushMatrix
2.Create transformation matrix for A
3.compute new coordiates for each point that A consists of.
4.load newly computed cordinates into VBO buffer
5.PopMatrix
6.Do the same for box B
7.Draw scene
Boxes are defined like this:
class Point{
public:
GLfloat x, y, z;
}
class Box{
public:
Point points[8];
Glfloat dx, dy, dz; //displacements
Glfloat angle_x, angle_y, angle_z; //rotation
}
There is another question, should I declare one global VBO that keeps coordinates of each point of A and B, or should I make local VBO for each box?