Blitzmax And Minib3d screen resolution BUG (Fixed)

BlitzMax Forums/MiniB3D Module/Blitzmax And Minib3d screen resolution BUG (Fixed)

Trinosis(Posted 2016) [#1]
A Description Of The Error
--------------------------------

On my system, creating 1680 x 1050 windowed mode screen, doesn't actually create a screen of those dimensions.

Reading back the screen mode after it's been created, tells me it's in 1680 x 1030, windowed mode.

A discrepency of 20 vertical pixels.

Which is about the discrepency i see in my test code.

Why my system won't create a 1680 x 1050 screen in windowed mode i'm not sure. Full screen is fine.

But i can create a screen of 1680 x 1030 windowed mode, and there is no error.

So, to be clear.
When i create a 1680 x 1050 windowed screen, my system creates a 1680 x 1030 windowed screen.
Blitzmax sees 1680 x 1030 window and Minib3d sees a 1680 x 1050 windowed screen.
Thus the 20 pixel discrepency in the Y axis only.

So it looks as though Minib3d would need to check the dimensions of the actual screen thats created in order for it to use the same size screen.

My system spec
--------------------
Windows XP
Nvidia Geforce GT240 ( Latest Graphics Driver )
BlitzMax150_win32x86.exe
minib3d-v054


Kryzon(Posted 2016) [#2]
On the phone right now, have you tried using the default 1.0 zoom?
Zoom changes projection stuff, perhaps it could interfere with the Max2D module.


Trinosis(Posted 2016) [#3]
Thanks Kryzon.

Yes, i've tried altering the camera zoom.

Doesn't make any difference.


Trinosis(Posted 2016) [#4]
Ok, after a bit more investigation i've found out that the error only occurs at 1680 x 1050 WINDOWED mode.
Which is actually 1680 x 1030 Windowed mode.

1680 x 1050 is the highest screen res my monitor supports.

I wrote some test code below, which confirms that all full screen and windowed modes my monitor supports are correct, except 1680 x 1050 windowed which produces the error.

As i do most of my coding in 1680 x 1050 windowed, i assumed the error was the same for full screen mode as well.

So, i'm still at a loss as to what's causing the error.
It could be my graphics driver i suppose, but i'm using the latest version, which is for windows XP, as that's my OS.

Or it could be an error in Minib3d.

But i'm just guessing at this point.

It would be nice if someone could run the code below and confirm the same error as me.
If the error isn't present i would know it's a problem my end.

Thanks in advance.




Trinosis(Posted 2016) [#5]
Updated My First Post.

After giving the issue some thought i've realised the problem.

On my system, setting 1680 x 1050 windowed mode doesn't actually create a screen of those dimensions.

Reading back the screen mode after it's been created, tells me it's in 1680 x 1030, windowed mode.

A discrepency of 20 vertical pixels.

Which is about the discrepency i see in my test code above.

Why my system won't create a 1680 x 1050 screen in windowed mode i'm not sure. Full screen is fine.

But i can create a screen of 1680 x 1030 windowed mode, and there is no error.

So at the moment, to get around the problem, i test to see if 1680 x 1050 windowed mode is selected, and then create a 1680 x 1030 window mode.

So, to be clear.
When i create a 1680 x 1050 windowed screen, my system creates a 1680 x 1030 windowed screen.
Blitzmax sees 1680 x 1030 window and Minib3d sees a 1680 x 1050 windowed screen.
Thus the 20 pixel discrepency in the Y axis only.

So it looks as though Minib3d would need to check the dimensions of the actual screen thats created in order for it to use the same size screen.


Kryzon(Posted 2016) [#6]
You don't need to specify a bit-depth when using windowed mode. MiniB3D overrides your depth and sets it to zero when you use mode "2" for windowed. In windowed mode the bit-depth is always the same as that of the desktop, there's no way of setting it. As seen here:
https://github.com/si-design/minib3d/blob/master/inc/TGlobal.bmx#L34

You are right that MiniB3D thinks the graphics window will always have the dimensions that you send to it as parameter to the Graphics3D, rather than checking back from the TGraphics object that is created (which might be different as in your case):
https://github.com/si-design/minib3d/blob/master/inc/TGlobal.bmx#L40

I would experiment with changing this part...
		width=w
		height=h
		depth=d
		mode=m
		rate=r
		
		SetGraphicsDriver(GLMax2DDriver()) 
		Graphics(width,height,depth,rate,flags)
	
		GraphicsInit()
To this here...
		SetGraphicsDriver( GLMax2DDriver() ) 
		Local graphicsObject:TGraphics = Graphics( w, h, d, r, flags )
		graphicsObject.GetSettings( width, height, depth, rate, flags )
		mode = m 'Unused.
	
		GraphicsInit()
And then rebuilding your MiniB3D module.

Max2D does it the "right way", it gets the final dimensions from the graphics context that is created, rather than assume the dimensions you ask for is what is actually given.


Trinosis(Posted 2016) [#7]
Hi Kryzon.

Thanks for the feedback.

That fix works perfectly and cures my problem.

Very helpful :)