Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Chaosenemy

Member Since 18 Feb 2008
Offline Last Active Jul 12 2014 04:42 PM

#5145670 I need help with matrices

Posted by Chaosenemy on 09 April 2014 - 08:03 AM

Hey guys,

I would greatly appreciate any help you can offer me. I'm writing a big Entity/Sprite/Model/Rendering system and I am having the hardest time understanding how to use matrices properly. I guess my main questions is: how can I use only a single matrix per object to define where it is located, how it is rotated, and how it is scaled? Since matrix multiplication is cumulative, I have come to the conclusion that I have no choice but to store a (Vector3D) position, (Quaternion) rotation, and (Vector3D) scale, and then re-calculate the matrix (for rendering) each frame from these values. This seems.... cumbersome and ugly. Is there some way to simply have a Matrix for each object and modify it directly when I call SetPosition(), RotateX(), etc.? I'm not that great with Matrix manipulation, so maybe this is no-brainer, but I can't seem to find any direct answer to this no matter where I search.

 

Side note: This isn't meant to sound rude at all, but please don't suggest that I use SDL or some matrix library. I get that a lot, but I want to make this myself. I just need some help in the right direction. Believe me, I've tried learning this myself, but I learn by example, so reading books explaining matrices just doesn't make it click for me.

 

Thanks in advance!




#4761278 How to capture raw mouse input in X11?

Posted by Chaosenemy on 19 January 2011 - 09:42 AM


For the Windows version of my game engine, I'm using WM_INPUT and registering the mouse device directly to get the most precise movements. Anyone know how I would go about doing this in X11 (for Linux)? I've searched Google about as thoroughly as I can, but finding good documentation for X11 is next to impossible.


Well in general, no one ever accesses pure X11 for handling this stuff as there are gui libraries out there for this. Have you thought about using a cross OS gui library rather than rolling your own and just wasting time doing that?

I've always wanted to make a game engine from scratch (well as close to scratch as possible), so I'd rather not mess with anything but the required APIs/libraries. And anyways, I'm getting very close to being done with the X11 stuff, so I've already come too far at this point to switch to something else.


Thanks, that pointed me in the right direction I think, and I've found a few samples. There is one issue though: Link. That guy's post is the only thing I can find on the internet about this issue, and it hasn't been resolved =\ Can you think of any way to get around that? I was thinking something like sending a certain X event before calling XWarpPointer() and then in my event handler, when I get to the event I sent, ignore the next event, which would be the one sent by XWarpPointer(). Not sure if I'm explaining that right, but does it sound plausible?

It sounds like you're jumping through hoops to reinvent pointer grabbing. You may dislike SDL, but if you're keen on reinventing what it does you might want to look at how it does it.

I think what you really want to do is read up on XGrabPointer() and it's wife/sister XUngrabPointer(). They're the preferred way to do X11 active pointer grabbing.

My big issue with grabbing the pointer is that it breaks external keyboard shortcuts like Alt+Tab. Also if I'm not careful enough about error checking and a fatal bug occurs, the user could end up trapped and have to restart their machine. I dunno, XGrabPointer just bothers me.

Anyways though, the solution I proposed in my last post seems to have worked, so I think I've got it all figured out. Thanks again for pointing me to the XInput extension.


PARTNERS