Jump to content
  • Advertisement
Sign in to follow this  
X Abstract X

OpenGL Scaling Matrix

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

Hello, I'm trying to figure out how to perform scaling in OpenGL using my own scaling matrix but it isn't producing the expected results. Right now I've got my translations working but can't seem to scale properly. This is what I'm doing: I have a 4x4 identity matrix stored as a 16-element array of doubles. When I want to scale, I replace index 0 with the x-scaling factor, index 5 with the y-scaling factor and index 10 with the z-scaling factor. Then, I multiply the OpenGL modelview matrix by my scaling matrix. Am I doing something wrong? If it matters, I'm working in ortho.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
When I want to scale, I replace index 0 with the x-scaling factor, index 5 with the y-scaling factor and index 10 with the z-scaling factor.

Then, I multiply the OpenGL modelview matrix by my scaling matrix.
That sounds right to me. In what way is it not working?

Share this post


Link to post
Share on other sites
Well, I'm just drawing a simple triangle. The triangle will be moved/scaled way too big/out of view completely. I can't pinpoint exactly what is happening, it's kind of random.

Even if I multiply the modelview matrix by an identity matrix, the triangle becomes about 5x larger.

Edit: Solved and thanks for your reply.

Share this post


Link to post
Share on other sites
Quote:
Edit: Solved and thanks for your reply.
Multiplication order problem, perhaps?

Anyway, maybe you could post how you solved it (it could be useful to others who might read the thread).

Share this post


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

  • 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!