Scorescreen no longer crashes but page flips all over the place. Disable color clear each frame.

This commit is contained in:
Justin Marshall
2020-06-14 18:28:42 -07:00
parent 5b3f63b4e4
commit c9e027e1a0
5 changed files with 28 additions and 17 deletions
+3
View File
@@ -413,6 +413,7 @@ void ScoreClass::Presentation(void)
#endif
BlackPalette.Set();
Show_OldFrameBuffer(false);
void const * country4 = MFCD::Retrieve("COUNTRY4.AUD");
void const * sfx4 = MFCD::Retrieve("SFX4.AUD");
@@ -866,6 +867,8 @@ Keyboard->Clear();
#endif //FIXIT
#endif
Show_OldFrameBuffer(true);
}
+1
View File
@@ -1294,5 +1294,6 @@ inline long BufferClass::To_Page(int x, int y, int w, int h, GraphicViewPortClas
return ( return_code );
}
void Show_OldFrameBuffer(bool show);
#endif
+24 -17
View File
@@ -80,6 +80,14 @@ void (*Misc_Focus_Restore_Function)(void) = nullptr;
void (*Imgui_Dialog_Function)(void) = nullptr;
bool show_oldframebuffer = true;
void Show_OldFrameBuffer(bool show) {
show_oldframebuffer = show;
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
memset(backbuffer_data, 0, ScreenWidth * ScreenHeight * 4);
}
std::vector<Image_t *> loaded_images;
Image_t* Image_LoadImage(const char* name) {
@@ -166,8 +174,8 @@ void Set_DD_Palette(void* palette, bool raShift)
void ImGui_NewFrame(void) {
ImGuiIO& io = ImGui::GetIO();
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
//glClearColor(0, 0, 0, 1);
//glClear(GL_COLOR_BUFFER_BIT);
io.DisplaySize = ImVec2(ScreenWidth, ScreenHeight);
ImGui_ImplOpenGL3_NewFrame();
@@ -176,27 +184,26 @@ void ImGui_NewFrame(void) {
ImGui_ImplSDL2_NewFrame(game_window);
}
void Device_Present(void) {
// Rasterize the palette.
for (int i = 0; i < ScreenWidth * ScreenHeight; i++) {
backbuffer_data[(i * 4) + 0] = backbuffer_palette[(backbuffer_data_raw[i] * 3) + 0];
backbuffer_data[(i * 4) + 1] = backbuffer_palette[(backbuffer_data_raw[i] * 3) + 1];
backbuffer_data[(i * 4) + 2] = backbuffer_palette[(backbuffer_data_raw[i] * 3) + 2];
backbuffer_data[(i * 4) + 3] = 255;
}
glBindTexture(GL_TEXTURE_2D, backbuffer_texture);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, ScreenWidth, ScreenHeight, GL_RGBA, GL_UNSIGNED_BYTE, backbuffer_data);
void Device_Present(void) {
// Use imgui to render the screenbuffer.
{
if(show_oldframebuffer)
{
// Rasterize the palette.
for (int i = 0; i < ScreenWidth * ScreenHeight; i++) {
backbuffer_data[(i * 4) + 0] = backbuffer_palette[(backbuffer_data_raw[i] * 3) + 0];
backbuffer_data[(i * 4) + 1] = backbuffer_palette[(backbuffer_data_raw[i] * 3) + 1];
backbuffer_data[(i * 4) + 2] = backbuffer_palette[(backbuffer_data_raw[i] * 3) + 2];
backbuffer_data[(i * 4) + 3] = 255;
}
glBindTexture(GL_TEXTURE_2D, backbuffer_texture);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, ScreenWidth, ScreenHeight, GL_RGBA, GL_UNSIGNED_BYTE, backbuffer_data);
bool ScreenActive;
ImGuiStyle& style = ImGui::GetStyle();
style.FramePadding = ImVec2(0, 0);
ImGui::SetNextWindowSize(ImVec2(ScreenWidth, ScreenHeight));
ImGui::SetNextWindowPos(ImVec2(0, 0));
ImGui::Begin("RenderWindow", &ScreenActive, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar);
ImGui::Begin("RenderWindow", &ScreenActive, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoMouseInputs);
ImVec2 desktopSize(ScreenWidth, ScreenHeight);
ImGui::Image((ImTextureID)backbuffer_texture, desktopSize);
ImGui::End();