PDA

View Full Version : Adjacent Cubes and text!



Esash
04-19-2010, 09:31 AM
Hi All,

I am a rather new programmer in OpenGl. I want to draw an nxn grid wherein, each cell of the grid is a wire cube. I need to write random numbers in each of these cubes and, access them independently. All that I could do was

glutWireCube(1) where, I knew the argument is length of the cube. But, what is the unit? Is it 1cm?

I used 2 for loops to construct the cube grid as follows:

float a[3];
for(i=0; i<n; i++)
for(j=0; j<n; j++)
a[0]=j;
a[1]=i;
a[2]=j;

glutWireCube(1);

But this gives me only 1 cube for any value of n- the size of the grid.

Please help me solve this.

I also have to insert a randomly generated number in each of these cubes, and so, i used,

glutBitmapCharacter(font, 'A');

But, I get nothing but a blank screen for this.

Please help.
Thanks a lot, in advance.

Esash