本文整理汇总了C++中IVideoDriver::addRenderTargetTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ IVideoDriver::addRenderTargetTexture方法的具体用法?C++ IVideoDriver::addRenderTargetTexture怎么用?C++ IVideoDriver::addRenderTargetTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVideoDriver
的用法示例。
在下文中一共展示了IVideoDriver::addRenderTargetTexture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv) {
// Help?
if (argv[1] && argv[1][0] == '-') die(helpmsg);
putenv((char *) "vblank_mode=0"); // No vsync for us, thanks.
MyEventReceiver *r = new MyEventReceiver();
IrrlichtDevice *dev = createDevice(EDT_OPENGL, core::dimension2d<u32>(1024,768), 32,
false, false, false, r);
if (!dev) die("Can't initialize Irrlicht");
IVideoDriver *drv = dev->getVideoDriver();
ISceneManager *smgr = dev->getSceneManager();
IGPUProgrammingServices *gpu = drv->getGPUProgrammingServices();
ICameraSceneNode *cam = NULL;
ITexture *pic = NULL;
IMeshSceneNode *ball = NULL;
bool showpic = false;
IReadFile *areamap = createMemoryReadFile(AreaMap33, sizeof(AreaMap33), "AreaMap33", false);
if (!areamap) die("Failed to load areamap");
ITexture *areamaptex = drv->getTexture(areamap);
areamap->drop();
// If there's an argument, assume it is a pic to load; otherwise, draw a sphere
if (argv[1] && access(argv[1], R_OK) == 0) {
showpic = true;
pic = drv->getTexture(argv[1]);
if (!pic) die("Can't load image");
cam = smgr->addCameraSceneNode();
} else {
cam = smgr->addCameraSceneNodeMaya();
cam->setTarget(vector3df(0, 0, 0));
ball = smgr->addSphereSceneNode(40, 8);
int ballshader = gpu->addHighLevelShaderMaterial(rnd,0,EVST_VS_1_1,0);
ball->setMaterialType((E_MATERIAL_TYPE) ballshader);
ISceneNodeAnimator *cool = smgr->createRotationAnimator(vector3df(-0.1, 0.1, -0.1));
ball->addAnimator(cool);
cool->drop();
}
// Set up static defines, RTTs, quads
dimension2d<u32> screensize = drv->getScreenSize();
char defines[128];
snprintf(defines, 128,
"#define PIXEL_SIZE vec2(1.0f / %u.0, 1.0f / %u.0)\n"
"#define MAX_SEARCH_STEPS 8.0\n#define MAX_DISTANCE 33.0\n",
screensize.Width, screensize.Height);
ITexture *rt1 = drv->addRenderTargetTexture(screensize, "rt1", ECF_A8R8G8B8);
ITexture *rt2 = drv->addRenderTargetTexture(screensize, "rt2", ECF_A8R8G8B8);
ITexture *rt3 = drv->addRenderTargetTexture(screensize, "rt3", ECF_A8R8G8B8);
if (!rt1 || !rt2 || !rt3) die("No RTT");
ScreenQuad *def = new ScreenQuad(drv);
ScreenQuad *sq = new ScreenQuad(drv);
ScreenQuad *sq2 = new ScreenQuad(drv);
ScreenQuad *sq3 = new ScreenQuad(drv);
ScreenQuad *norm = new ScreenQuad(drv);
if (showpic) def->SetTexture(pic);
sq->SetTexture(rt1);
sq->GetMaterial().setFlag(EMF_BILINEAR_FILTER, false);
norm->SetTexture(rt1);
norm->GetMaterial().setFlag(EMF_BILINEAR_FILTER, false);
sq2->SetTexture(rt2);
sq2->SetTexture(rt2, 1);
sq2->SetTexture(areamaptex, 2);
sq2->GetMaterial().TextureLayer[2].BilinearFilter = false;
sq3->SetTexture(rt3);
sq3->GetMaterial().setFlag(EMF_BILINEAR_FILTER, false);
sq3->SetTexture(rt1,1);
state_t state = MLAA_OFF;
stringc tmp1, tmp2;
tmp1 = defines;
tmp1 += offsetvs;
tmp2 = defines;
tmp2 += color1fs;
// Load shaders
int edge = gpu->addHighLevelShaderMaterial(tmp1.c_str(),0,EVST_VS_1_1,tmp2.c_str());
sq->SetMaterialType((E_MATERIAL_TYPE) edge);
tmp2 = defines;
tmp2 += blend2fs;
blendcb *bcb = new blendcb();
edge = gpu->addHighLevelShaderMaterial(tmp1.c_str(),0,EVST_VS_1_1,tmp2.c_str(),0,EPST_PS_1_1,bcb);
sq2->SetMaterialType((E_MATERIAL_TYPE) edge);
tmp2 = defines;
tmp2 += neigh3fs;
//.........这里部分代码省略.........
示例2: main
int main()
{
MyEventReceiver receiver;
IrrlichtDevice *device =
createDevice( video::EDT_OPENGL, dimension2d<u32>(1280, 800), 16,
false, false, false, &receiver);
if (!device)
return 1;
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
scene::ISceneNode* o = smgr->addSphereSceneNode(20);
//o->setMaterialFlag(video::EMF_LIGHTING, false);
o->setPosition(core::vector3df(0,0,0));
SMaterial &m = o->getMaterial(0);
m.EmissiveColor = SColor(255, 255, 0, 0);
vector3df sssPos(0, 60, 0);
scene::ISceneNode* sss = smgr->addCubeSceneNode(30);
sss->setMaterialFlag(video::EMF_LIGHTING, true);
//sss->setMaterialTexture(0, driver->getTexture("wall.bmp"));
sss->setPosition(sssPos);
SMaterial &sssm = sss->getMaterial(0);
sssm.EmissiveColor = SColor(100, 255, 255, 255);
scene::ISceneNode* hp = smgr->addSphereSceneNode(10);
SMaterial &hpm = hp->getMaterial(0);
hpm.EmissiveColor = SColor(255, 0, 0, 255);
scene::ISceneNode* hd = smgr->addSphereSceneNode(10);
SMaterial &hdm = hd->getMaterial(0);
hdm.EmissiveColor = SColor(255, 0, 0, 100);
scene::ISceneNode* node[10];
for (int i = 0; i < 10; ++i)
{
node[i] = smgr->addSphereSceneNode(5);
//node[i]->setMaterialFlag(video::EMF_LIGHTING, false);
node[i]->setVisible(false);
SMaterial &m = node[i]->getMaterial(0);
m.EmissiveColor = SColor(255, 255, 0, 0);
}
scene::ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS();
vector3df camPos(0,0,200);
vector3df camshift(0,0,0);
cam->setPosition(camPos);
cam->setTarget(core::vector3df(0,0,0));
u32 then = device->getTimer()->getTime();
const f32 MOVEMENT_SPEED = 50.f;
irr::video::S3DVertex m_cPlaneVertices[4];
irr::u16 m_iPlaneIndices[6];
m_cPlaneVertices[0] = irr::video::S3DVertex(-100.0f, -100.0f, -100.0f,1,1,0, irr::video::SColor(255,255,255,255), 0.0f, 0.0f);
m_cPlaneVertices[1] = irr::video::S3DVertex(-100.0f, 100.0f, -100.0f,1,1,0, irr::video::SColor(255,255,255,255), 0.0f, 1.0f);
m_cPlaneVertices[2] = irr::video::S3DVertex( 100.0f, 100.0f, -100.0f,1,1,0, irr::video::SColor(255,255,255,255), 1.0f, 1.0f);
m_cPlaneVertices[3] = irr::video::S3DVertex( 100.0f, -100.0f, -100.0f,1,1,0, irr::video::SColor(255,255,255,255), 1.0f, 0.0f);
m_iPlaneIndices[0] = 0;
m_iPlaneIndices[1] = 2;
m_iPlaneIndices[2] = 1;
m_iPlaneIndices[3] = 0;
m_iPlaneIndices[4] = 3;
m_iPlaneIndices[5] = 2;
SMaterial m_cRenderMaterial;
m_cRenderMaterial.Wireframe = false;
m_cRenderMaterial.Lighting = false;
m_cRenderMaterial.TextureLayer[0].TextureWrapU = irr::video::ETC_CLAMP;
m_cRenderMaterial.TextureLayer[0].TextureWrapV = irr::video::ETC_CLAMP;
ITexture *m_pRenderTexture = 0;
CvCapture *capture;
IplImage *frame;
char AviFileName[]="Accel World.mp4";
capture = cvCaptureFromAVI(AviFileName);
if (driver->queryFeature(irr::video::EVDF_RENDER_TO_TARGET))
{
m_pRenderTexture = driver->addRenderTargetTexture(irr::core::dimension2d<irr::u32>((irr::u32)(720), (irr::u32)(480)));
m_cRenderMaterial.setTexture(0, m_pRenderTexture);
}
// m_pRenderTexture = driver->getTexture("wall.bmp");
//.........这里部分代码省略.........