Advertisement
Guest User

Untitled

a guest
Jul 15th, 2015
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. void World::CreateNamedRT(String worldName)
  2. {
  3.     Graphics* g = context->GetSubsystem<Graphics>();
  4.     int w = g->GetWidth();
  5.     int h = g->GetHeight();
  6.  
  7.  
  8.     renderTexture = SharedPtr<Texture2D>(new Texture2D(context));
  9.  
  10.    
  11.     if (renderTexture)
  12.     {
  13.         renderTexture->SetSize(w, h, Graphics::GetRGBAFormat(), TEXTURE_RENDERTARGET);
  14.         renderTexture->SetFilterMode(FILTER_BILINEAR);
  15.         renderTexture->SetName(worldName);
  16.  
  17.         ResourceCache* cache = context->GetSubsystem<ResourceCache>();
  18.         cache->AddManualResource(renderTexture);
  19.        
  20.  
  21.         RenderSurface* surface = renderTexture->GetRenderSurface();
  22.         surface->SetUpdateMode(RenderSurfaceUpdateMode::SURFACE_UPDATEALWAYS);
  23.         surface->SetViewport(0, camera.vp);
  24.        
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement