Giter Club home page Giter Club logo

Comments (4)

karadoc avatar karadoc commented on June 14, 2024

Ok... I've just tested my 'fix' on Windows, and the results are not great. It's causing some crazy flickering weirdness. So I guess I haven't worked out a fix after all. Sorry. I'll let you know if I learn more.

from openxcom.

SupSuper avatar SupSuper commented on June 14, 2024

There's already a SDL_GL_SwapBuffers here: https://github.com/OpenXcom/OpenXcom/blob/master/src/Engine/Zoom.cpp#L680
Maybe it's in the wrong place?

from openxcom.

karadoc avatar karadoc commented on June 14, 2024

Right. The name flipWithZoom does imply that it should be flipping the display - but by the looks of it, it only flips in OpenGL mode.

If I simply comment out SDL_GL_SwapBuffers() line in Zoom::flipWithZoom, so that it is only called in my modified version of Screen::flip(), then the flicking problem in Windows is fixed. (It makes sense, because if we flip, then immediately flip again we're probably going to get a blank screen, or perhaps just whatever the previous buffer use to have - which might be why it seemed to work in Linux.)

I'll do a bit more testing, but my current recommendation is to rename Zoom::flipWithZoom to Zoom::blitWithZoom or something like that, and get remove its call to SDL_GL_SwapBuffers(); then just keep the change that I made in Screen::flip() (which is to either use SDL_GL_SwapBuffers() for OpenGL mode, or SDL_Flip(_screen) for ordinary 2D SDL mode.)

There are still a few things I'm foggy on. For example, I don't fully understand the purpose of OpenGL::refresh(). The description says "make the buffer show up on screen"; which makes it sound exactly the same as Flip and SwapBuffers... so that's confusing to me.

from openxcom.

karadoc avatar karadoc commented on June 14, 2024

Ok. I've amended my original fix to do what I said in the previous post. Here it is:
karadoc@7138594

(I figure that since no one relies on my repository, I can just force history changing commits for neatness.)

I've tested this (briefly) on both Windows and Linux, with and without shaders. I did not notice any problems related to that. So I think this time is is properly fixed!

That said, one time during my testing I did get a crash in Windows while switching shaders. It wasn't with the final code that I'm uploading now, but it was with a version without the Screen::flip(). Essentially what I'm saying is that I don't think my patch here is going to fix #1389 after all. I now believe that's something unrelated. I haven't been able to reliably reproduce the crash. It just seems to sometimes happen when switching between shaders.

from openxcom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.