0
\$\begingroup\$

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?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

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"

\$\endgroup\$
1
  • \$\begingroup\$ 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 \$\endgroup\$
    – AndrewM
    Commented Apr 28, 2012 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .