Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Thug Bonnet
Sep 22, 2004

anime tits ftw

Why is my perspective projection matrix looking down positive z rather than negative z?
code:
float n, f, r;
/* near and far clip */
n = 0.1;
f = 500.0;
/* ratio of viewport */
r = ( float ) glWidth / ( float ) glHeight;


float mp[16];
mp[0] = (1.0/r)*-(1.0/(tan(fov * 3.14159 / 360.0 ))); mp[4] = 0.0;				  mp[8] = 0.0;	    mp[12] = 0.0;
mp[1] = 0.0;					      mp[5] = 1.0/(tan(fov * (3.14159 / 360.0))); mp[9] = 0.0;	    mp[13] = 0.0;
mp[2] = 0.0;					      mp[6] = 0.0;				  mp[10] = f/(f-n); mp[14] = -((f*n)/(f-n));
mp[3] = 0.0;					      mp[7] = 0.0; 				  mp[11] = 1.0;     mp[15] = 0.0;
When i use glFrustum it works fine (looks down negative z):
code:
glFrustum(
		( ( float ) glWidth / ( float ) glHeight ) * - ( tan ( fov * 3.14159 / 360.0 ) * .1 ),
		( ( float ) glWidth / ( float ) glHeight ) * ( tan ( fov * 3.14159 / 360.0 ) * .1 ),
		- ( tan ( fov * 3.14159 / 360.0 ) * .1 ),
		tan( fov * 3.14159 / 360.0 ) * .1,
		0.1,
		500.0f
);

Thug Bonnet fucked around with this message at 23:00 on Dec 10, 2007

Adbot
ADBOT LOVES YOU

Thug Bonnet
Sep 22, 2004

anime tits ftw

Can someone point me toward a good, no-bullshit discussion of quaternions that includes practical code examples? I always end up finding either high-level descriptions of the math involved or API-specific implementations. I'd love to see a bridge between the two somewhere. I haven't found the gamedev articles to be particularly helpful (they seem to suffer from the same problems).

Thug Bonnet
Sep 22, 2004

anime tits ftw

more falafel please posted:

The O'Reilly book Physics for Game Developers has a good explanation of quats. I haven't seen a good online discussion, but I can't say I've looked.

I'll definitely check out the book. Is it good otherwise?

Thug Bonnet
Sep 22, 2004

anime tits ftw

Wuntvor posted:

Well, since this is a question I've been dealing with again and again, I thought I might as well post here. Basically, I have a very hard time deciding what language to do my game programming in. C# is what I'm most comfortable with, so XNA would be the natural choice, but I'd like at least the possibility to run the game on Linux as well.

Basically, it comes down to the fact that it is hard finding a decent library that does all I need. Especially, I'd like a solid UI library etc., so I always think of the days when I was doing stuff in C++ and ClanLib offered all I needed. Graphics, Sound, GUI, networking etc., so I am always tempted to move back to that. However, C++ is more of a hassle, so stuff in general takes longer to write.

I have even tried writing a SWIG wrapper around ClanLib, but their signal/slot-stuff was pretty much impossible to wrap and I gave up.

With all other languages and game libraries, there seems to be a lot of library-hunting involved. I just haven't found a combination that works for me yet, maybe it is indeed time to try out a few more python options.

You're going to have a hard time finding a single library that does it all and is completely cross platform. I don't know if I would recommend it but you could probably use C# for your Win32 gui code, use managed C++ for the core, and of course use something other than C# for the gui on other platforms. I think you'd be making life harder for yourself that way, though.

The other option is to mix and match your libs, say SDL (or whatever) for your video/input/sound, and something else (probably platform specific) for your gui lib. You could also write your own in SDL, too.

Thug Bonnet
Sep 22, 2004

anime tits ftw

bullet is way, way overkill if you just want to know if things are bumping into each other

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply