Jump to content
  • Advertisement

Super Llama

  • Content Count

  • Joined

  • Last visited

Community Reputation

152 Neutral

About Super Llama

  • Rank
  1. Super Llama

    Can't get Quaternion Time Derivative to work?

    Oh okay, I was wondering where that came from, that makes sense too. Thanks for the explanations, this is exactly what I needed to know.
  2. Super Llama

    Can't get Quaternion Time Derivative to work?

    OHH right, that makes perfect sense, thank you! I knew I was missing something obvious lol. I guess that means it technically works if you keep re-normalizing the quaternion and the game doesn't go longer than a few fractions of a second before updating the delta, but I guess using trig functions is inevitable if I want to do it right in all situations. I think I'll just construct a new unit quaternion from my angular velocity (since that only takes 5 math function calls) and multiply that onto it, unless there's a more efficient way I don't know about.
  3. Okay I'm sure this is a stupid question and I'm either completely misusing this formula or I'm missing something obvious, but I can't for the life of me figure out how I'm supposed to apply an angular velocity vector to an orientation quaternion, despite finding the Quaternion Time Derivative formula on multiple websites.   From what I've read, you can take an angular velocity vector like (0, 0, 3.14) for a 180 degree turn around the Z axis each second, then use these values in a non-normalized quaternion with zero w (0 0 3.14 0) -- I'm using xyzw representation for my quaternions -- and then you can multiply it by a delta time and an orientation quaternion and divide it by two, then add it to the orientation quaternion, and that should properly rotate the orientation quaternion according to the velocity. The formula looks like this: Q' = Q + 0.5t(W x Q).   Anyway, when I went to try it with a delta time of one second, it didn't seem to work. I take a unit quaternion with no rotation: (0 0 0 1) then multiply it by the angular velocity quaternion (with the original on the right, as per the formula) (0 0 3.14 0) x (0 0 0 1) = (0 0 3.14 0) then divide that by two (0 0 1.57 0) then add it to the original quaternion (0 0 1.57 1) but when I apply this rotation, it's 0, 0, -115 in euler angles, not 0, 0, 180.   So yeah... does anyone know what the problem is? I'd rather avoid having to build a quaternion from axis-angles each frame if I can, since that would require sin and cos which are more costly than just arithmetic, and everyone seems to say this formula works just as well, but I'm not seeing it.
  4. I'm trying to create a shared texture from a Direct3D 9 device using the pSharedHandle parameter that supposedly works starting with windows vista-- but no matter what I put in the parameters it always just returns an invalid call. I'm intending to share it with another device in another thread, but I can't even get the initial creation of the shared resource to work.   ddev->CreateTexture(width, height, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &tex, &handle);   I've tried changing pretty much all the parameters but if I pass it a &handle it always fails. The handle is pointing to a NULL value. I've been unable to find a lot of information about the texture sharing API, but everything I find says this should work. I'm compiling with the headers/libraries both from the Windows 7 SDK and the June 2010 DX SDK, and I'm able to see and instantiate D3D9Ex classes, so it's definitely a new enough version. The device is perfectly able to create the texture if I don't specify a handle, so I'm guessing I must not be fulfilling one of the restrictions for shared textures that microsoft barely told anyone about. MSDN is not helping very much, all it says is that I have to use D3DPOOL_DEFAULT, which I am.   Any ideas? I'll keep messing with the parameters while I wait for an answer.   EDIT: Well, I got it to create the handle by changing all the DirectX9 objects to DirectX9Ex objects, but this is not ideal and if there's still a way to do it with ordinary D3D9 interfaces, that would be preferable.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!