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 / Game window line corruption

Author
Message
Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 5th Nov 2011 13:34 Edited at: 6th Nov 2011 00:57
Not too sure what the technical term for this is, but I'm getting skipped lines in my game window. I'd understand this problem upon resizing the game window, but this issue is occurring as soon as I compile.

Attached is a screenshot of the problem. Below is the simple code to cut & paste.

EDIT: Changed my code to something more applicable.


What would be a preferred way of correcting this problem?

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 5th Nov 2011 15:23
Your game window must not be set to the same as you coded resolution perhaps.

The issue occurrs a lot more with 'windowed mode on' applications so you could try running 'windowed mode off'.

You have it set to windowed desktop 1024x768, but is your desktop set to 1024x768? You didn't use the command 'Set display mode 1024, 768, 32' in the code.

When you run fulscreen windowed, the game window is stretched to cover the actual desktop, sometimes this causes stretching issues like this.

My signature is NOT a moderator plaything! Stop changing it!
Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 5th Nov 2011 22:52 Edited at: 5th Nov 2011 23:06
In my game engine, I've coded a command line switch which in practice will let the user choose if they wish to play full screen, window, and at what resolution. I don't mind that they have to restart the game to have their desired settings, but I do need the settings to work.

I've been trial & error'ing this morning, using the Set Display Mode command, but still no luck. Please review my new attached screenshot, as I think it explains what's going on; in that the game View Port is being truncated, and the game Window is the entire size, thus causing the corruption.

Experimenting with both smaller resolutions, Set display mode, Window on, I still haven't found a solution to this problem.

Further to this, I don't recall having it in the past? I'm sure I must be forgetting something here...

EDIT: In further testing Matrix1 Utilities command;

Set Window Client Size 1024, 768

Sets the correct view port, but leaves the game stuck on the desktop, and not in a Window.

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 5th Nov 2011 23:14
Your desktop resolution is slightly smaller that the DBP window with the border added.

Why not just run your game fullscreen exclusive and see if that helps?

The issue is almost certainly because your running in windowed mode.

My signature is NOT a moderator plaything! Stop changing it!
Agent
21
Years of Service
User Offline
Joined: 7th Sep 2004
Location: Sydney, Australia
Posted: 5th Nov 2011 23:19
First of all, any commands in the code override the project settings. The options you select on the left create default settings when the program window is generated at OS level. As soon as the code runs, and it hits your SET DISPLAY MODE command (or similar related), it overrides those defaults set at project level.

It looks to me like you're specifying a resolution at code level that is not native to your monitor. I suspect different hardware setups (ie, monitor) will experience different viewed results using your code.

When a monitor runs in native resolution, the pixels in the datastream being fed to it by the graphics card directly match the physical pixels on the monitor, and it can display everything it's being asked to easily. If there are more physical pixels on the screen than are being given to it by the graphics card, or if there is data being fed from the graphics card fir pixels that don't physically exist on the monitor (these scenarios arise when you set a non-native resolution), it has to do its best to accommodate the data with the hardware it has. For each physical pixel on the monitor, it guesses what color a physical pixel should be based on the average of the surrounding pixel data (this is known as nearest-neighbour interpolation). Any resolution that isn't directly native to a monitor will cause this technique to come into play, causing inaccurate display such as you are experiencing.

Find out what one of your monitor's native resolutions is (as opposed to a resolution that is merely supported) and try applying that resolution at code level. If you no longer see missing lines then this will confirm the problem I have outlined. Unfortunately, there is no solution to this problem - you must use a resolution that is native to your monitor in order to preserve graphical fidelity. That is why almost all games these days allow you to choose your resolution.

Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 5th Nov 2011 23:46 Edited at: 6th Nov 2011 00:21
Gah, I'm gonna have to write down my trial and errors, I can't figure this out.



Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 6th Nov 2011 00:53 Edited at: 6th Nov 2011 01:12
Can I get a little help in testing the following?



Simply change the Width & Height variable to match your highest native resolution, (in my case its 1366 x 768 on my laptop), also toggle the project settings, between Windowed, Windowed Fullscreen & Windowed Desktop.

I can only get the image to display correctly if I pick a Width & Height less than my highest resolution available. But I'm left wondering why? My game is running in an unscaled window, it should be showing 100% accurately at all times, regardless of resolution... But it's as if something is automatically scaling the window size by just a little bit to cause this corrupt image, and that's what I'm trying to stop!

EDIT: Yup, I think the bug is caused when a window resolution starts to get close to the highest native resolution. Some automagic scaling occurs, breaking the image. Hopefully this has been seen before, and fixed somehow... >_>

EDIT: The reason this is a problem too, is that for example, I have my Windows Task Bar on the right of my screen, and I love to run applications in Windowed mode, full height, but with the width slightly reduced so I can still see the task bar. This image corruption is obviously occurring on the horizontal lines in my case, but not the vertical, since the window height is maxed out, but the window width is a hundred or so pixels short of my full screen width.

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 6th Jan 2012 05:20
*bump*

Anyone tackled this drama before?

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 6th Jan 2012 12:37
everyone who worked on bitmaps should've noticed.

the skipped lines are graphic card/monitor dependent. if you have two computers with different quality you will notice different skipped lines.
Naphier
15
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 6th Jan 2012 15:19
Not sure if this will help, but I also noticed this "issue" when I was creating a parallax starfield in window mode. The stars/pixels disappear at certain times.

It doesn't make a whole lot of sense to me because the program is rounding the position of the pixel to the nearest integer (as it should) also the calculations I use are based on the window's dimensions, which are smaller than the monitor's dimensions.

So the dot should always be drawn at some pixel... but it isn't the case.
My solution was to increase the size of the dots. See if doubling up on the width of the lines helps. This result wasn't overly desirable so I decided I liked the look of stars blinking out better than extra wide ones.

This could be hardware dependent, but a program like Blender works pretty damn well on all computers I've used it on and the same computers I notice the missing pixels on with DBPro programs.
I think there's something in directX we're not understanding. Perhaps this all has to do with dx texture sizes needing to be in ^2 increments.

I'm not really sure, but I'm also pretty sure I won't need to have pixel accurate programs.

Also, I share your annoyances with window scaling on resizing.

Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 10th Jan 2012 06:13
Can users of "STYX" confirm if that particular plugin would solve my problems? For $30, I don't want to download it if it's not going to fix these complications. Further to this, can someone confirm if "STYX ver 2.0" conflicts with IanM's Matrix1 Utilities, as there's no point buying a conflicting plugin.

Cheers in advance!
BFM

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 10th Jan 2012 06:39
Have you tried SET WINDOW LAYOUT to switch off the window borders to see if that does anything?

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Jan 2012 16:39
Quote: "can someone confirm if "STYX ver 2.0" conflicts with IanM's Matrix1 Utilities"

Yes it does, but it only conflicts with Matrix1Util_16.dll which you can safely move aside - you'll lose my fast string handling, but nothing else.

Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 10th Jan 2012 21:37 Edited at: 10th Jan 2012 21:52
I've found another method of tackling my problem, which is using the User32.dll and Gdi32.dll to configure my game window. Late last night I stumbled across an example on these forums, so I'm going to spend the next couple of days reading how to use these DLL files.

EDIT: Trying to get the code that users User32.dll working on my work computer, but fail. Here's the link to the original thread;

http://forum.thegamecreators.com/?m=forum_view&t=25974&b=1

EDIT: Wait, there it goes... Gonna have to practice this some more. Anyone got a User32.DLL help file?

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia

Login to post a reply

Server time is: 2026-07-10 13:45:12
Your offset time is: 2026-07-10 13:45:12