diff options
author | chai <chaifix@163.com> | 2018-07-28 10:39:31 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-07-28 10:39:31 +0800 |
commit | 589ee7ee7014a5f8918e1d99c0e04bff4f7a83cb (patch) | |
tree | 8d377c830bcc68afd24b02f97a0811d3d4c50598 /src/libjin/render/drawable.cpp | |
parent | 654a75401775d74f95f3d98611e333bb5641ee9b (diff) |
*update
Diffstat (limited to 'src/libjin/render/drawable.cpp')
-rw-r--r-- | src/libjin/render/drawable.cpp | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/src/libjin/render/drawable.cpp b/src/libjin/render/drawable.cpp deleted file mode 100644 index 0a250cb..0000000 --- a/src/libjin/render/drawable.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "../modules.h" -#if JIN_MODULES_RENDER - -#include "drawable.h" -#include "../math/matrix.h" -#include <stdlib.h> - -namespace jin -{ -namespace render -{ - Drawable::Drawable(int w, int h):texture(0), width(w), height(h), ancx(0), ancy(0), textCoord(0), vertCoord(0) - { - } - - Drawable::~Drawable() - { - glDeleteTextures(1, &texture); - delete[] vertCoord; - delete[] textCoord; - } - - void Drawable::setVertices(float* v, float* t) - { - // render area - if (vertCoord) - delete[] vertCoord; - vertCoord = v; - - // textrue - if (textCoord) - delete[] textCoord; - textCoord = t; - } - - void Drawable::setAnchor(int x, int y) - { - ancx = x; - ancy = y; - } - - void Drawable::draw(int x, int y, float sx, float sy, float r) - { - // Must set textCoord and vertCoord before renderring - if (! textCoord||! vertCoord) return; - - static jin::math::Matrix t; - t.setTransformation(x, y, r, sx, sy, ancx, ancy); - - glEnable(GL_TEXTURE_2D); - - glBindTexture(GL_TEXTURE_2D, texture); - - // push modle matrix - glPushMatrix(); - glMultMatrixf((const GLfloat*)t.getElements()); - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, 0, textCoord); - glVertexPointer(2, GL_FLOAT, 0, vertCoord); - glDrawArrays(GL_QUADS, 0, 4); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_VERTEX_ARRAY); - - // pop the model matrix - glPopMatrix(); - - // bind texture to default screen - glBindTexture(GL_TEXTURE_2D, 0); - - glDisable(GL_TEXTURE_2D); - } -} // render -} // jin - -#endif // JIN_MODULES_RENDER
\ No newline at end of file |