PDA

View Full Version : printing matrix on screen.



kellody
12-01-2001, 11:56 AM
Hey Smarties,
How do I print out a matrix to the screen. Am desperate.

Kellody

Bob
12-01-2001, 02:28 PM
GLfloat m[16];
glGetFloatv(GL_MODELVIEW_MATRIX, m);
cout << m[0] << ' ' << m[4] << ' ' << m[8] << ' ' << m[12] << endl;
cout << m[1] << ' ' << m[5] << ' ' << m[9] << ' ' << m[13] << endl;
cout << m[2] << ' ' << m[6] << ' ' << m[10] << ' ' << m[14] << endl;
cout << m[3] << ' ' << m[7] << ' ' << m[11] << ' ' << m[15] << endl;

Or where's the problems?

[This message has been edited by Bob (edited 12-01-2001).]

kellody
12-01-2001, 03:37 PM
Hey Bob,
I'm using g++ on Redhat and it does not like mixing cout statements and openGL. It will compile and then core dump. Is this normal or am I doing something wrong? I'm following you're basic routine. It's fine with everything but the cout statement. .

Thanks Again,
Kellody

Bob
12-02-2001, 04:36 AM
Tried to debug it to see where it fails? I mean, it may not be the actual cout, but something else, or are you sure? Tried printf instead of cout?