| |
| |
| |
|
Page: 1 2
Comments:
<0> I hate it when I'm doing a bunch of involved math and it doesn't turn out right, so I tweek what I suspect is wrong, and it shows up right, but then examining the logic, it doesn't make sense :P <1> hey, i'm using glRotate to rotate something. i'm starting with the object having a center of 0,0, rotating it, then translating it, but still, when it rotates, it doesn't rotate from the center, it rotates from it's position after it translates, so it just goes around in a circle instead of rotating <1> any suggestions? <2> N3v: The order. <1> what do you mean? <2> Translating and then rotating is not the same as rotating and then translating. <1> well i'm rotating then translating <2> N3v: Remember that after translating a mesh, its gravity center is not [0,0,0] anymore. <1> yeah, thats why i rotate first, but it still does that <2> You implcitly set a radius. <1> huh? <2> What do you really want to achieve? <2> You want to rotate your mesh around its own axis, and then translate it away? <1> i'm making a simple application where i have a square, and when i press left and right, the square rotates in those directions, then when i press forward or back, it moves forward or backwards in the direction it's facing <2> "In the direction it's facing?" Relative to object coordinates? <2> Sounds like you can't do that with glRotate and glTranslate. Read the online matrix FAQ.
<0> N3v, the problem is that you have to consider the deformations from the same origin every frame, you don't have frame to frame coherence of the stack <0> and if you did it would get messy quick <0> You'll need to do some math to calculate where you want the object to go, and then set up your matrix to match that new position and orientation. <0> Here's what I don't get... I have a set of bones that have local matrix transformations. I compile them to world transformations by iterating the hierarchy from parent to child and doing this = parent * this; <0> That gets world transformations fine <0> but then to use it as a deformation from some other pose, I need to first deform the geometry by the inverse of that pose, before I can p*** it through my new stack right... ? <0> well how come deform[i] = invBindPose[i] * world[i]; doesn't work, and deform[i] = world[i] * invBindPose[i]; does? <0> wouldn't the application make sense to be Inverse * ParentLocal * ChildLocal? <0> Does row major apply transformations left to right, or right to left? <0> err I meant <0> what's opengl? post multiply? <0> I guess opengl is right to left, just from thinking about it. <0> I've never tried to set up a stack in directx, do you actually have to do the camera rotation last? <0> and all of the object transformations first? <0> Hellooo <0> ECHO Echo echo ... . <1> i have no idea, so i'm no help <1> but return, what you said about my problem, do you think i should use glMultMatrix? <0> not really. <0> Just keep data for your object like, it's position, and it's rotation. <0> and when you press forward, update it's position manually. <1> yeah, that's what i'm doing, it's all in it's cl*** description <0> then draw it at the new position/rotation <1> but i just don't get why my square goes around in a circle, instead of rotating <0> you want to do position then rotation in opengl <1> oh? i thought it was the other way around <0> that means the top of the stack is the rotation, and then the next thing is the translation <0> I think <0> I get confusde because I know you have to create it backwards <0> If you think about what you want to happen to the object, you have to code it in reverse <0> I guess you want to position the object somewhere, and then rotate it. <0> so in reverse you rotate and then translate <0> that's probably what you want <0> but if it's wrong try it the other way <0> if they both don't work then your data is wrong <0> simple :D <1> well i just put translate after the rotate code, and it still goes in a circle <0> conceptually if you translate the object and then rotate it, the rotation will still be at the same origin <0> so it will orbit <0> instead of spin in place at the new location <0> so, you want to rotate it first, then position it. <1> well, i tried that first <1> and no luck <0> then your position calculations are wrong <0> how are you calculating it? <0> are you using sin and cos a lot? <0> can it move at an upward or downward angle as well or is it just 2d? <1> it's just 2d <1> so which axis should i rotate it at? <0> do you know how to get the coordinates of of a point on a circle given an angle? <1> only z makes it orbit, x and y just make it disappear instantly <1> um, you mean like with math, or opengl? <0> math <0> use math <0> you didn't answer my question either <1> you mean like, from the center of the circle? <0> imagine not using opengl at all for a sec <1> yeah, i think so <0> if you think about the location of your object <0> and you're adjusting the rotation manually <0> and you want to have it always move forward
<0> in what ever direction it's facing <1> yeah, so you update the points by the angle <1> i think i can figure that out <0> you do ALL of that NOT in opengl <0> it's just math <1> ok, i'll do it that way <0> then when you're done, you have a position, and a rotation, and that's what you draw <0> you don't update the vertices just the object's position <1> wait <1> how do i draw the rotation? <0> :P <1> well i was going to update the verticies <1> i don't know how i could show the rotation without doing the verticies, since glRotate just makes my object orbit <0> then switch translate and rotate <0> and it won't orbie <0> orbit <1> i did <1> i compiled it with translate first, and it orbited, and it did the exact same thing with rotate first <0> no it didn't ;) <0> try again, you're missing something <1> so which is it? rotate or translate first? <0> are you sure you're even changing the right code if you didn't see any difference. <1> well it's definitely the code that does the translating and rotating <1> it's a cl*** function <1> it's like this <1> the cl*** is called square <1> and the function is square::gldisplay() and it does glTranslate(square::xmove,square::ymove) etc. <0> why don't you just set the translation to something fixed like 10, and then do a rotation += time <0> and try both methods <0> and figure it out <0> it's not that hard. <1> but the thing is, i did, i even started with the object having a centerpoint of 0,0, rotated, then translated it to where i want it, and still nothing <1> i tried the same thing with translating and then rotating, and STILL nothing <0> you're obviously not doing what you think you're doing <1> well i'm rotating on the z axis, is that right? <1> when i do x and y, the square disappears <0> the problem is not that opengl treats the order the same, you're not doing something right, and I don't have all of the info to help you <0> I don't know. it depends how you have your ortho set up. That sounds right <0> but do what I said, you're just arguing <0> I don't care what didn't work before <0> something you thought was happening probably wasn't <0> use breakpoints if you have to <0> make sure the data you expect is actually reaching the functions <1> yeah, i'll figure it out <1> thanks <1> i'm trying a little program involving user-controlled squares and networking. i should adjust the individual verticies rather than use glTranslate or glRotate, right? <1> the program involves displaying your square and others' squares in a window <1> can someone take a look at this? <1> http://rafb.net/paste/results/E4HaA892.html <1> the program just generates a white square on a black backround <1> it's supposed to rotate when i hit left and right, and move backwards and forwards when i press up/down <1> but it orbits instead of rotates, that's the biggest problem <0> So, do I understand this correctly: Matrices that are multiplied left to right, get applied right to left in both directX and opengl? <0> Because the pre-multiply is the same as post-multiply of the transpose. <3> I don't see you using .angle anywhere, N <3> N3v, even <4> I am trying to make a simple "reflective water" surface in opengl for a 2d game. My idea is, after all sprites, tiles, etc have ben drawn, to just copy some lines from the area above the "water" on to the water area (and shifting in side using sine). Is it possible to do this in opengl? <4> In short, what I would like to do; copy one line on the screen to another line on the screen using hw <3> magnus_, direct copy of framebuffer pixels? glCopyPixels() <5> how do I get the viewing frustum in ogl` <5> ? <3> You mean glGetFloatv( GL_PROJECTION_MATRIX, m ); and so on? <5> umm I want to know what I can see on the screen <3> Ah, the 6 planes of the frustum <3> http://www.rayforce.net/rfmath.c Look for mathPlaneFrustum <6> heh <6> forcing your fugly code on newbies, for shame... <6> :D <3> Aw ``Erik :), that's nothing like the self-balancing binary tree, just a soup of math functions <6> now, I skimmed your tree code really really fast and was... not entirely sober at the time... it's memory compacted? like, the tree structure is entirely contiguous? <6> "cache friendly"? :D <3> Not by itself, the user provides its own structs and tell the implementation where the tree nodes are within the struct by offsetof()
Return to
#opengl or Go to some related
logs:
spca5xx slackware dd without count #computers #sex janeydorr #netbsd #computers mike ricci picture #nhl #hardware
|
|