Skip to main content
GameDev.net gamedev.net
🔒 Locked

glMultMatrixf help needed

Started by greentea8202 Jul 4, 2004 at 9:53 PM 3 replies 600+ views
Original Post
greentea8202
greentea8202
Hi, I'm using arcball for my rotation control and I generated 4x4 matrix for rotation. However, if I try to use same approach for translation, I somehow get weird rendering problem. I get same modelview matrix I get by using glTranslatef, for using glMultMatrixf, but my object just shakes whenever I try to translate it. For example, glTranslatef(2.0, 2.0, 0.0) is equal to glMultMatrix(m) where m = 1 0 0 0 0 1 0 0 0 0 1 0 2 2 0 1. And current modelview matrix would be same as matrix m since starting of matrix of display() is identity matrix. Why does image shakes rather than moving smoothly as gltranslate function? Please help me out~! Thanks!!!
vincoof
vincoof
Shaking is certainly due to floating-point precision errors. Try using glMultMatrixd instead and this should be better.
As for why glTranslatef works correctly (ie doesn't need glTranslated to get good precision), that I do not know. Maybe that's some kind of driver optimization.
mikeman
mikeman
Quote:
Original post by vincoof
Shaking is certainly due to floating-point precision errors. Try using glMultMatrixd instead and this should be better.
As for why glTranslatef works correctly (ie doesn't need glTranslated to get good precision), that I do not know. Maybe that's some kind of driver optimization.


Bah,I don't think precision issues would result in artifacts so obvious that make the object shaking.It should be something with the order of columns and rows.Try using
m=1 0 0 2
0 1 0 2
0 0 1 0
0 0 0 1

vincoof
vincoof
At first glance, I also thought it was row-major vs column-major matrix issue. But I don't think it would ever shake if the matrix was transposed. Rather it would look very weird, stretched along the XY axis
greentea8202
greentea8202
thanks guys for your reply.
I sort of figured out what I did .. made some stupid mistake~ :p

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.