2023-11-13 15:05:32 -05:00
|
|
|
// SatDump OpenGL 3 texture functions
|
|
|
|
|
// - Functions in this file will load through gl3w and must be complaint with OpenGL 3+
|
|
|
|
|
// - Functions here should override functions already set up in imgui_image_base.cpp
|
|
|
|
|
// to provide mordern/advanced functionality
|
|
|
|
|
|
2023-11-12 21:48:43 -05:00
|
|
|
#include "imgui/imgui_image.h"
|
|
|
|
|
#include "gl3w/gl3w.h"
|
|
|
|
|
#include "logger.h"
|
|
|
|
|
|
2023-11-13 09:00:28 -05:00
|
|
|
void funcUpdateMMImageTexture_GL3(unsigned int gl_text, uint32_t* buffer, int width, int height)
|
2023-11-12 21:48:43 -05:00
|
|
|
{
|
|
|
|
|
glBindTexture(GL_TEXTURE_2D, gl_text);
|
2023-11-14 08:45:42 -05:00
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
2023-11-12 21:48:43 -05:00
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
|
|
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
|
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
|
|
|
|
glGenerateMipmap(GL_TEXTURE_2D);
|
|
|
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-13 09:00:28 -05:00
|
|
|
void bindAdvancedTextureFunctions()
|
2023-11-12 21:48:43 -05:00
|
|
|
{
|
|
|
|
|
if (gl3wInit())
|
|
|
|
|
{
|
|
|
|
|
logger->critical("Could not init gl3w! Exiting");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
2023-11-13 09:00:28 -05:00
|
|
|
updateMMImageTexture = funcUpdateMMImageTexture_GL3;
|
2023-11-14 08:45:42 -05:00
|
|
|
}
|