Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


OpenGL scaling


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 GottiJay   Members   -  Reputation: 100

Like
0Likes
Like

Posted 29 June 2011 - 02:03 AM

  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

Sponsor:

#2 Brother Bob   Moderators   -  Reputation: 8571

Like
0Likes
Like

Posted 29 June 2011 - 02:31 AM

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

#3 GottiJay   Members   -  Reputation: 100

Like
0Likes
Like

Posted 29 June 2011 - 02:52 AM

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

#4 Brother Bob   Moderators   -  Reputation: 8571

Like
0Likes
Like

Posted 29 June 2011 - 03:00 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS