Jump to content

  • Log In with Google      Sign In   
  • Create Account


lucaswrk

Member Since 05 Aug 2012
Offline Last Active May 24 2013 01:18 PM

Posts I've Made

In Topic: C++ vector/matrix size question

10 August 2012 - 05:32 AM

so, in an abstract way, it works like this (?):

int array[5][5];

0x0001
0x0002
0x0003
0x0004
0x0005
0x0006
0x0007
0x0008
0x0009
0x000A
0x000B
0x000C
0x000D
...

int* value = array+1..5	   //for looking up a column value from line 1
int* value = array+6+1..5   //for looking up a column value from line 2
//and so on.

?

thank you.

In Topic: Random glClearColor values

05 August 2012 - 01:57 PM


glClearColor(rand()%256, rand()%256, rand()%256, 1.0);

Your alpha value is 1.0. You probably meant 255 Posted Image.

Edit: It's also possible that glClearColor expects floats clamped to 1.0, in which case it's highly likely you're always getting white since rand()%256 will usually be nonzero. Try dividing the results of that calculation by 255.0f to find out. (Or check the documentation... either way, don't mix clamped floats and integer formats.)


yeah, that was the problem! x >= 1.0 will be the color max value, that's why my screen was getting white every time. Exactly as you said.
heres the correct code (with jouley's hint), if someone is interested..

float r = rand()%256 / 255.0f;
float g = rand()%256 / 255.0f;
float b = rand()%256 / 255.0f;
glClearColor(r, g, b, 1.0);

thank you @jouley!

PARTNERS