hi
i’m having trouble imlementing vertex arrays. I want to use vertex arrays to draw whole polygons at once (triangle).
this is the structure i use for vertices:
class sfVector
{
public:
float x,y,z;
normal3d normal;
tex texture;
//constructors
sfVector(){}
sfVector(float a, float b, float c)
{
x = a;
y = b;
z = c;
}
~sfVector(){
}
// Dot product function : overloaded multiplication operator
float operator* (const sfVector &vec)
{
return (x * vec.x + y * vec.y + z * vec.z);
}
// Cross Product funtion : overloaded remainder operator
sfVector operator% (const sfVector &vec) const
{
return (sfVector(y * vec.z - z * vec.y, z * vec.x - x * vec.z, x * vec.y - y * vec.x));
}
// Vector addition function : overloaded addition operator
sfVector operator+ (const sfVector &vec) const
{
return (sfVector(x + vec.x, y + vec.y, z + vec.y));
}
//Vector addition function : overloaded subtract operator
sfVector operator- (const sfVector &vec) const
{
return(sfVector(x - vec.x, y - vec.y, z - vec.z));
}
/* sfVector& normalize()
{
return (this /= sqrt(x * x + y * y + z * z));
}/
//Modulus/ vector length function
float mod()
{
return float(sqrt((pow(x,2)) + (pow(y,2)) + (pow(z,y)) ));
}
};
and then i use std::vector <sfVector> CVectorArray
Is it possible to use vertex arrays with this type of structure? all my attempts have failed. help is very much welcome.