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 & Rotation Matices


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
9 replies to this topic

#1 Blind1992   Members   -  Reputation: 104

Like
0Likes
Like

Posted 11 October 2013 - 05:55 AM

.

Edited by Blind1992, 11 October 2013 - 02:25 PM.


Sponsor:

#2 apatriarca   Crossbones+   -  Reputation: 1770

Like
0Likes
Like

Posted 11 October 2013 - 06:07 AM

Matrix product is not implemented as component-wise multiplication.. 



#3 Blind1992   Members   -  Reputation: 104

Like
0Likes
Like

Posted 11 October 2013 - 06:10 AM

Matrix product is not implemented as component-wise multiplication..


Thanks for the reply, however I'm not quite sure what you mean, Im pretty new to OpenGL, and C++ for that matter. I've simply tried following tutorials, but adapt them to my matrix class. Could you elaborate please?

Many thanks

#4 Brother Bob   Moderators   -  Reputation: 8566

Like
1Likes
Like

Posted 11 October 2013 - 06:17 AM

What he's saying is that, if you have two matrices, then to multiply them you don't just take the individual components and multiply them. That is effectively what you're doing when you multiply the elements of CameraMatrix1 by the sine and cosine factors that make up the rotation matrix. Matrix multiplication is much more complex that that.

 

You need to read up on linear algebra, or at least matrix math. A quick search for matrix multiplication reveals plenty of sources.



#5 Blind1992   Members   -  Reputation: 104

Like
0Likes
Like

Posted 11 October 2013 - 06:27 AM

What he's saying is that, if you have two matrices, then to multiply them you don't just take the individual components and multiply them. That is effectively what you're doing when you multiply the elements of CameraMatrix1 by the sine and cosine factors that make up the rotation matrix. Matrix multiplication is much more complex that that.
 
You need to read up on linear algebra, or at least matrix math. A quick search for matrix multiplication reveals plenty of sources.


You are quite right. I've been so stuck in this mindset I never looked back at what I thought was already correct. Well I'll see what I can come up with. Thanks. Maybe now I can make some progress

#6 BitMaster   Crossbones+   -  Reputation: 4421

Like
1Likes
Like

Posted 11 October 2013 - 06:50 AM

You might want to consider using something tried and tested like GLM. It also includes several helper functions which replicate the behavior of the deprecated OpenGL functions.

A good matrix/vector library takes quite a bit of effort to write and make bug-free. Unless you have specific needs or requirements rolling your own is nothing but a lengthy and annoying chore.

Edited by BitMaster, 11 October 2013 - 06:51 AM.


#7 Blind1992   Members   -  Reputation: 104

Like
0Likes
Like

Posted 11 October 2013 - 07:59 AM

Thanks for all the advice, I'll look into GLM after I'm done with this little project, I've fixed the matrix math and I've got my object rotating around the origin (where the camera is placed), So I attempted to translate before the rotation is applied and then translate back after to reset the origin (as I have done previously with glRotatef) however the translate calls are making no difference and the object is still rotating around the original origin, any ideas?

#8 BitMaster   Crossbones+   -  Reputation: 4421

Like
0Likes
Like

Posted 11 October 2013 - 08:09 AM

Without seeing the relevant code, it's only possible to guess. It appears either your matrix multiplication is still broken or the translation matrices you create are faulty.

#9 Blind1992   Members   -  Reputation: 104

Like
0Likes
Like

Posted 11 October 2013 - 08:16 AM

Without seeing the relevant code, it's only possible to guess. It appears either your matrix multiplication is still broken or the translation matrices you create are faulty.


Ignore post, made a silly mistake.

Edited by Blind1992, 11 October 2013 - 08:20 AM.


#10 Blind1992   Members   -  Reputation: 104

Like
0Likes
Like

Posted 11 October 2013 - 08:20 AM

Fixed it! Sorry for making so many basic mistakes throughout this thread, I've learned a lot. many thanks to everyone and hopefully I'll not make the same mistakes again




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