Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

UponTheEnd

Quick Question Thx.

This topic is 5663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i got a quick question. right now i am looking at this first person shooter game source code and he is using huge values in glVertex3f() like 300, 100, -321 or whatever. just much bigger values than usual. so i went to how he set up his viewing stuff and he used this line: gluPerspective(60.0f,(GLdouble)width/(GLdouble)height,1.0f,1250.0f); but in nehes tutorials and such, when they do that same thing, and they use really small values like 1.0 and stuff in glVertex3f() and it covers a big area. how is he using such big values, how is he doing that. the url to the source code is: http://www.gldomain.com/programs/FirstPersonShooter.zip well thanks. i hope you understood what i said up that. i was alittle hasty, i have school.... well thanks alot

Share this post


Link to post
Share on other sites
Advertisement
Have you ever looked at a professional level editor for a FPS (QRadiant, UnrealEd, etc.). Did you notice that the default size value for most objects is 128, not 0.2 or anything that small - in "real" projects you should stick to any value scale that you find most appropriate - for example you could introduce the metric system, 100 opengl space units being equal to 100 cm. Since the available space in which you can build your world is "infinite" to you, the programmer, meaning that you''ll probably never be needing more than is made available for you, there is no reason to cramp the numbers in really small values...

Hope this clears it up for you,
Crispy

Share this post


Link to post
Share on other sites
That cleared up alot for me.
the next thing i need is to know how to put scaling in my program.
what code do i have to put in to make it so i can use bigger values for glVertex3f()
how do i make the world measauring units bigger is what am saying..
thanks for the reply

Share this post


Link to post
Share on other sites
you just use bigger numbers, there''s nothing special you have to do. it doesn;t matter what scale you use as long as you stick to it all the time. the numbers you use are relative to each other so something that is 100 wide and is 100 away from the camera looks the same as something which is 1 wide and 1 away.

Share this post


Link to post
Share on other sites
quote:
Original post by Crispy
Since the available space in which you can build your world is "infinite" to you


er... let "infinite" = constrained by max_float value though, no?

this is actually a question that''s been bothering me for a little while as i settle in on a model scale for my engine. if you use big numbers, don''t you un-necesesarily constrain the size of your world? i guess likewise, if you make the numbers to small you limit the precision with which you can move objects about in the world b/c you would run into floating-point precision barriers.

yes/no??

-me

Share this post


Link to post
Share on other sites
Ha thanks alot for the answers so quick
you guys are great!
Thanks


One more thing,
say you want to make a hud.
and your camera moves around everywhere.
how do you make the little text in the corner of the screen always move with the camera instead of just staying in the place where you first rendered it.
i saw some code like:
pustmatrix
loadidenty
draw the hud
popmatrix


they may work but it doesnt make sense to me. doesnt that just reload everything to its orignal settings and yu would still render the hud in the same place everytime..
well thanks

Share this post


Link to post
Share on other sites
I''m not a GL programmer, bear with me.

I''d suspect that you get the position of the camera and draw it right at whatever depth the camera is at in GL_ORTHO_2D mode. Someone correct me, I''m bound to be wrong.

Share this post


Link to post
Share on other sites
what i always do is draw things like the hud before i translate the cammera, that way everything that stays put is drawn before the world goes moving around.

-------------------------------------------------
Don''t take life too seriously, you''''ll never get out of it alive. -Bugs Bunny

Share this post


Link to post
Share on other sites
I may be wrong, pleaes correct me

You said you draw the hud before you do anything else with the carmera and such so the hud stays put.
what i dont see is that you draw the hud, then you move the camera in another direction and draw the world. So you could be looking in the opposite direciton of where the hud really is so you would never see the hud..
that is probley wrong, please correct me.
i really want to learn..
thanks for the replys

Share this post


Link to post
Share on other sites
Draw the HUD in ortho mode as stated by SuperRoy (though it''s not done quite like he stated) - look into glOrtho(). It doesn''t matter when you draw the HUD - you can switch to orthogonal mode at any time during the drawing of you scene. As a sidenote, if you don''t want 3d text or perspective text (so that it gets smaller if it''s farther away), always draw it in ortho mode - there are, naturally, a bunch of other uses for it too. See that Nehe''s tutorial where he introduces the "lines" kind of game (I think it was 21) for how to switch to ortho mode and back if you can''t figure it out from the help.

Palidine - that''s why I put infinite in quotation marks

Crispy

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!