recreate rendertargets

Posted By: Kartoffel

recreate rendertargets - 03/16/14 13:46

hey there,

I'm having trouble removing and recreating all the VIEWs and BMAPs in my postprocessing chain.
(needed when changing the resolution or quality settings, for example)

Can anyone show me how to properly do this?
Posted By: Superku

Re: recreate rendertargets - 03/16/14 20:42

Why would you need to recreate VIEWs? Replacing BMAPs should be enough.
Just have a loop which checks for a changed resolution, then iterate over your global view bitmap pointers and/ or view.bmap.
Posted By: Kartoffel

Re: recreate rendertargets - 03/16/14 20:51

first of all, thanks for the reply.
I need to re-setup the whole pipeline because not all shaders (or different shaders) are used on lower quality settings.

Also it'd be great if you could provide a code example.

regards, Kartoffel
Posted By: Superku

Re: recreate rendertargets - 03/16/14 21:21

I see. I have a function called update_view_stages() where I simply set or remove views from the render chain based on two if/ else cases (manually, pre-defined views) which gets called when a graphics option gets changed.
Then I have a while loop which sets and updates some effects based on variables and it recreates bitmaps automatically like this:

Code:
if(old_size_x != screen_size.x || old_size_y != screen_size.y)
{
	old_size_x = screen_size.x;
	old_size_y = screen_size.y;
	if(bmp_refraction) ptr_remove(bmp_refraction);
	bmp_refraction = bmap_createblack(screen_size.x, screen_size.y, 24);
	...
}


There are certainly better ways to do this but as I don't have that many graphics options and because I use global bitmap pointers this works just fine for me.
Posted By: Kartoffel

Re: recreate rendertargets - 03/17/14 14:01

that's wired, I use ptr_remove and bmap_createblack aswell, but after resetting the chain a couple of times I get a directx error...

maybe I forgot a rendertarget, I'll have a look
Posted By: oliver2s

Re: recreate rendertargets - 03/17/14 21:33

I know this should not really neccesary, but I use this to recreate render targets:

Code:
if(bmp_refraction!=NULL) //instead of (bmp_refraction)
{
   bmap_purge(bmp_refraction);
   ptr_remove(bmp_refraction);
}

© 2024 lite-C Forums