Jump to content
  • Advertisement

Archived

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

mrhodes

Pointer Woes :(

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

Hey everyone, I''m having a little trouble that I''m hoping some of you may be able to help me with... I''m trying to setup vertex arrays in opengl, but I seem to be getting snagged on allocating memory using calloc() I have a pointer: GLfloat *tilevertices and I am calling tiletextures = (GLfloat*)calloc(MapWidth * MapHeight * 8, sizeof(GLfloat)); this is returning 0x0000000 (NULL) Any idea what is wrong?? I just wrote a simple program to test this out, and it worked fine... in fact, if I hardcode a smaller map size in there, ie 10, it works. Currently with the map I am loading this works out to be 14400. I tried smaller numbers like 255 and that still didn''t work... Thanks for your assistance Michael Rhodes Tiger Studios Entertainment http://www.tigerstudios.net

Share this post


Link to post
Share on other sites
Advertisement
Well, first I just noticed that your declared variable is different than your allocated variable. Probably just a typo, but I thought that I''d mention it. I would try it with malloc() and see if it works, just to see if the function is the problem (I don''t really think this will work, but it may be worth trying). One thing I''m wondering is if you don''t have enough free memory to allocate.

Hope that helped, post any findings.

Share this post


Link to post
Share on other sites
Double check the values you are passing to it. Display them or debug.

You might be passing huge values without knowing it perhaps?


I would say you have enough ram probably, but that could also be the problem.



Far too much time has passed
For us to lament that we were in love.

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!