aboutsummaryrefslogtreecommitdiff
path: root/src/ogl.cpp
blob: a7b2dfa7420f381ce7608436270b93ec51112d19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "ogl.hpp"

#include <imgui_impl_opengl3_loader.h>

OglImage::OglImage() {
    glGenTextures(1, &glHandle);
}

OglImage::~OglImage() {
    glDeleteTextures(1, &glHandle);
}

void OglImage::upload(const char* data, int w, int h) {
    glBindTexture(GL_TEXTURE_2D, glHandle);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
}