summary refs log tree commit diff
path: root/src/GFX
diff options
context:
space:
mode:
Diffstat (limited to 'src/GFX')
-rw-r--r--src/GFX/Image/PPMParser.cpp2
-rw-r--r--src/GFX/Image/RawImage.hpp4
-rw-r--r--src/GFX/Shading/Program.cpp4
-rw-r--r--src/GFX/Shading/Program.hpp1
4 files changed, 8 insertions, 3 deletions
diff --git a/src/GFX/Image/PPMParser.cpp b/src/GFX/Image/PPMParser.cpp
index b809ef1..31be0ab 100644
--- a/src/GFX/Image/PPMParser.cpp
+++ b/src/GFX/Image/PPMParser.cpp
@@ -17,7 +17,7 @@ RawImage PPMParser::parse() {
 
     auto pixel_count = header.width * header.height;
 
-    RawImage image(pixel_count, header.width, header.height, 3);
+    RawImage image(header.width, header.height, 3);
     for (uint64_t pixel_index = 0; pixel_index < pixel_count; pixel_index++) {
         RawImage::Pixel pixel = parse_pixel(header.max_color);
         image.add(pixel);
diff --git a/src/GFX/Image/RawImage.hpp b/src/GFX/Image/RawImage.hpp
index 916671b..2b10cb0 100644
--- a/src/GFX/Image/RawImage.hpp
+++ b/src/GFX/Image/RawImage.hpp
@@ -10,9 +10,9 @@ class RawImage {
 public:
     RawImage() : m_pixels(), m_width(0), m_height(0), m_channels(0) {};
 
-    explicit RawImage(size_t pixel_count, uint32_t width, uint32_t height, uint8_t channels)
+    explicit RawImage(uint32_t width, uint32_t height, uint8_t channels)
         : m_pixels(), m_width(width), m_height(height), m_channels(channels) {
-        m_pixels.reserve(pixel_count);
+        m_pixels.reserve(width * height);
     }
 
     struct Pixel {
diff --git a/src/GFX/Shading/Program.cpp b/src/GFX/Shading/Program.cpp
index 2b675f8..6efb30b 100644
--- a/src/GFX/Shading/Program.cpp
+++ b/src/GFX/Shading/Program.cpp
@@ -29,6 +29,10 @@ void Program::bind() const {
     glUseProgram(m_program);
 }
 
+void Program::unbind() const {
+    glUseProgram(0);
+}
+
 Uniform Program::uniform(const std::string& name) const {
     auto index = glGetUniformLocation(m_program, name.c_str());
 
diff --git a/src/GFX/Shading/Program.hpp b/src/GFX/Shading/Program.hpp
index b04dfff..b7db953 100644
--- a/src/GFX/Shading/Program.hpp
+++ b/src/GFX/Shading/Program.hpp
@@ -17,6 +17,7 @@ public:
     Uniform uniform(const std::string& name) const;
 
     void bind() const;
+    void unbind() const;
 
 private:
     uint32_t m_program;