Fix OpenGL 1280 on Windoze
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 2m2s

This commit is contained in:
2025-02-19 21:06:38 -05:00
parent 59df950e11
commit 4ee84d6442
4 changed files with 8 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ void J2D::Begin(RenderTarget* render_target, bool clear_buffers) {
current_state = new_state;
if (current_state.current_render_target)
JGL::RenderTarget::SetActiveGLRenderTarget(*current_state.current_render_target);
RenderTarget::SetActiveGLRenderTarget(*current_state.current_render_target);
if (render_target != nullptr && clear_buffers) {

View File

@@ -184,6 +184,7 @@ void JGL::State::RestoreState(const State& state) {
else
glDisable(GL_BLEND);
glActiveTexture(GL_TEXTURE0 + state.selected_texture_unit);
glClientActiveTexture(GL_TEXTURE0 + state.selected_texture_unit);
@@ -198,13 +199,14 @@ void JGL::State::RestoreState(const State& state) {
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
if (state.color_array)
glEnable(GL_COLOR_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
else
glDisable(GL_COLOR_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glBindFramebuffer(GL_FRAMEBUFFER, state.current_fbo);
glViewport(state.viewport[0], state.viewport[1], state.viewport[2], state.viewport[3]);
glClearColor(state.clear_color[0], state.clear_color[1], state.clear_color[2], state.clear_color[3]);
glColor4f(state.draw_color[0], state.draw_color[1], state.draw_color[2], state.draw_color[3]);
glBlendFunc(state.blend_func[0], state.blend_func[1]);
}

View File

@@ -61,7 +61,8 @@ namespace JGL {
}
namespace JGL::J2D {
inline constexpr State default_state
// On windoze this can't be constexpr?
inline State default_state
{
{0, 0, 0, 1},
{1, 1, 1, 1},

View File

@@ -51,7 +51,7 @@ std::vector<unsigned char> Texture::png(const std::filesystem::path& file) {
std::vector<unsigned char> result{};
int channels;
unsigned char* image_data = stbi_load(file.c_str(), &size.x, &size.y, &channels, 0);
unsigned char* image_data = stbi_load(file.string().c_str(), &size.x, &size.y, &channels, 0);
if (!image_data)
Logger::Fatal("Trying to load a texture from: " + file.string() + "but we couldn't read the file.");