Skip to main content
gamedev.net
🔒 Locked

GLuint

Started by DarkMonkey 0 replies 1.1k views
Original Post
DarkMonkey
DarkMonkey
hmmm, I was playing around and had a variable that was a GLuint.
 GLuint num = 100;  
Then I would substract a random number for it every few ticks.
 num -= rand()%10 + 1;  
After that I would check to see if it was below 0 and, if so, set it to 100.
 if(num <= 0) num = 100;  
The only problem is that every once in a while, num would go below 0 and would not go back to 100. Then it would stay below 0. This does not happen when I use int instead of GLuint. As I wrote this, I understand why it happend. GLint works fine. And that is because GLuint is unsigned so there is no comparing if it is negative, only if it was 0. Sorry, but I''d thought I''d post anyway. later
Larz
Larz
Yeah,

check this out

for (unsigned int i = list_size - 1; i >= 0; i--)
...

I never expect a for loop to be infinite. >:{
Live free or DIE!!!!"My wife is not a doobie, to be passed around." --Homer Simpson.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.