Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / [LOCKED] [SOLVED] Flickering text

Author
Message
fogunsakin
1
Years of Service
User Offline
Joined: 27th Aug 2023
Location: Lancashire, ENGLAND
Posted: 11th Oct 2023 09:41
This post has been marked by the post author as the answer.
Thank you Kevin Picone,

Unfortunately, this issue still persist.

SYNC OFF

TEXT 100, 100, "HELLO"

WAIT KEY

When this program is run, the word "HELLO" flickers non stop.

This only happens when I use the TEXT method - for example :- If I have a line such as TEXT 100, 100, "HELLO" in my program

Any further assistance will be much appreciated.

I have a demo version of DBPro which I have reinstalled. This issue does not occur when I run the editor. Unfortunately the trial period has expired

This issue happens with the "Editornew.exe" of the editor in the Install folder of the binary files.

Does anyone have a copy of the DarkBasic Professional installation CD that I can purchase?

I am unable to continue with my learning of DarkBasic programming until I can resolve this issue of flickering text.

All help, advice and assistance will be greatly appreciated.

Thank you.

The author of this post has marked a post as an answer.

Go to answer

Code Maker
8
Years of Service
User Offline
Joined: 4th Dec 2015
Location:
Posted: 11th Oct 2023 19:07
This code



works fine in my DBP
its stands crystal clear on the screen, no flickering at all
just for the record this is a more correct way of using
double buffering



everytime sync is called the program vil switch the backbuffer to the front
and display any changes to the screen

You know you've been coding for too long when you see a shadow on the floor and think, hmm... that's look nice, i wonder
what kind of shader code was used to make that ?
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 17th Oct 2023 00:14
2 Approaches:





You might be curious as to WHY this stops the Flickering...
Simple answer... you don't have a 2D Accelerator in your GPU, so we must *manually* fill both Front and Back Buffers with whatever 2D (Text, Draw, Image) operations we do.

FastSync 0 will run Draw and Present
FastSync 1 will not

It should also be noted you ALWAYS need Sync On to use DBP Emulated Vertical Sync... this is because Native V-Sync no longer exists, so literally does nothing.

Now as a keynote: I'd recommend using Bitmap (Render Buffers) to Draw whatever 2D Operations you need, then convert them to Images to then use as Sprites; basically, how AppGameKit works.
Use the Backbuffer or Pixels Lock., it'll make it usable in real-time.

There are examples of creating a Bitmap Font (lots of said examples in the Snippets Forum, but you'll have to search a little)
Again, a much better and faster approach.

3D doesn't have the same limitations that 2D does as it's handled differently and still supported perfectly fine in DirectX 10/11/12 Feature Level 9.3

Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 18th Oct 2023 00:56
Raven wrote: "FastSync 0 will run Draw and Present"

What would you say the practical use of FastSync 1 is? Normally I would instead use camera masks and carefully planned camera numbers for more advanced effects, to reduce the framerate impact from draw calls/overhead.

I will also mention (if I remember correctly) that FastSync will not update some important things like Sound. So if you only use fastsync your sound effects in game may appear to have incorrect direction and volume. You should also always SYNC the screen once at the beginning of the program to initialize a bunch of things, as a small program may appear to work but more complicated programs will crash without it.

Raven wrote: "There are examples of creating a Bitmap Font (lots of said examples in the Snippets Forum, but you'll have to search a little)
Again, a much better and faster approach."


The modular code / bitmap font I usually post about (linked below) has a built in function to convert it's text directly into a standard image for this very purpose. It even has automation for this that can be enabled if it sees you repeatedly drawing the same text to screen. You can even import any Windows font as it is an implementation of a font conversion tool someone else made on these forums.

Raven wrote: "It should also be noted you ALWAYS need Sync On to use DBP Emulated Vertical Sync... this is because Native V-Sync no longer exists, so literally does nothing."

Since I am here and rarely talk about this these days... I am starting to warm to the idea of DBP VSync, and frame rate caps that waste cpu cycles. I had been using a framerate cap that uses Sync Sleep to hand the CPU back to windows to limit frame rate. However I have found that this is producing stuttering and poor frame timing on newer hardware. The Sync Sleep is not returning the CPU on time and even will reduce performance below the cap in some cases. I had previously liked this since it could reduce CPU usage 99% in some cases. However burning the CPU cycles with a SLEEP command or using the built in frame caps clear up the stuttering.

Mage's Modular Code - Get awesome UI controls and powerful Bitmap Fonts!
Screen Device Recovery - Stop your apps from crashing when minimized/tabbed/screen locked.
CPU Friendly Frame Limiter - Make your app generate less computer heat + noise, and use less battery life!

Login to post a reply

Server time is: 2024-11-21 09:29:05
Your offset time is: 2024-11-21 09:29:05