Window, Surface and Stuffs#116
Conversation
f9c218e to
602d951
Compare
|
Could you resolve conflicts and rebase on main? |
602d951 to
faf08e7
Compare
faf08e7 to
11f6f24
Compare
Done, I think everything is set now. |
|
The Post-Draw order is incorrect
The Post-Draw must be, conceptually, here void GLCommon_letterboxBlit(GLuint fbo, int32_t fboWidth, int32_t fboHeight, int32_t gameW, int32_t gameH, int32_t windowW, int32_t windowH) {
int32_t sx, sy, ex, ey;
GLCommon_computeLetterbox(gameW, gameH, windowW, windowH, &sx, &sy, &ex, &ey);
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
// Post Draw
glBlitFramebuffer(0, 0, fboWidth, fboHeight, sx, sy, ex, ey, GL_COLOR_BUFFER_BIT, GL_NEAREST);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}For that it will require changing the vtable to split up both parts of the |
|
For reference, here's how GameMaker-HTML5 does it this.PreDraw(r);
//this.SetApplicationSurface();
this.DrawViews(r);
// Disable application_surface, and now render direct to the screen
if (g_bUsingAppSurface) {
surface_reset_target();
}
//check surface stack is empty
if (g_SurfaceStack.length != 0)
{
yyError("Unbalanced surface stack. You MUST use surface_reset_target() for each set.");
return;
}
this.PostDraw(r);
this.DrawApplicationSurface(r);
this.DrawGUI(r);
this.DrawCursor(r);
Graphics_Restore();
};As a reference, here's the GLFW target Runner_drawViews(runner, gameW, gameH, displayScaleX, displayScaleY, debugShowCollisionMasks); // GM-HTML5 drawViews
renderer->vtable->endFrame(renderer); // Bind Framebuffer + Draw Application Surface...and while writing this (unrelated to this PR), I think the Draw GUI event is also out of order, it should be done after Post-Draw, after the application surface has been drawn, currently it is drawn on |
Split DRAW_POST out of the main draw flow to fix Undertale border/surface rendering issues and align behavior with the decompiled yoyo runner.
Implement proper glfw window dimension handling (window_get_width/height + window_set_size).
Implement application_surface_enable and application_surface_draw_enable builtins to control application surface usage and auto-draw behavior.