OpenGL scaling

Started by
2 comments, last by Brother Bob 12 years, 10 months ago

vertex_type vertex[MAX_VERTICES]; // Array of vertices



void ObjScale (obj_type_ptr p_object, GLfloat scale)
{
GLuint i;

for (i = 1; i <= p_object->vertices_qty; i++) {
p_object->vertex[3 * i + 0] *= scale;
p_object->vertex[3 * i + 1] *= scale;
p_object->vertex[3 * i + 2] *= scale;
}
}



hi guys, i need your help with the above code, i am trying to add a method to scale my models from my .3ds loader...but it gives me this error.....




object.cpp(282) : error C2676: binary '*=' : 'vertex_type' does not define this operator or a conversion to a type acceptable to the predefined operator
\object.cpp(283):error C2676: binary '*=' : 'vertex_type' does not define this operator or a conversion to a type acceptable to the predefined operator
\object.cpp(284) : error C2676: binary '*=' : 'vertex_type' does not define this operator or a conversion to a type acceptable to the predefined operator


thank you for your help
Advertisement
Some errors can be tricky to understand, but this one is pretty clear: there is no operator *= for vertex_type.

Some errors can be tricky to understand, but this one is pretty clear: there is no operator *= for vertex_type.


thank you for your reply......i'm sorry i just started learning openGL and i am not familiar with some of its errors, can you please tell me what i am doing wrong or what i need to do to fix it........

thank you
This has nothing to do with OpenGL at all, it is a C++ problem. Your array contains objects of type vertex_type, but since there is no operator *= defined for that type, you cannot use it. You need to overload the operator to make it work, so look up operator overloading in your favorite book on C++ or search engine.

This topic is closed to new replies.

Advertisement