problems in resizable window

BlitzMax Modules Forums/MiniB3D/problems in resizable window

Hi!
Dunno if this is the right forum's section to post that, but I thinks that the thrd points concern minib3D.... anyway..

I've changed
WS_VISIBLE|WS_CAPTION|WS_SYSMENU

in
WS_VISIBLE|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX

in glGraphics module to get a resizable window with minimize/maximize button: works! but it bring some problems ( I.e. I open the window with "Graphics3D 800,600" )

1) When I maximize the window, (for example getting a 1024x768 window), the area between 800 and 1024, as the area between 600 and 768, getting 'messed'.
obviously because it showing an area where I draw anything.

2) So... I want draw something in that area: I've already a system that allow me to change the 'viewport' size without affect the usability of program (moving the elements in function of two variable, screenX and screenY).. but
I need to know exactly the size of the resized window: how?

3) last but not last:
When i resize the window vertically I get something strange: Seems that it pick as origin y-coordinate,the bottom value (e.g 600 ), and not the top value (0) ... that make the top area hide, and get strange offsets in mouse's coordinates.

Sorry.. I'mb bad in english .. so i hope that image explain more:


that not happens in horizontal resize, and never happens in simply Max2D aps: Only with Minib3D (+Max2D)

If I have the confirmation that with MaxGUI minib3D+max2D works good, and without "3)" problem.. I could buy it .. but at the moment I want try that way...

I've tried also wxMax but i can't get what I want :(

could you post some code (a working reduced sample) which shows the problem ?

right!

well, first of all open (& backup):

[blitzMaxFolder]\mod\brl.mod\glgraphics.mod\glgraphics.win32.c


on line 293, change
hwnd_style=WS_CAPTION|WS_SYSMENU;

in
hwnd_style=WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SIZEBOX;


then Ctrl+D in IDE ...

now.. try that short code:
Import "includes\minib3D.bmx"

'SetGraphicsDriver(GLMax2DDriver()) 
'Graphics(640, 480, 0, 60, GRAPHICS_BACKBUFFER | GRAPHICS_DEPTHBUFFER | GRAPHICS_ACCUMBUFFER) 

Graphics3D 800, 600, 0

Global camera:tCamera = CreateCamera()
 PositionEntity camera,0,0,-20
 CameraClsColor camera,255,255,255

Global cube:tEntity = CreateCube()
 EntityColor cube,255,0,0


While Not KeyHit(KEY_ESCAPE ) 
	

	TurnEntity cube,1,1,1
	
	RenderWorld
	
	TGlobal.BeginMax2D

	SetColor Rnd(255),Rnd(255),Rnd(255)
	For Local i:Int = 0 To 10
	  DrawRect 30+i*60, 200, 50, 50
    Next
	For Local y:Int = 0 To GraphicsHeight() Step 10
	  DrawText y,50,y
	Next
	Flip
	
	TGlobal.EndMax2D
	
Wend

(minib3D.bmx is the simonh 045 version)

it will open a resizable window:

Try to reduce the height of window... the top area gets hide to show the bottom area: I want the opposite XD

Try this:


Import klepto.minib3dext

'SetGraphicsDriver(GLMax2DDriver()) 
'Graphics(640, 480, 0, 60, GRAPHICS_BACKBUFFER | GRAPHICS_DEPTHBUFFER | GRAPHICS_ACCUMBUFFER) 
Extern "win32" ' Crazy WinAPI stuff
	Function GetActiveWindow%()
	Function IsZoomed%(hwnd%)
	Function GetClientRect(hwnd%,rect:Byte Ptr)
End Extern
Type TRect 
	Field X%,Y%,W%,H%
End Type
Graphics3D 800, 600, 0

Global hWnd% = GetActiveWindow() ' Save current Window handle
Global Size:TRect = New Trect
GetClientRect(hwnd,Size)


Global camera:tCamera = CreateCamera()
 PositionEntity camera,0,0,-20
 CameraClsColor camera,255,255,255

Global cube:tEntity = CreateCube()
EntityColor cube,255,0,0


While Not KeyHit(KEY_ESCAPE ) 
	GetClientRect(hwnd,Size)
	TGlobal.Width = Size.W
	TGlobal.Height = Size.H

	TurnEntity cube,1,1,1
	
	RenderWorld
	
	BeginMax2D()
	
	
	'SetBlend MaskBlend
	SetColor 255,0,0
	For Local i:Int = 0 To 10
	  DrawRect 30+i*60, 200, 50, 50
    Next
	For Local y:Int = 0 To GraphicsHeight() Step 10
	  DrawText y,50,y
	Next
	
	EndMax2D()
	SetColor 0,0,0
	DrawText " ",-20,-20

	Flip	
Wend

Function BeginMax2D()

		Local x,y,w,h
		GetViewport(x,y,w,h)
		
		glDisable(GL_LIGHTING)
		glDisable(GL_DEPTH_TEST)
		glDisable(GL_SCISSOR_TEST)
		glDisable(GL_FOG)
		glDisable(GL_CULL_FACE)

		glMatrixMode GL_TEXTURE
		glLoadIdentity
		
		glMatrixMode GL_PROJECTION
		glLoadIdentity
		glOrtho 0,GraphicsWidth(),GraphicsHeight(),0,-1,1
		
		glMatrixMode GL_MODELVIEW
		glLoadIdentity
		
		SetViewport x,y,w,h
		
		
		Local MaxTex:Int 
		glGetIntegerv(GL_MAX_TEXTURE_UNITS, Varptr(MaxTex))

		
		For Local Layer = 0 Until MaxTex
			glActiveTexture(GL_TEXTURE0+Layer)
					
			glDisable(GL_TEXTURE_CUBE_MAP)
			glDisable(GL_TEXTURE_GEN_S)
			glDisable(GL_TEXTURE_GEN_T)
			glDisable(GL_TEXTURE_GEN_R)
	
			glDisable(GL_TEXTURE_2D)
		Next
		
		glActiveTexture(GL_TEXTURE0)
		
		DrawRect - 10 , - 10 , 5 , 5
		
		glViewport(0,0,TGlobal.Width,TGlobal.Height)
		glScissor(0,0,TGlobal.Width,TGlobal.Height)
		

End Function

Function EndMax2D()

		glDisable(GL_TEXTURE_CUBE_MAP)
		glDisable(GL_TEXTURE_GEN_S)
		glDisable(GL_TEXTURE_GEN_T)
		glDisable(GL_TEXTURE_GEN_R)
	
		glDisable(GL_TEXTURE_2D)

		TGlobal.EnableStates()

End Function