View Full Version : MD2 weapons rendering
I wonder how to render quake 2 weapons, as they are in quake 2. I mean they stay in the right place on screen. But of course they are actually rotated (for light applying). And my question is how to do this. Well, i tried just glRotate, glTranslate etc... but models should be centered at (0,0,0) or the results aren't like they should be. Should I use the info from each frame (scale and translate vectors)???
02-20-2005, 04:07 PM
draw your world
draw your weapon
it's just one way
Actually, one of the easiest ways is to draw it before you rotate and translate your scene/camera. Usually at the very beggining of your scene code ,right after Clear Color|detph and loadIdentity and right before you're camera/scene translations.
Assuming it's a first person jig, then,it will always be right at point origin and "staty there" since its drawn before any camera/scene or world translations/rotations.
Well, to be more precisely:
When I load a md2 model (decompresing vertices to full float format - using scale and transalte vectors of frame) I get a Big F*** Gun, virtually. The gun is quite big and not centered. So I should translate model to make it near (0,0,0) for proper rotation. But how will I know how much to translate it. Hard-coded?, ok. But if i will want to load another weapon. I think this post represents problem more exact.
You can translate/rotate/scale the weapon as much as you like and it will not rotate/translate/scale with the rest of the scene because it's drawn before scene/camera rotations.
It will always be at/near point origin in the above scenario after you move to there.
to know "how much" you should translate/rotate/scale... is done according to personal preferences.
But, check and mess around with your near plane value as well, if you're using glu perspective...Cahnge it from 0.1f upwards, little by little.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.