diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2015-10-22 09:23:08 -0400 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2015-10-22 09:23:08 -0400 |
commit | c6739a753e31e8d239b662fbfc7d9ac7e7c0621e (patch) | |
tree | b481b819ef312f00567401adce4caab05127188d /src/common.cpp | |
parent | fd79887f68775b781ed7f00b98aea28f1d9caa4d (diff) |
Commented more of entities, added new texture namespace and class
Diffstat (limited to 'src/common.cpp')
-rw-r--r-- | src/common.cpp | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/src/common.cpp b/src/common.cpp index 660ed9d..cd568ad 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -1,31 +1,8 @@ #include <common.h> +#include <cstdio> #define DEBUG -GLuint loadTexture(const char *fileName){ - SDL_Surface *image = IMG_Load(fileName); - - if(!image)return 0; -#ifdef DEBUG - DEBUG_printf("Loaded image file: %s\n", fileName); -#endif // DEBUG - unsigned object = 0; //creates a new unsigned variable for the texture - - glGenTextures(1, &object); //turns "object" into a texture - glBindTexture(GL_TEXTURE_2D, object); //binds "object" to the top of the stack - - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); //sets the "min" filter - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); //the the "max" filter of the stack - - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); //Wrap the texture to the matrix - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); //Wrap the texutre to the matrix - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image->w, image->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels); //sets the texture to the image file loaded above - - SDL_FreeSurface(image); //Free surface - return object; -} - void DEBUG_prints(const char* file, int line, const char *s,...){ va_list args; printf("%s:%d: ",file,line); |