Gamestudio Links
Zorro Links
Newest Posts
Reducing Function Times
by 3run. 08/12/20 06:22
Sierra Chart Plugin
by AndrewAMD. 08/11/20 22:41
New Zorro version 2.30
by Zheka. 08/11/20 15:49
avg spread every tick
by Grat. 08/11/20 10:34
strtok() returns temporary string
by Morris. 08/10/20 15:31
problem with adding new history
by jcl. 08/10/20 14:27
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 08/10/20 12:02
AUM Magazine
Latest Screens
Untitled Walking Simulator
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
Who's Online Now
9 registered members (Janusz, alibaba, rafaelghd, jenGs, Grat, Jerome8911, 3run, FLD, Dooley), 465 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Sovattha, DonSergio, bigimpactsound, tzw101, Al82
18491 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,109
NRW/Germany
alibaba Online OP
Expert
alibaba  Online OP
Expert

Joined: May 2008
Posts: 2,109
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,328
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,328
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,109
NRW/Germany
alibaba Online OP
Expert
alibaba  Online OP
Expert

Joined: May 2008
Posts: 2,109
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