Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Very urgent questions

This topic is 5753 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

First of all, can someone tell me how to use the glScale function. I want to use it to scale a loaded Milkshape3D model. Then, after loading a milkshape3d model, the texture-mapping is done upside down! I have no idea why. Can someone tell me how I can modify the texture coordinates so that the texture-mapping is done properly. Pls, don''t tell me to invert the images; I just won''t do that!!!

Share this post

Link to post
Share on other sites
simple example for glScale:

glScale( 1, 2, 3 );

now you calls to ploting vertices will be something like
glVertex3f( 2, 2, 2) --> after scaling this will be ( 2, 4, 6 )


about textures upside down... just cahnge u (or v)texture coordinate to 1-u (or 1-v)

You should never let your fears become the boundaries of your dreams.

Share this post

Link to post
Share on other sites
You''re loading milkshape models and you don''t know how glScale works? That seems rather odd, not trying to be a smartass or anything, but shouldn''t you learn the basics first? Anyways, the function glScale*(x, y, z) works like this.

x - how much to scale in x. say 2 for example. That would make everythin twice as large.

y - how much to scale in y.

z - how much to scale in z.

the scaling is accomplished through the matrix

|sx 0 0 0|
|0 sy 0 0|
|0 0 sz 0|
|0 0 0 1|

if you multiply this matrix by a point p{transpose} = (x, y, z, 1};
then you get

|sx * x|
|sy * y|
|sz * z|
| 1 |

you may also want to look into how to push and pop the matrix stack so that you only scale the things you wish to scale (also, translate, rotate, and shear).
Hope my answer helps.

Share this post

Link to post
Share on other sites
I think what he wants to know that it applies to everything that uses the current matrix mode (e.g. MODELVIEW matrix would be used by verticies and normals) would be scaled after applying glScale() to that matrix. That's where glPushMatrix and glPopMatrix come into play, allowing you to save and restore the matrix something like this:

...do stuff...
...draw your milkshape model...
...do stuff, the scale will no longer affect anything

Something to be wary of though is that if you must use glScalef() instead of scaling your model in your editor (advisable) then make sure to enable GL_NORMALIZE, otherwise your normals will get scaled as well and cause weird stuff to happen to your lighting. The problem with GL_NORMALIZE is that I _think_ you take a performance hit for using it. I'm not sure though since I haven't really bothered looking into if it's done in hardware or software (I don't use it). Anyone feel free to correct me if I'm wrong on this.

Joanus D'Mentia
The three phases of me...
The twit, the tool and the lonely fool.

[edited by - joanusdmentia on December 26, 2002 3:53:01 PM]

Share this post

Link to post
Share on other sites
I read that you do take a performance hit for enabling GL_NORMALIZE or GL_AUTO_NORMAL so I believe you are correct. You are also correct in stating that he should scale his model before loading into his program, as using glScale will mess up his lighting (messes up all the normals), at least that''s what I''ve read.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!