just a minor refactor, nothing special

This commit is contained in:
MihailRis
2024-04-23 02:00:03 +03:00
parent 6e2bc9ca95
commit 9f2bceb039
67 changed files with 143 additions and 143 deletions
+29
View File
@@ -0,0 +1,29 @@
#ifndef GRAPHICS_CORE_GL_UTIL_H_
#define GRAPHICS_CORE_GL_UTIL_H_
#include "commons.hpp"
#include "ImageData.hpp"
#include <GL/glew.h>
namespace gl {
inline GLenum to_glenum(ImageFormat imageFormat) {
switch (imageFormat) {
case ImageFormat::rgb888: return GL_RGB;
case ImageFormat::rgba8888: return GL_RGBA;
default:
return 0;
}
}
inline GLenum to_glenum(DrawPrimitive primitive) {
static const GLenum primitives[]{
GL_POINTS,
GL_LINES,
GL_TRIANGLES
};
return primitives[static_cast<int>(primitive)];
}
}
#endif // GRAPHICS_CORE_GL_UTIL_H_