Archived

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

mrhodes

Pointer Woes :(

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
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