Skip to content

Commit

Permalink
Merge pull request #8 from r-lyeh/master
Browse files Browse the repository at this point in the history
OpenFrameworks 0.8.0 support
  • Loading branch information
stfj committed Jan 19, 2014
2 parents 100b010 + 6b98600 commit ed00bb4
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 32 deletions.
6 changes: 5 additions & 1 deletion README
@@ -1,3 +1,7 @@
ofxSpriteSheetRenderer for OpenFrameworks 0.8.0

---

ofxSpriteSheetRenderer is a fast and easy to use spriteSheet renderer. It supports width/height equal sprite sheets of any size (only pow2 sizes on openGLES), built in animation, scaling, rotation, tinting, flipping, layers and more, all within a super fast batch rendered environment.

ofxSpriteSheetRenderer was written by Zach Gage and Ramsey Nasser
ofxSpriteSheetRenderer was written by Zach Gage and Ramsey Nasser
18 changes: 9 additions & 9 deletions src/CollageTexture.cpp
Expand Up @@ -83,24 +83,24 @@ void CollageTexture::allocate(int w, int h, int internalGlDataType, int internal
#ifndef TARGET_OPENGLES
case GL_RGBA32F_ARB:
case GL_RGBA16F_ARB:
texData.glType = GL_RGBA;
texData.pixelType = GL_FLOAT;
internal.glType = GL_RGBA;
internal.pixelType = GL_FLOAT;
break;

case GL_RGB32F_ARB:
texData.glType = GL_RGB;
texData.pixelType = GL_FLOAT;
internal.glType = GL_RGB;
internal.pixelType = GL_FLOAT;
break;

case GL_LUMINANCE32F_ARB:
texData.glType = GL_LUMINANCE;
texData.pixelType = GL_FLOAT;
internal.glType = GL_LUMINANCE;
internal.pixelType = GL_FLOAT;
break;
#endif

default:
texData.glType = GL_LUMINANCE;
texData.pixelType = GL_UNSIGNED_BYTE;
internal.glType = GL_LUMINANCE;
internal.pixelType = GL_UNSIGNED_BYTE;
}

// attempt to free the previous bound texture, if we can:
Expand All @@ -122,7 +122,7 @@ void CollageTexture::allocate(int w, int h, int internalGlDataType, int internal
// internalGlDataType and glDataType (GL_LUMINANCE below)
// can be different; on ES they must be exactly the same.
// glTexImage2D(texData.textureTarget, 0, texData.glTypeInternal, (GLint)texData.tex_w, (GLint)texData.tex_h, 0, GL_LUMINANCE, PIXEL_TYPE, 0); // init to black...
glTexImage2D(texData.textureTarget, 0, texData.glTypeInternal, (GLint)texData.tex_w, (GLint)texData.tex_h, 0, texData.glType, texData.pixelType, 0); // init to black...
glTexImage2D(texData.textureTarget, 0, texData.glTypeInternal, (GLint) texData.tex_w, (GLint) texData.tex_h, 0, internal.glType, internal.pixelType, 0); // init to black...
#else
glTexImage2D(texData.textureTarget, 0, texData.glTypeInternal, texData.tex_w, texData.tex_h, 0, texData.glTypeInternal, GL_UNSIGNED_BYTE, 0);
#endif
Expand Down
7 changes: 6 additions & 1 deletion src/CollageTexture.h
Expand Up @@ -56,7 +56,12 @@ class CollageTexture : public ofTexture
int c_type;

protected:


struct {
GLenum glType;
GLenum pixelType;
} internal;

int getIndex(int x, int y);
};

Expand Down
20 changes: 10 additions & 10 deletions src/LinearTexture.cpp
Expand Up @@ -73,24 +73,24 @@ void LinearTexture::allocate(int w, int h, int internalGlDataType, bool bUseARBE
#ifndef TARGET_OPENGLES
case GL_RGBA32F_ARB:
case GL_RGBA16F_ARB:
texData.glType = GL_RGBA;
texData.pixelType = GL_FLOAT;
internal.glType = GL_RGBA;
internal.pixelType = GL_FLOAT;
break;

case GL_RGB32F_ARB:
texData.glType = GL_RGB;
texData.pixelType = GL_FLOAT;
internal.glType = GL_RGB;
internal.pixelType = GL_FLOAT;
break;

case GL_LUMINANCE32F_ARB:
texData.glType = GL_LUMINANCE;
texData.pixelType = GL_FLOAT;
internal.glType = GL_LUMINANCE;
internal.pixelType = GL_FLOAT;
break;
#endif

default:
texData.glType = GL_LUMINANCE;
texData.pixelType = GL_UNSIGNED_BYTE;
internal.glType = GL_LUMINANCE;
internal.pixelType = GL_UNSIGNED_BYTE;
}

