graphics

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit c9749c1b8c639461ed95fcb4fb7dfd3dfdd94077
parent f59306730f160dec8020600b306c15595e583e3c
Author: Brian Swetland <swetland@frotz.net>
Date:   Sat, 22 Jun 2013 06:08:22 -0700

app,texture: accessors for width/height

Diffstat:
Mcommon/app.h | 7++++++-
Mcommon/buffers.cc | 2++
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/common/app.h b/common/app.h @@ -92,7 +92,9 @@ struct Program { struct Texture2D { unsigned id; - Texture2D() : id(0) {}; + unsigned width; + unsigned height; + Texture2D() : id(0), width(0), height(0) {}; ~Texture2D() { if (id) { glDeleteTextures(1, &id); } }; int load(const char *fn, int genmips); int load(void *data, unsigned w, unsigned h, int genmips); @@ -152,6 +154,9 @@ public: int start(void); void handleEvents(void); + int getWidth(void) { return width; } + int getHeight(void) { return height; } + protected: int width; int height; diff --git a/common/buffers.cc b/common/buffers.cc @@ -149,6 +149,8 @@ int Texture2D::load(void *data, unsigned w, unsigned h, int genmips) { glGenerateMipmap(GL_TEXTURE_2D); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + width = w; + height = h; return 0; }