Advertisement
Guest User

Untitled

a guest
Feb 17th, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. // generate textures
  2. {
  3.     MRenderingContext * render = MEngine::getInstance()->getRenderingContext();
  4.     MSystemContext * system = MEngine::getInstance()->getSystemContext();
  5.  
  6.     MTextureRef* colorTexture = NULL;
  7.     MTextureRef* depthTexture = NULL;
  8.                
  9.     // screen size
  10.     unsigned int screenWidth = 0;
  11.     unsigned int screenHeight = 0;
  12.     system->getScreenSize(&screenWidth, &screenHeight);
  13.                
  14.     int resolution = pow2(max(screenWidth, screenHeight));
  15.        
  16.     unsigned int colorTexId = 0;
  17.     unsigned int depthTexId = 0;
  18.                                
  19.     // create render textures
  20.     render->createTexture(&colorTexId);
  21.     render->bindTexture(depthTexId);
  22.     render->setTextureFilterMode(M_TEX_FILTER_LINEAR, M_TEX_FILTER_LINEAR);
  23.     render->setTextureUWrapMode(M_WRAP_CLAMP);
  24.     render->setTextureVWrapMode(M_WRAP_CLAMP);
  25.     render->texImage(0, resolution, resolution, M_UBYTE, M_RGB, 0);
  26.  
  27.     render->createTexture(&depthTexId);
  28.     render->bindTexture(depthTexId);
  29.     render->setTextureFilterMode(M_TEX_FILTER_NEAREST, M_TEX_FILTER_NEAREST);
  30.     render->texImage(0, resolution, resolution, M_UBYTE, M_DEPTH, 0);
  31.                
  32.     colorTexture = new MTextureRef(colorTexId, NULL, true);
  33.     depthTexture = new MTextureRef(depthTexId, NULL, true);
  34.                
  35.     camera->setRenderColorTexture(colorTexture);
  36.     camera->setRenderDepthTexture(depthTexture);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement