From 45bca98b792f8ced1a57ef8c5beed2a90a79d47f Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Mon, 30 Nov 2015 08:47:07 -0500 Subject: switched to 100% new/delete --- src/Texture.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Texture.cpp') diff --git a/src/Texture.cpp b/src/Texture.cpp index 82baa71..8b40513 100644 --- a/src/Texture.cpp +++ b/src/Texture.cpp @@ -53,8 +53,8 @@ namespace Texture{ SDL_FreeSurface(image); // Free the surface - LoadedTexture[LoadedTextureCounter] = (struct texture_t *)malloc(sizeof(struct texture_t)); - LoadedTexture[LoadedTextureCounter]->name = (char *)malloc(safe_strlen(fileName)); + LoadedTexture[LoadedTextureCounter] = new struct texture_t; //(struct texture_t *)malloc(sizeof(struct texture_t)); + LoadedTexture[LoadedTextureCounter]->name = new char[strlen(fileName)+1]; //(char *)malloc(safe_strlen(fileName)); LoadedTexture[LoadedTextureCounter]->tex = object; strcpy(LoadedTexture[LoadedTextureCounter]->name,fileName); LoadedTextureCounter++; @@ -64,17 +64,17 @@ namespace Texture{ } Texturec::Texturec(uint amt, ...){ - image = new GLuint(amt); + texState = 0; + image = new GLuint[amt]; va_list fNames; va_start(fNames, amt); for(int i = 0; i < amt; i++){ - char* f = va_arg(fNames, char*); - image[i] = Texture::loadTexture(f); + image[i] = Texture::loadTexture(va_arg(fNames, char *)); } va_end(fNames); } -void Texturec::bind(int bn){ +void Texturec::bind(unsigned int bn){ texState = bn; glBindTexture(GL_TEXTURE_2D, image[texState]); } -- cgit v1.2.3