Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Newbie here!

I need to know the effective coordinates of a triangle after applying transformations (rotations & translations) to the current (MODELVIEW) matrix.

That is, given a vertex P, I want to calculate, for instance, the new coordinates of P after a rotation of 90º on the x-axis.

How can I do that? Is it also possible to use only OpenGL matrix operations to do this?

Thanks in advance for any tips.

Edit: The easy one is translation. I implemented it as

#define T(x, v) (x+v)

where I apply T to every coordinate of every vertex.

But what about rotation over a specific axis. Can you please give me some hint?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

Modern OpenGL (3.0 and up) doesn't contain any built-in matrix operations so you have to do everything yourself.

Check out a library like GLM http://glm.g-truc.net/

Or search for a good tutorial on "3d matrix math"

share|improve this answer
    
I'm having some trouble implementing them. Could please post some reference on this? I think I understand the math, but it is the C implementation which is giving me trouble. Thanks again –  AndrewM Apr 28 '12 at 15:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.