Skip to main content
gamedev.net
🔒 Locked

Redimension Texture Array

Started by Nosaj 0 replies 150+ views
Original Post
Nosaj
Nosaj
How do I redimension LPDIRECT3DTEXTURE8 array, or any other pointer to a pointer array? I keep getting memory leaks, and when I use new it screws up everything before the object I last added. Is there a better way of do this than I am? This is the code I use: // Global Texture Array LPDIRECT3DTEXTURE8*texture=NULL; // Function To Add Textures To Array int LoadTexture(char *file_name,long color_key=0,long mip_levels=D3DX_DEFAULT,long filter=D3DX_DEFAULT,long mip_filter=D3DX_DEFAULT){ texture=new LPDIRECT3DTEXTURE8[num_textures]; if(FAILED(D3DXCreateTextureFromFileEx(d3d_device,file_name,D3DX_DEFAULT,D3DX_DEFAULT,mip_levels,D3DUSAGE_RENDERTARGET,D3DFMT_UNKNOWN,D3DPOOL_DEFAULT,filter,mip_filter,color_key,NULL,NULL,&texture[num_textures])))return -1; // Return Referential Index To Array return num_textures++; }// end LoadTexture // Code That Delete The Textures if(texture){ for(i=0;i!=NULL)texture[i]->Release(); delete[]texture; }// end if Thanks for any help you can give me.

Topic Locked

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

Sign in to reply to this topic.