void Game::addCheckPoint(const vector3df& position, const vector3df& rotation) { string<char> str = "checkpoint" + checkpoint->size(); IAnimatedMesh *cp1 = smgr->addHillPlaneMesh(str.c_str(), dimension2d<f32>(1000,1000), dimension2d<u32>(1,1)); IAnimatedMeshSceneNode *c = smgr->addAnimatedMeshSceneNode(cp1); c->setRotation(rotation); c->setPosition(position); //c->setDebugDataVisible(EDS_BBOX); checkpoint->push_back(c); if (checkpoint->size() == 1) { first_checkpoint = c; } c->setMaterialType(EMT_TRANSPARENT_ADD_COLOR); //c->setMaterialFlag(EMF_BACK_FACE_CULLING, false); }
int main( ) { // Boring stuff: set up the scene, object & camera as usual // To make things more interesting, we add many Sydneys and a textured floor this time IrrlichtDevice* device = createDevice( DRIVER, dimension2d<s32>( 640, 480 ), 16, false, false, false, 0 ); IVideoDriver* driver = device->getVideoDriver( ); ISceneManager* smgr = device->getSceneManager( ); IGUIEnvironment* guienv = device->getGUIEnvironment( ); device->getFileSystem( )->changeWorkingDirectoryTo( MEDIA_DIRECTORY ); guienv->addStaticText( L"Sandbox", rect<s32>( 10, 10, 260, 22 ), true ); IAnimatedMesh* mesh = smgr->getMesh("sydney.md2"); IGPUProgrammingServices* gpu = driver->getGPUProgrammingServices( ); u32 matid; switch( driver->getDriverType( ) ) { case EDT_OPENGL: matid = gpu->addHighLevelShaderMaterial( GL_V_MAT, "main", EVST_VS_1_1, GL_PLAIN, "main", EPST_PS_1_1, new CTexturesShaderCallback( ), EMT_SOLID, 1 ); break; case EDT_DIRECT3D8: case EDT_DIRECT3D9: default: matid = gpu->addHighLevelShaderMaterial( DX_V_MAT, "main", EVST_VS_1_1, DX_PLAIN, "main", EPST_PS_2_0, new CTexturesShaderCallback( ), EMT_SOLID, 0 ); } for( u8 x = 0u; x != 2u; ++ x ) for( u8 i = 0u; i != 5u; ++ i ) { IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh ); node->setMaterialFlag(EMF_LIGHTING, false); node->setMD2Animation(scene::EMAT_STAND); node->setMaterialTexture( 0, driver->getTexture("sydney.bmp") ); node->setMaterialType( (E_MATERIAL_TYPE) matid ); node->setPosition( vector3df( -x * 20.0f, 0.0f, i * 40.0f ) ); } ISceneNode* nodeF = smgr->addTerrainSceneNode( "terrain-heightmap.bmp" ); nodeF->setMaterialFlag(EMF_LIGHTING, false); nodeF->setMaterialTexture( 0, driver->getTexture("terrain-heightmap.bmp") ); nodeF->setPosition( vector3df( -512.0f, -50.0f, -512.0f ) ); nodeF->setScale( vector3df( 4.0f, 0.2f, 4.0f ) ); nodeF->setMaterialType( (E_MATERIAL_TYPE) matid ); ICameraSceneNode* cam1 = smgr->addCameraSceneNode( 0, vector3df( 0.0f, 0.0f, -40.0f ), vector3df( 0.0f, 5.0f, 50.0f ) ); IPostProc* ppRenderer1 = new CRendererPostProc( smgr, dimension2di( 1024, 512 ), true, true, SColor( 255, 130u, 180u, 230u ) ); CWaterPostProc* ppWater = new CWaterPostProc( ppRenderer1, dimension2di( 1024, 512 ), -22.0f ); ppWater->setTimer( device->getTimer( ) ); wchar_t tmp[255]; u8 t = 0u; while( device->run( ) ) { // cam1->setPosition( vector3df( 40.0f, 60.0f - (device->getCursorControl( )->getPosition( ).Y - 240.0f) * 0.1f, -40.0f ) ); cam1->setPosition( vector3df( (device->getCursorControl( )->getPosition( ).X - 320.0f) * 0.1f, (device->getCursorControl( )->getPosition( ).Y - 240.0f) * 0.1f, -40.0f ) ); // cam1->setTarget( vector3df( (device->getCursorControl( )->getPosition( ).X - 320.0f) * 0.1f, (device->getCursorControl( )->getPosition( ).Y - 240.0f) * 0.1f, 0.0f ) ); // cam1->setTarget( cam1->getPosition( ) + vector3df( 0.0f, 0.0f, 10.0f ) ); // cam1->setTarget( vector3df( -(device->getCursorControl( )->getPosition( ).X - 320.0f) * 0.1f, (device->getCursorControl( )->getPosition( ).Y - 240.0f) * 0.2f, 50.0f ) ); driver->beginScene( false, driver->getDriverType( ) == video::EDT_DIRECT3D9 ); ppWater->render( NULL ); guienv->drawAll( ); driver->endScene( ); if( ++ t == 30u ) { t = 0u; swprintf(tmp, 255, L"%ls fps:%3d", driver->getName(), driver->getFPS() ); device->setWindowCaption( tmp ); } } delete ppWater; delete ppRenderer1; // Back to boring stuff device->drop(); return 0; }
int main( ) { // Boring stuff: set up the scene, object & camera as usual // To make things more interesting, we add many Sydneys and a textured floor this time IrrlichtDevice* device = createDevice( DRIVER, dimension2d<s32>( 640, 480 ), 16, false, false, false, 0 ); IVideoDriver* driver = device->getVideoDriver( ); ISceneManager* smgr = device->getSceneManager( ); IGUIEnvironment* guienv = device->getGUIEnvironment( ); device->getFileSystem( )->changeWorkingDirectoryTo( MEDIA_DIRECTORY ); guienv->addStaticText( L"Heat Haze (with Depth dependence)", rect<s32>( 10, 10, 260, 22 ), true ); IAnimatedMesh* mesh = smgr->getMesh("sydney.md2"); ISceneManager* smgr2 = smgr->createNewSceneManager( false ); ISceneNode* rootnode2 = smgr2->getRootSceneNode( ); IGPUProgrammingServices* gpu = driver->getGPUProgrammingServices( ); u32 matid, matid2; switch( driver->getDriverType( ) ) { case EDT_OPENGL: matid = gpu->addHighLevelShaderMaterial( GL_V_MAT, "main", EVST_VS_1_1, GL_PLAIN, "main", EPST_PS_1_1, new CTexturesShaderCallback( ), EMT_SOLID, 1 ); matid2 = gpu->addHighLevelShaderMaterial( GL_V_MAT, "main", EVST_VS_1_1, GL_HEATSOURCE, "main", EPST_PS_1_1, new CTexturesShaderCallback( ), EMT_TRANSPARENT_ALPHA_CHANNEL, 1 ); break; case EDT_DIRECT3D8: case EDT_DIRECT3D9: default: matid = gpu->addHighLevelShaderMaterial( DX_V_MAT, "main", EVST_VS_1_1, DX_PLAIN, "main", EPST_PS_2_0, new CTexturesShaderCallback( ), EMT_SOLID, 0 ); matid2 = gpu->addHighLevelShaderMaterial( DX_V_MAT, "main", EVST_VS_1_1, DX_HEATSOURCE, "main", EPST_PS_2_0, new CTexturesShaderCallback( ), EMT_TRANSPARENT_ALPHA_CHANNEL, 0 ); } for( u8 x = 0u; x != 2u; ++ x ) for( u8 i = 0u; i != 5u; ++ i ) { IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh ); node->setMaterialFlag(EMF_LIGHTING, false); node->setMD2Animation(scene::EMAT_STAND); node->setMaterialTexture( 0, driver->getTexture("sydney.bmp") ); node->setMaterialType( (E_MATERIAL_TYPE) matid ); node->setPosition( vector3df( -x * 20.0f, 0.0f, i * 40.0f ) ); ISceneNode* node2 = smgr2->addBillboardSceneNode( rootnode2, dimension2df( 30.0f, 80.0f ), vector3df( -x * 20.0f, 30.0f, i * 40.0f ) ); node2->setMaterialFlag(EMF_LIGHTING, false); node2->setMaterialType( EMT_TRANSPARENT_ADD_COLOR ); node2->setMaterialTexture( 0, driver->getTexture("fireball.bmp") ); node2->setMaterialType( (E_MATERIAL_TYPE) matid2 ); } ISceneNode* nodeF = smgr->addMeshSceneNode( smgr->addHillPlaneMesh( "", dimension2df( 200.0f, 200.0f ), dimension2d<u32>( 10, 10 ), NULL, 0.0f, dimension2df( 0.0f, 0.0f ), dimension2df( 100.0f, 100.0f ) ) ); nodeF->setMaterialFlag(EMF_LIGHTING, false); nodeF->setMaterialTexture( 0, driver->getTexture("terrain-heightmap.bmp") ); nodeF->setPosition( vector3df( 0.0f, -22.0f, 0.0f ) ); nodeF->setMaterialType( (E_MATERIAL_TYPE) matid ); ICameraSceneNode* cam1 = smgr->addCameraSceneNode( 0, vector3df( 40.0f, 60.0f, -40.0f ), vector3df( 0.0f, 5.0f, 50.0f ) ); ICameraSceneNode* cam2 = smgr2->addCameraSceneNode( rootnode2, vector3df( 40.0f, 60.0f, -40.0f ), vector3df( 0.0f, 5.0f, 50.0f ) ); IPostProc* ppRenderer1 = new CRendererPostProc( smgr, dimension2di( 1024, 512 ), true, true, SColor( 255u, 100u, 101u, 140u ) ); IPostProc* ppRenderer2 = new CRendererPostProc( smgr2, dimension2di( 1024, 512 ), true, true, SColor( 255u, 0u, 0u, 0u ) ); CEffectPostProc* ppHaze = new CEffectPostProc( ppRenderer1, dimension2di( 1024, 512 ), PP_HAZEDEPTH ); ppHaze->setInput( 1, ppRenderer2 ); ppHaze->setTimer( device->getTimer( ) ); // These variables aren't important - they are just for showing the FPS wchar_t tmp[255]; u8 t = 0u; while( device->run( ) ) { cam1->setPosition( vector3df( 40.0f, 60.0f - (device->getCursorControl( )->getPosition( ).Y - 240.0f) * 0.1f, -40.0f ) ); cam1->setTarget( vector3df( -(device->getCursorControl( )->getPosition( ).X - 320.0f) * 0.1f, (device->getCursorControl( )->getPosition( ).Y - 240.0f) * 0.2f, 50.0f ) ); cam2->setPosition( cam1->getPosition( ) ); cam2->setTarget( cam1->getTarget( ) ); cam2->setUpVector( cam1->getUpVector( ) ); driver->beginScene( false, driver->getDriverType( ) == video::EDT_DIRECT3D9 ); ppHaze->render( NULL ); guienv->drawAll( ); driver->endScene( ); // Show the current FPS if( ++ t == 30u ) { t = 0u; swprintf(tmp, 255, L"%ls fps:%3d", driver->getName(), driver->getFPS() ); device->setWindowCaption( tmp ); } } delete ppHaze; delete ppRenderer1; delete ppRenderer2; // Back to boring stuff device->drop(); return 0; }
int main( ) { // Boring stuff: set up the scene, object & camera as usual // To make things more interesting, we add many Sydneys and a textured floor this time IrrlichtDevice* device = createDevice( DRIVER, dimension2d<s32>( 640, 480 ), 16, false, false, false, 0 ); IVideoDriver* driver = device->getVideoDriver( ); ISceneManager* smgr = device->getSceneManager( ); IGUIEnvironment* guienv = device->getGUIEnvironment( ); device->getFileSystem( )->changeWorkingDirectoryTo( MEDIA_DIRECTORY ); guienv->addStaticText( L"Depth of Field", rect<s32>( 10, 10, 260, 22 ), true ); IAnimatedMesh* mesh = smgr->getMesh("sydney.md2"); // Create the required material. This is a simple shader which draws the texture with no lights. // Use GL_PLAIN1 / DX_PLANE1 or GL_PLAIN2 / DX_PLANE2 to support 1 or 2 basic point-lights u32 matid; IGPUProgrammingServices* gpu = driver->getGPUProgrammingServices( ); switch( driver->getDriverType( ) ) { case EDT_OPENGL: matid = gpu->addHighLevelShaderMaterial( GL_V_MAT, "main", EVST_VS_1_1, GL_PLAIN, "main", EPST_PS_1_1, new CTexturesShaderCallback( ), EMT_SOLID, 1 ); break; case EDT_DIRECT3D8: case EDT_DIRECT3D9: default: matid = gpu->addHighLevelShaderMaterial( DX_V_MAT, "main", EVST_VS_1_1, DX_PLAIN, "main", EPST_PS_2_0, new CTexturesShaderCallback( ), EMT_SOLID, 0 ); } for( u8 x = 0u; x != 2u; ++ x ) for( u8 i = 0u; i != 5u; ++ i ) { IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh ); node->setMaterialFlag(EMF_LIGHTING, false); node->setMD2Animation(scene::EMAT_STAND); node->setMaterialTexture( 0, driver->getTexture("sydney.bmp") ); node->setMaterialType( (E_MATERIAL_TYPE) matid ); node->setPosition( vector3df( -x * 20.0f, 0.0f, i * 40.0f ) ); } ISceneNode* node2 = smgr->addMeshSceneNode( smgr->addHillPlaneMesh( "", dimension2df( 200.0f, 200.0f ), dimension2d<u32>( 10, 10 ), NULL, 0.0f, dimension2df( 0.0f, 0.0f ), dimension2df( 100.0f, 100.0f ) ) ); node2->setMaterialFlag(EMF_LIGHTING, false); node2->setMaterialTexture( 0, driver->getTexture("terrain-heightmap.bmp") ); node2->setMaterialType( (E_MATERIAL_TYPE) matid ); node2->setPosition( vector3df( 0.0f, -22.0f, 0.0f ) ); ICameraSceneNode* cam = smgr->addCameraSceneNode( 0, vector3df( 40.0f, 60.0f, -40.0f ), vector3df( 0.0f, 5.0f, 50.0f ) ); IPostProc* ppRenderer = new CRendererPostProc( smgr, dimension2di( 1024, 512 ), true, true, SColor( 255u, 100u, 101u, 140u ) ); CEffectPostProc* ppBlurDOF = new CEffectPostProc( ppRenderer, dimension2di( 1024, 512 ), PP_BLURDOF ); // We could set parameters on creation, but no need since we will animate it anyway. // Parameters are: near blur, near focus, far focus, far blur, blur level // You can also use PP_BLURDOFNEAR or PP_BLURDOFFAR to have only near or far blurring // These variables aren't important - they are just for showing the FPS wchar_t tmp[255]; u8 t = 0u; while( device->run( ) ) { // Change the camera angle cam->setTarget( vector3df( -(device->getCursorControl( )->getPosition( ).X - 320.0f) * 0.1f, (device->getCursorControl( )->getPosition( ).Y - 240.0f) * 0.2f, 0.0f ) ); // Animate the depth of field: f32 p = sinf( device->getTimer( )->getTime( ) * 0.0005f ) * 0.5f - 0.2f; ppBlurDOF->setParameters( p * 100.0f + 80.0f, p * 100.0f + 110.0f, p * 100.0f + 160.0f, p * 100.0f + 240.0f, 0.01f ); driver->beginScene( false, driver->getDriverType( ) == video::EDT_DIRECT3D9 ); ppBlurDOF->render( NULL ); guienv->drawAll( ); driver->endScene( ); // Show the current FPS if( ++ t == 30u ) { t = 0u; swprintf(tmp, 255, L"%ls fps:%3d", driver->getName(), driver->getFPS() ); device->setWindowCaption( tmp ); } } delete ppBlurDOF; delete ppRenderer; // Back to boring stuff device->drop(); return 0; }
// registering the scene node for rendering, here we take the opportunity // to make LOD adjustments to child nodes void CLODSceneNode::OnRegisterSceneNode() { //if this node is invisible forget any child nodes if (!IsVisible) return; // get a timer to calculate the amount to fade objects u32 time = device->getTimer()->getTime(); // get the camera position ICameraSceneNode* cam = smgr->getActiveCamera(); core::vector3df vectorCam = cam->getAbsolutePosition(); // loop through all child nodes u32 i,j; u32 lod, fade; SMaterial * material; for (i=0; i < children.size(); ++i) { // get the node associated with this link SChildLink &child = children[i]; IAnimatedMeshSceneNode *node = (IAnimatedMeshSceneNode *)child.node; // calculate the distance to the node. at the moment we do this the // slow linear way instead of using the distance squared method core::vector3df vectorNode = node->getAbsolutePosition(); float distance = vectorNode.getDistanceFrom( vectorCam ); // itterate through all of the LOD levels and find the lod distance // that is appropriate for this distance lod = 0xFFFFFFFF; for (j=0; j < lods.size(); ++j) { if ( distance >= lods[j].distance ) { lod = j; } } // if a LOD level was found if ( lod != 0xFFFFFFFF ) { // if this lod is associated with a mesh if ( lods[lod].mesh ) { // if this lod differs from the child lod if ( lod != children[i].lod ) { children[i].lod = lod; // if the node is an animated mesh node if ( ( node->getType()) == ESNT_ANIMATED_MESH ) { // set the new mesh to be used node->setMeshClean( lods[lod].mesh ); } } // handle instances where the node is faded switch ( children[i].mode ) { case LOD_INVISIBLE: // make the node visible node->setVisible( true ); children[i].mode = LOD_FADE_IN; children[i].fade = time; break; // we are partially faded we need to fade back in case LOD_FADE_IN: // fade the node in by 1 multiplied by the time passed fade = (time - children[i].fade) / fadeScale; if ( fade > 0xFF ) fade = 0xFF; // if the node is fully opaque again if ( fade == 0xFF ) { // restore the origonal material type node->setMaterialType(children[i].matType); children[i].mode = LOD_OPAQUE; if ( callback ) callback( true, node ); } // fade the node through its materials fade *= 0x01010101; material = &node->getMaterial( 0 ); if ( useAlpha ) { material->DiffuseColor.set( fade ); material->AmbientColor.set( fade ); } else { material->DiffuseColor.set( fade & 0xFFFFFF ); material->AmbientColor.set( fade & 0xFFFFFF ); } break; // we were in the process of fading out case LOD_FADE_OUT: children[i].fade = time - ( 0xFF * fadeScale - ( time - children[i].fade )); children[i].mode = LOD_FADE_IN; break; } } else { // we have a lod without a mesh, this is an instruction to fade switch ( children[i].mode ) { // the node is fully opaque start fading case LOD_OPAQUE: children[i].mode = LOD_FADE_OUT; children[i].fade = time; // note the material type children[i].matType = node->getMaterial(0).MaterialType; // set the material type based on mapping node->setMaterialType( matmap[children[i].matType] ); //break; // the node is in the process of fading case LOD_FADE_OUT: // fade the node out by 1 multiplied by the time passed fade = (time - children[i].fade) / fadeScale; if ( fade > 0xFF ) fade = 0xFF; // if the node is fully transparent if ( fade == 0xFF ) { // make it completely invisible node->setVisible( false ); children[i].mode = LOD_INVISIBLE; if ( callback ) callback( false, node ); } // fade the node through its materials fade *= 0x01010101; fade = 0xFFFFFFFF - fade; material = &node->getMaterial( 0 ); if ( useAlpha ) { material->DiffuseColor.set( fade ); material->AmbientColor.set( fade ); } else { material->DiffuseColor.set( fade & 0xFFFFFF ); material->AmbientColor.set( fade & 0xFFFFFF ); } break; // we were in the process of fading in case LOD_FADE_IN: children[i].fade = time - ( 0xFF * fadeScale - ( time - children[i].fade )); children[i].mode = LOD_FADE_OUT; break; } // switch } } else { // handle instances where the node is faded switch ( children[i].mode ) { case LOD_INVISIBLE: // make the node visible node->setVisible( true ); children[i].mode = LOD_FADE_IN; children[i].fade = time; if ( callback ) callback( true, node ); break; // we are partially faded we need to fade back in case LOD_FADE_IN: // fade the node in by 1 multiplied by the time passed fade = (time - children[i].fade) / fadeScale; if ( fade > 255 ) fade = 255; // if the node is fully opaque again if ( fade == 0xFF ) { // restore the origonal material type node->setMaterialType(children[i].matType); children[i].mode = LOD_OPAQUE; } // fade the node through its materials fade *= 0x01010101; material = &node->getMaterial( 0 ); if ( useAlpha ) { material->DiffuseColor.set( fade ); material->AmbientColor.set( fade ); } else { material->DiffuseColor.set( fade & 0xFFFFFF ); material->AmbientColor.set( fade & 0xFFFFFF ); } break; // we were in the process of fading out case LOD_FADE_OUT: children[i].fade = time - ( 0xFF * fadeScale - ( time - children[i].fade )); children[i].mode = LOD_FADE_IN; break; } } } ISceneNode::OnRegisterSceneNode(); }
int main() { /* shadowDimen = dimension2du(1024,1024); shadowDimen = dimension2du(2048,2048); shadowDimen = dimension2du(4096,4096); shadowDimen = dimension2du(2048,2048); filterType = EFT_NONE; filterType = EFT_4PCF; filterType = EFT_8PCF; filterType = EFT_4PCF; */ dimension2du shadowDimen = dimension2du(1024,1024); E_FILTER_TYPE filterType = EFT_4PCF; filterType = EFT_NONE; //// IrrlichtDevice* device = createDevice(EDT_OPENGL,dimension2du(800,600),32); ISceneManager* smgr = device->getSceneManager(); IVideoDriver* driver = device->getVideoDriver(); ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS(0,100,.5); cam->setPosition(vector3df(0,10,0)); // Create the effect handler, passing the device and RTT size (as a dimension2d) . effectHandler* effect = new effectHandler(device,shadowDimen); ITerrainSceneNode* terrain = smgr->addTerrainSceneNode("media/terrain.bmp",0,-1,vector3df(0,0,0),vector3df(0,0,0),vector3df(1,1,1),SColor(255,255,255,255),1,ETPS_33); terrain->setMaterialTexture(0,driver->getTexture("media/terrain.jpg")); terrain->setMaterialTexture(1, driver->getTexture("media/detailmap.jpg")); terrain->scaleTexture(1,10); terrain->setScale(core::vector3df(4, 0.01f, 4)); terrain->setPosition(vector3df(-120,-1.5f,-120)); terrain->setMaterialType(EMT_DETAIL_MAP); // Make the terrain recieve a shadow with the specified filter type. // (NOTE: 12PCF is only available in Direct3D9, all others work with OpenGL) effect->addShadowToNode(terrain,filterType); IAnimatedMeshSceneNode* sydney; IAnimatedMesh* sydneymesh = smgr->getMesh("media/dwarf.x"); for(int g = 0;g < 1;g++) { for(int v = 0;v < 3;v++) { sydney = smgr->addAnimatedMeshSceneNode(sydneymesh); sydney->setScale(vector3df(0.05f,0.05f,0.05f)); sydney->setPosition(vector3df(g * 4,0.5f,v * 4)); sydney->setMaterialFlag(EMF_NORMALIZE_NORMALS,true); sydney->setAutomaticCulling(EAC_FRUSTUM_BOX); sydney->setMaterialType(EMT_SOLID); // Add the nodes to the depth pass so that they cast a shadow. effect->addNodeToDepthPass(sydney); } } effect->getLightCamera()->addAnimator(smgr->createFlyCircleAnimator(sydney->getPosition() + vector3df(0,15,0),25,0.0002f)); effect->getLightCamera()->setNearValue(5); effect->setMaxShadowDistanceFromLight(120); smgr->addLightSceneNode(effect->getLightCamera()); MyEventReceiver receiver(cam); device->setEventReceiver(&receiver); // Parent a sphere to the light camera so we can see its position. smgr->addSphereSceneNode(1,8,effect->getLightCamera())->setMaterialFlag(EMF_LIGHTING,false); while(device->run()) { wchar_t tmp[255]; swprintf(tmp,255,L"Shadow Map Demo (FPS: %d)",driver->getFPS()); device->setWindowCaption(tmp); driver->beginScene(true,true,SColor(0,0,0,0)); // Point the light camera at one of the nodes as it rotates around them. effect->setLightTarget(sydney->getPosition()); // Update the effect handler, remember to always do this BEFORE smgr->drawAll and AFTER beginscene! effect->update(); smgr->drawAll(); // If user wishes we can display the shadow map to the screen. (May not work in OpenGL) if(disp2d) driver->draw2DImage(effect->getShadowMapTexture(),position2d<s32>(0,0)); driver->endScene(); // device->sleep(5); } device->drop(); return 0; }