|
Why does this happen?
What I need to know is why this code causes the triangles to act like a tornado(kinda) and not move together in a straight line
here is the code
"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
--------------------------------- "Those who serve no purpose, have no purpose."- SSC Oh the possibilities!!Edited By - SonShadowCat on Your Girlfriends Birthday
If you''ll look into the documentation of the glRotate* and glTranslate* functions you''ll see that they multiply the current matrix with the according transformation matrix. This results in a concatenation of your transformations (until you load the identity matrix).
So what you''re doing is applying the first transformation, drawing the first triangle, the you "add" the new transformation to the current one and draw the next.
If you would only have translation, the following would happen (translation is a, position of the first tri is x)
1. Draw the triangle at x
2. translate by a, thus drawing at x+a
3. translate by a, thus drawing at x+2*a
...
So what you''re doing is applying the first transformation, drawing the first triangle, the you "add" the new transformation to the current one and draw the next.
If you would only have translation, the following would happen (translation is a, position of the first tri is x)
1. Draw the triangle at x
2. translate by a, thus drawing at x+a
3. translate by a, thus drawing at x+2*a
...
say what?
uhh its gonna take me a while to decipher all the words you said
"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
uhh its gonna take me a while to decipher all the words you said
"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
--------------------------------- "Those who serve no purpose, have no purpose."- SSC Oh the possibilities!!Edited By - SonShadowCat on Your Girlfriends Birthday
is there any way you make ure explination simpler since im a newb and not sure what you mean
"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
--------------------------------- "Those who serve no purpose, have no purpose."- SSC Oh the possibilities!!Edited By - SonShadowCat on Your Girlfriends Birthday
Look at it like this.
Get it? So everything you do adds up. To have this NOT happen, you would rotate, draw something, then you can call glLoadIdentity() to start from scratch.
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
|
Get it? So everything you do adds up. To have this NOT happen, you would rotate, draw something, then you can call glLoadIdentity() to start from scratch.
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
Which means that if you translate, then rotate the x axis, which is
|
and then you translate again, you are translating along a rotated x axis.
------------------------------Put THAT in your smoke and pipe it
So SonShadowCat, do you get it then?
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
oh dawg, I get it now 
but i have tried putting glLoadIdentity() after i draw but then all the triangles are drawn in the exact same place not in a mine field manner i was looking for
"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"

but i have tried putting glLoadIdentity() after i draw but then all the triangles are drawn in the exact same place not in a mine field manner i was looking for
"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
--------------------------------- "Those who serve no purpose, have no purpose."- SSC Oh the possibilities!!Edited By - SonShadowCat on Your Girlfriends Birthday
Well, if your only problem is the rotations then I suppose you could just rotate the reverse of what you had rotated to keep your translations. Maybe I''m not thinking here... maybe.
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
have you d/l the project?
i dont get how simple rotations turned a weird mine field into a freaking tornado
"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
i dont get how simple rotations turned a weird mine field into a freaking tornado
"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
--------------------------------- "Those who serve no purpose, have no purpose."- SSC Oh the possibilities!!Edited By - SonShadowCat on Your Girlfriends Birthday
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement