   Ammo counters on weapons
  Can anyone tell me how ammo counters on weapons work(i mean that the counter is the model of the gun)Example:http://www.gamesdomain.com/gdreview/zones/reviews/pc/nov99/unrealt1.jpg 
  The text is simply drawn to a part of the weapon''s texture, then the gun is rendered normally.-Nik ;  Wouldn''t that mean updating the texture each time ammo is used? Surely a better way would be to have two quads for the display, then just choose the appropriate texture coordinates from your font texture? You could do it in a vertex shader, just have the quads textures at the start of the font texture, then set a VS constant for the digits, and just perform something like TU = TU * CharWidth in your VS. It would mean you wouldn''t have to update your texture each time the ammo count changes. Isn''t it always best to avoid updating textures?   ---------------------------------------Let''s struggle for our dream of Game!http://andrewporritt.4t.com;quote:Original post by f8k8  Wouldn''t that mean updating the texture each time ammo is used? Surely a better way would be to have two quads for the display, then just choose the appropriate texture coordinates from your font texture? You could do it in a vertex shader, just have the quads textures at the start of the font texture, then set a VS constant for the digits, and just perform something like TU = TU * CharWidth in your VS. It would mean you wouldn''t have to update your texture each time the ammo count changes. Isn''t it always best to avoid updating textures?   You''re right. Changing texcoords with shader is a faster solution than updating the texture, since that avoids locking and copying the texture memory. However, that is just an optimization technique - I believe, judging by the OP''s question, that he/she is a novice in 3d programming and therefore the simpler the answer, the better.kind rgds,-Nik ;  Well I'm actualy, I'm not a programmer at all, I'm a 3d artist & project leader of Parallel Future Mod, and my team had a debate about how hard is it to make a counter on weapons, as we don't want to have a normal HUD in our mod. So the question is how to make that kind of function as fast/simple as possible.   [edited by - Skorc on February 3, 2004 9:26:45 AM];  The easiest way would probably be to have a texture with the digits 0 - 9 on it.  Store the vertices for these numbers in an array, and render to the texture with DrawPrimitiveUP (I assume you can do this?).  Have a function that takes in the number of bullets left and assigns the appropriate texture coordinates.   ___________________________________________________________Proceeding on a brutal rampage is the obvious choice.Where to find the intensity  (Updated Jan 23, 2004) ;  Well I put your mod name into google and it appears your are doing an HL2 mod.  The HL2 SDK is meant to be similar to the HL SDK in which case you should have no problem coding this sort of thing (as long as your coder is up to scratch).  As previous people in the thread have said, just have a texture image with the digits 0 - 9 in it and then alter the texture coords on a quad so it shows different digits.  If you put two quads side by side you can then the display read up to 99, more quads means more numbers. ;  yes we are HL2 mod team, but Valve is delaying the Geme&SDK release date, so we''ll probably switch tho the first game that will have similar features, probably Far Cry or Battlefield Vietnam, it really sux when you don''t have your own game engine :/   Les yeux sans visage... 