Jump to content
  • Advertisement


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


General Questions

This topic is 6773 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

Ok, I have a few general questions that I hope maybe someone can help me with. question 1: Question about floating points. I know that the processor sees only 1''s and 0''s, with that in mind how does it handle floating points? example, I know 16 = 10000 = 0x10 but how do you make 16.1 or 16.555 or 16.324543 into a binary number? I know people say it''s faster to use integers rather than decimals. The reason I know this is because people tell me. I have been told it''s faster but never have been told why it''s faster. So, why is it faster? question 2: The pre-processor #pragma. When is this pre-processor used? I see it in some professional programs but never really see it in general programs. I looked in the helf files but in my opinion it''s kinda crypic so I thought maybe someone can tell me what it means in english?? question 3: What is the difference between aligning data addresses in 4 bytes and aligning data addresses in 16 bytes? Also, what does it mean by data being aligned too? question 4: I know that sprites are bitmap images used for animation. What''s the differnce between bitmaps moving around on a screen and a sprite? question 5: The last question is about algorithm. When your first starting to learn graphics programming, is it better to use a algorithm that is already out there or is it better to come up with your own stuff? Like line algorithems, would it be better to use all the algorithms out there in computer books or come up with your own? question 6: About Assembly. Does anyone know where I can read about 32 bit assembly? Maybe recommend a book or something. I sure hope someone could help me with some of these questions. Thanks in advance! Michael

Share this post

Link to post
Share on other sites
1. Floating Point
Ok, in decimal you represent numbers like:
A is the tens place
B is the ones place
C is the tenths place
and D is the hundreths place
In binary
A would be the twos place
B would be the ones place
C would be the halves place
and D is the quarters place

Numbers past the decimal are sucessively one half the one before.
So .11 is 1/2 + 1/4 or .75
.101 is 1/2 + 0/4 + 1/8 or 5/8.

Now we''ve got numbers like 10111.111.
That equivalent to 1.0111111 * 2^4.
Or .0010101 is 1.0101 * 2^-3.
So instead of storing 10111.111 it stores 1.0111111 and 4
And instead of storing .0010101 it stores 1.0101 and -3
But the first number is always 1 In this representation so we only need to store .0111111 and 4 or .0101 and -3

In the IEEE single precision floating point format the first bit is a sign bit, the next 23 bits are the precision bits and the last 8 bits are the exponent. Actually stored is the exponent plus 128 (or is it 127?).

2. #pragma
#pragma is used to twiddle with compiler specific compiling settings. (like byte alignment) You''d really have to see your compiler help docs for more help.

3. Data alignment
When data is aligned by 4 bytes, it basically means that it''s addressed is divisible by 4. Similar for 16. Some operations are more efficient when they are properly aligned.

Not much.

Generally it''s better to go with pre-existing algorithms if you aren''t in research. (i.e. just trying to put together a game vs. trying to put together a revolutionary game)

Can''t really recommend any good sources.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!