0 registered members (),
1,094
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
OP
Expert
|
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!
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.
|
|
|
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
Member
|
Member
Joined: Feb 2013
Posts: 122
Maysville, Ga
|
video_window(vector(1,1,0),vector(ab_x[num],ab_y[num],0),112,"Window");
//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
OP
Expert
|
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.
|
|
|
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
Member
|
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.
|
|
|
|