Skip to main content
GameDev.net gamedev.net
🔒 Locked

Pointer Woes :(

Started by mrhodes Oct 21, 2003 at 9:12 PM 1 replies 450+ views
Original Post
mrhodes
mrhodes
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
Michael RhodesTiger Studios Web Designhttp://tigerstudios.net
eriel
eriel
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.
Senses777
Senses777
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.
"I want to make a simple MMORPG first" - Fenryl

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.