Jump to content
  • Advertisement

Archived

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

Dark Rain

How do I store my texture in a dynamic array?

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

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?

Share this post


Link to post
Share on other sites
Advertisement
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 !

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!