• Advertisement
Sign in to follow this  

OpenGL scaling

This topic is 2396 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[code]
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;
}
}

[/code]

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

Share this post


Link to post
Share on other sites
Advertisement
[quote name='Brother Bob' timestamp='1309336263' post='4828992']
Some errors can be tricky to understand, but this one is pretty clear: there is no [i]operator *=[/i] for [i]vertex_type[/i].
[/quote]

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

Share this post


Link to post
Share on other sites
This has nothing to do with OpenGL at all, it is a C++ problem. Your array contains objects of type [i]vertex_type[/i], but since there is no [i]operator *=[/i] 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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement