Sign in to follow this  

OpenGL Scaling Matrix

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

This topic is 2838 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this