Don't delete the texture data after sending it to OpenGL.

This commit is contained in:
ehofman
2003-07-10 09:14:34 +00:00
parent db1966c156
commit 8871655a9b
2 changed files with 3 additions and 11 deletions
+1 -4
View File
@@ -39,7 +39,7 @@ SGTexture::~SGTexture()
delete texture_data; delete texture_data;
} }
if ( texture_id >= 0 ) { if ( texture_id != 0 ) {
free_id(); free_id();
} }
} }
@@ -331,7 +331,6 @@ SGTexture::read_r8_texture(const char *name)
} }
#if 0
void void
SGTexture::set_pixel(GLuint x, GLuint y, sgVec3 &c) SGTexture::set_pixel(GLuint x, GLuint y, sgVec3 &c)
{ {
@@ -352,8 +351,6 @@ SGTexture::get_pixel(GLuint x, GLuint y)
return &c; return &c;
} }
#endif
SGTexture::ImageRec * SGTexture::ImageRec *
SGTexture::ImageOpen(const char *fileName) SGTexture::ImageOpen(const char *fileName)
+2 -7
View File
@@ -67,7 +67,7 @@ protected:
#else #else
glDeleteTexturesEXT(1, &texture_id); glDeleteTexturesEXT(1, &texture_id);
#endif #endif
texture_id = -1; texture_id = 0;
} }
@@ -83,7 +83,7 @@ public:
void read_raw_texture(const char *name); void read_raw_texture(const char *name);
void read_r8_texture(const char *name); void read_r8_texture(const char *name);
inline bool usable() { return texture_data ? true : false; } inline bool usable() { return (texture_id > 0) ? true : false; }
inline GLuint id() { return texture_id; } inline GLuint id() { return texture_id; }
inline GLubyte *texture() { return texture_data; } inline GLubyte *texture() { return texture_data; }
@@ -99,20 +99,15 @@ public:
void prepare(unsigned int width = 256, unsigned int height = 256); void prepare(unsigned int width = 256, unsigned int height = 256);
void finish(unsigned int width, unsigned int height); void finish(unsigned int width, unsigned int height);
#if 0
// texture pixel manipulation functions. // texture pixel manipulation functions.
void set_pixel(GLuint x, GLuint y, sgVec3 &c); void set_pixel(GLuint x, GLuint y, sgVec3 &c);
sgVec3 *get_pixel(GLuint x, GLuint y); sgVec3 *get_pixel(GLuint x, GLuint y);
#endif
void bind(); void bind();
inline void select() { inline void select() {
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB,
texture_width, texture_height, 0, texture_width, texture_height, 0,
GL_RGB, GL_UNSIGNED_BYTE, texture_data ); GL_RGB, GL_UNSIGNED_BYTE, texture_data );
delete texture_data;
texture_data = 0;
} }
// Nowhere does it say that resident textures have to be in video memory! // Nowhere does it say that resident textures have to be in video memory!