From ed08b673c50b076042d8f0c49501372168142764 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 16 Feb 2018 16:04:32 -0500 Subject: Refactored renderer Renderer is basically now more C++'y, as it makes more use of classes (a lot of GL types have been wrapped), and the renderer itself is now a class. The monitor mesh is also now indexed. Tweaked the NTSC artifacting after inadvertently fixing a bug with the way the image was loaded. --- src/renderer/texture.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/renderer/texture.h (limited to 'src/renderer/texture.h') diff --git a/src/renderer/texture.h b/src/renderer/texture.h new file mode 100644 index 0000000..3aa8773 --- /dev/null +++ b/src/renderer/texture.h @@ -0,0 +1,52 @@ +#ifndef TEXTURE_H_84EC6DF6 +#define TEXTURE_H_84EC6DF6 + +#include "wrappers.h" + +struct Rectangle { + int x; + int y; + int w; + int h; +}; + +class Texture { +public: + + Texture(int width, int height); + + Texture(const char* file); + + Texture(const Texture& tex); + + Texture(Texture&& tex); + + Texture& operator= (Texture tex); + + friend void swap(Texture& tex1, Texture& tex2); + + Rectangle entirety() const; + + inline GLuint getId() const + { + return texture_.getId(); + } + + inline int getWidth() const + { + return width_; + } + + inline int getHeight() const + { + return height_; + } + +private: + + GLTexture texture_; + int width_; + int height_; +}; + +#endif /* end of include guard: TEXTURE_H_84EC6DF6 */ -- cgit 1.4.1