// attempt to free the previous bound texture, if we can:
Expand All @@ -112,9 +112,9 @@ void LinearTexture::allocate(int w, int h, int internalGlDataType, bool bUseARBE
// internalGlDataType and glDataType (GL_LUMINANCE below)
// can be different; on ES they must be exactly the same.
// glTexImage2D(texData.textureTarget, 0, texData.glTypeInternal, (GLint)texData.tex_w, (GLint)texData.tex_h, 0, GL_LUMINANCE, PIXEL_TYPE, 0); // init to black...
glTexImage2D(texData.textureTarget, 0, texData.glTypeInternal, (GLint)texData.tex_w, (GLint)texData.tex_h, 0, texData.glType, texData.pixelType, 0); // init to black...
glTexImage2D(texData.textureTarget, 0, texData.glTypeInternal, (GLint) texData.tex_w, (GLint) texData.tex_h, 0, internal.glType, internal.pixelType, 0); // init to black...
#else
glTexImage2D(texData.textureTarget, 0, texData.glTypeInternal, texData.tex_w, texData.tex_h, 0, texData.glTypeInternal, GL_UNSIGNED_BYTE, 0);
glTexImage2D(texData.textureTarget, 0, texData.glTypeInternal, texData.tex_w, texData.tex_h, 0, internal.glTypeInternal, GL_UNSIGNED_BYTE, 0);
#endif


Expand Down
7 changes: 6 additions & 1 deletion src/LinearTexture.h
Expand Up @@ -22,4 +22,9 @@ class LinearTexture : public ofTexture

int width;
int height;
};

struct {
GLenum glType;
GLenum pixelType;
} internal;
};
18 changes: 9 additions & 9 deletions src/PixelTexture.cpp
Expand Up @@ -73,24 +73,24 @@ void PixelTexture::allocate(int w, int h, int internalGlDataType, bool bUseARBEx
#ifndef TARGET_OPENGLES
case GL_RGBA32F_ARB:
case GL_RGBA16F_ARB:
texData.glType = GL_RGBA;
texData.pixelType = GL_FLOAT;
internal.glType = GL_RGBA;
internal.pixelType = GL_FLOAT;
break;

case GL_RGB32F_ARB:
texData.glType = GL_RGB;
texData.pixelType = GL_FLOAT;
internal.glType = GL_RGB;
internal.pixelType = GL_FLOAT;
break;

case GL_LUMINANCE32F_ARB:
texData.glType = GL_LUMINANCE;
texData.pixelType = GL_FLOAT;
internal.glType = GL_LUMINANCE;
internal.pixelType = GL_FLOAT;
break;
#endif

default:
texData.glType = GL_LUMINANCE;
//texData.pixelType = GL_UNSIGNED_BYTE;
internal.glType = GL_LUMINANCE;
//internal.pixelType = GL_UNSIGNED_BYTE;
}

// attempt to free the previous bound texture, if we can:
Expand All @@ -112,7 +112,7 @@ void PixelTexture::allocate(int w, int h, int internalGlDataType, bool bUseARBEx
// internalGlDataType and glDataType (GL_LUMINANCE below)
// can be different; on ES they must be exactly the same.
// glTexImage2D(texData.textureTarget, 0, texData.glTypeInternal, (GLint)texData.tex_w, (GLint)texData.tex_h, 0, GL_LUMINANCE, PIXEL_TYPE, 0); // init to black...
glTexImage2D(texData.textureTarget, 0, texData.glTypeInternal, (GLint)texData.tex_w, (GLint)texData.tex_h, 0, texData.glType, texData.pixelType, 0); // init to black...
glTexImage2D(texData.textureTarget, 0, texData.glTypeInternal, (GLint) texData.tex_w, (GLint) texData.tex_h, 0, internal.glType, internal.pixelType, 0); // init to black...
#else
glTexImage2D(texData.textureTarget, 0, texData.glTypeInternal, texData.tex_w, texData.tex_h, 0, texData.glTypeInternal, GL_UNSIGNED_BYTE, 0);
#endif
Expand Down
7 changes: 6 additions & 1 deletion src/PixelTexture.h
Expand Up @@ -22,4 +22,9 @@ class PixelTexture : public ofTexture

int width;
int height;
};

struct {
GLenum glType;
GLenum pixelType;
} internal;
};

0 comments on commit ed00bb4

Please sign in to comment.