View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# How do I store my texture in a dynamic array?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

### #1Code Herder  Members

Posted 06 September 2001 - 03:15 PM

I was reading the redbook and for those who read it, you know that they always use the checkboard texture that they generate proceduraly. Well it was all fine and good but I wanted my own texture (wonders of wonders). So, after writting the loading code etc I tried to store it in an array like the checkboard but I ran in a problem, I couldnt declare an array this way : int *Image; Image = new int[Width][Height][3]; I can only do it when it''s not a pointer, so I thought : hey no biggies, I''ll do a one dimension array. So, I toyed around with the checkboard example and did the following : < #define checkImageWidth 64 #define checkImageHeight 64 //GLubyte checkImage[checkImageHeight][checkImageWidth][3]; GLubyte checkImage[checkImageHeight * checkImageWidth * 3]; void makeCheckImage(void) { int i, j, c; for (i = 0; i < checkImageHeight; i++) { for (j = 0; j < checkImageWidth; j++) { c = ((((i&0x8)==0)^((j&0x8))==0))*255; checkImage[(i * checkImageWidth) + 0] = (GLubyte) c; checkImage[(i * checkImageWidth) + 1] = (GLubyte) c; checkImage[(i * checkImageWidth) + 2] = (GLubyte) c; } } } Of course since I''m writting this, it doesnt work at all. So, what did I miss, how do ppl store the textures usualy, before they load them into vram?

### #2Code Herder  Members

Posted 06 September 2001 - 04:07 PM

I um guess I was tired, it hit me right away after a small break. Guess I had been working for too long. Sorry for wasting your time guys !

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.