Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // generate textures
- {
- MRenderingContext * render = MEngine::getInstance()->getRenderingContext();
- MSystemContext * system = MEngine::getInstance()->getSystemContext();
- MTextureRef* colorTexture = NULL;
- MTextureRef* depthTexture = NULL;
- // screen size
- unsigned int screenWidth = 0;
- unsigned int screenHeight = 0;
- system->getScreenSize(&screenWidth, &screenHeight);
- int resolution = pow2(max(screenWidth, screenHeight));
- unsigned int colorTexId = 0;
- unsigned int depthTexId = 0;
- // create render textures
- render->createTexture(&colorTexId);
- render->bindTexture(depthTexId);
- render->setTextureFilterMode(M_TEX_FILTER_LINEAR, M_TEX_FILTER_LINEAR);
- render->setTextureUWrapMode(M_WRAP_CLAMP);
- render->setTextureVWrapMode(M_WRAP_CLAMP);
- render->texImage(0, resolution, resolution, M_UBYTE, M_RGB, 0);
- render->createTexture(&depthTexId);
- render->bindTexture(depthTexId);
- render->setTextureFilterMode(M_TEX_FILTER_NEAREST, M_TEX_FILTER_NEAREST);
- render->texImage(0, resolution, resolution, M_UBYTE, M_DEPTH, 0);
- colorTexture = new MTextureRef(colorTexId, NULL, true);
- depthTexture = new MTextureRef(depthTexId, NULL, true);
- camera->setRenderColorTexture(colorTexture);
- camera->setRenderDepthTexture(depthTexture);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement