Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (VoroneTZ, monk12, Quad), 829 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Updating render target size bug #479621
04/12/20 15:44
04/12/20 15:44
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline OP
Expert
alibaba  Offline OP
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
Hey guys, I'm trying to update a panel which receives it's image from a view. When I change the resolution with "h" and then update the sizes with "j" it works until I have a resolution of 1270x720. Why does that happen? Am I missing something here? Please try this code with a level of your choice and tell me if you get the same result.

EDIT: Funny thing is, if I press "h" five times to reach the 1280x720 immediately and update only then, it works!

Code

int ab_x[5]={800,1024,1024,1152,1280};
int ab_y[5]={600,768,600,864,720};

PANEL* bgP;
VIEW* bgV;
int num = 0;
void on_h_event()
{
	wait(2);
	num = cycle(num+1, 0 ,5);
	video_set(ab_x[num],ab_y[num],0,2);
}

void on_j_event()
{
	safe_remove(bgV.bmap);
	bgV.bmap = bmap_createblack(screen_size.x,screen_size.y,24);
	bgP.bmap = bgV.bmap;
	
	bgV.size_x = screen_size.x;
	bgV.size_y = screen_size.y;
	bgP.size_x = screen_size.x;
	bgP.size_y = screen_size.y;
}

void main()
{
	wait(1);
	level_load("test2.wmb");
	wait(3);
	bgV = view_create(10);
	bgV.bmap = bmap_createblack(screen_size.x,screen_size.y,24);
	set(bgV,SHOW);
	
	bgP = pan_create("",0);
	bgP.bmap = bgV.bmap;
	set(bgP,SHOW|TRANSLUCENT|LIGHT);
	vec_set(bgP.blue,vector(120,120,120));
	bgP.alpha = 50;
}


Last edited by alibaba; 04/12/20 15:47.

Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: Updating render target size bug [Re: alibaba] #479622
04/12/20 16:28
04/12/20 16:28
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
I don't konw what can be causing the crash, but a tip could solve the issue: If you create the render target at its maximum size at the very beginning, you don't need to delete and recreate it on resolution changes, you only need to set the sizes of the panel and the view. These sizes need to be set at the beginning too, so the view only uses the area determined by its size. Also, set the zbuffer to the maximum.

Salud!

Re: Updating render target size bug [Re: alibaba] #479623
04/12/20 16:46
04/12/20 16:46
Joined: Feb 2013
Posts: 122
Maysville, Ga
Evo Offline
Member
Evo  Offline
Member

Joined: Feb 2013
Posts: 122
Maysville, Ga
Code
video_window(vector(1,1,0),vector(ab_x[num],ab_y[num],0),112,"Window");

Code
//Press key_h to change sizes
int ab_x[5]={800,1024,1024,1152,1280};
int ab_y[5]={600,768,600,864,720};

PANEL* bgP;
VIEW* bgV;

void update_bmap()
{
	safe_remove(bgV.bmap);
	bgV.bmap = bmap_createblack(screen_size.x,screen_size.y,24);
	bgP.bmap = bgV.bmap;
	
	bgV.size_x = screen_size.x;
	bgV.size_y = screen_size.y;
	bgP.size_x = screen_size.x;
	bgP.size_y = screen_size.y;
}

int num = 0;
void on_h_event()
{
	wait(2);
	num = cycle(num+1, 0 ,5);
	video_set(ab_x[num],ab_y[num],0,2);
	video_window(vector(1,1,0),vector(ab_x[num],ab_y[num],0),112,"Window");
	update_bmap();
}

void main()
{
	wait(1);
	level_load("testbed.wmb");
	wait(3);
	bgV = view_create(10);
	bgV.bmap = bmap_createblack(screen_size.x,screen_size.y,24);
	set(bgV,SHOW);
	
	bgP = pan_create("",0);
	bgP.bmap = bgV.bmap;
	set(bgP,SHOW|TRANSLUCENT|LIGHT);
	vec_set(bgP.blue,vector(200,200,255));
	bgP.alpha = 100;
}

Last edited by Evo; 04/12/20 17:07.
Re: Updating render target size bug [Re: alibaba] #479625
04/12/20 17:47
04/12/20 17:47
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline OP
Expert
alibaba  Offline OP
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
Thanks txesmi, it works if I set the size at the beginning and just change the sizes, but I still wonder though, why removing and recreating doesn't work..

@EVO This approach is not viable, because it will just resize the engine window, but won't change the resolution. Thanks for your input though! (Y) Nevermind, I wasn't paying attention... Your approach totally works! Thanks! But still.. why doesn't it work separately? If I call both functions separately, I won't work again...

Last edited by alibaba; 04/12/20 17:53.

Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: Updating render target size bug [Re: alibaba] #479626
04/12/20 17:54
04/12/20 17:54
Joined: Feb 2013
Posts: 122
Maysville, Ga
Evo Offline
Member
Evo  Offline
Member

Joined: Feb 2013
Posts: 122
Maysville, Ga
No problem.

* video_set : Changes the resolution.
* video_window : only changes the window size and keeps the same resolution.

* window size shouldn't be smaller than the resolution.

Last edited by Evo; 04/12/20 18:00.

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1