Jump to content

Monitor Flickering

1 reply to this topic

#1 TheUltimateKrtekCZ

  • New Members
  • 1 posts

Posted 16 February 2017 - 07:38 PM

When I run the program, it runs fine, but after about 10 seconds, the monitor starts going crazy. The colors in the rectangle change color. After that, in the next 20 seconds, the game crashes.

Since my english it very good :D, I will post a video instead. That will hopefully explain, what is going on. In the video, the flickering is small compared to the flickering I usually get.
VideoURL: https://youtu.be/XVlwCspR2tk

#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 6,702 posts
  • LocationTasmania (AU)

Posted 17 February 2017 - 08:57 AM

Code doesn't run instantly. Your drawing code in particular uses a lot more function calls than it needs to, because with each frame you're drawing to many individual points multiple times. The delay this generates, when compounded by the fact that peripheral calls are particularly slow, leads to a noticeable flicker effect while the display is in the process of being redrawn.

If we do our peripheral calls just before clearing the screen (saving the results to variables), and take care not to redraw more than we have to, we can speed things up somewhat. Eg something along the lines of this (untested) code:


That should just about eliminate any flicker.

In regards to your game crashes, difficult to comment on those without seeing the resulting logs, but off the top of my head I'm going to guess you're running OptiFine or similar.

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users