Page 1 of 1

.irr file not rendering near screen border

Posted: Sun Apr 28, 2013 6:02 pm
by zakalakin
Here is a .gif of my issue
http://makeagif.com/media/4-28-2013/j1MHdE.gif
as you can see, when parts of my image reach the frame of my screen, they stop being rendered


I have created a .irr file in copper-cube (the textured building)

my issue is, when parts of the .irr mesh leave the window it wont render, i'd like any parts of the mesh that are on the screen to be rendered.

Any help is greatly appreciated
I'm pretty new to irrlicht.
My code is below
Thanks


#include <irrlicht.h>
#include "ControllableCamera.h"

//#include <iostream>

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

//using namespace std;

#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif

int main()
{
IrrlichtDevice *device =
createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
false, false, false, 0);

if (!device)
return 1;

IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();

//---------------------------------------------------------
// ninja and mesh


IAnimatedMesh* ninjaMesh1 = smgr->getMesh("../media/ninja.b3d");
if (!ninjaMesh1)
{
device->drop();
return 1;
}
IAnimatedMeshSceneNode *ninja1 = smgr->addAnimatedMeshSceneNode( ninjaMesh1 );
if (ninja1)
{
ninja1->setMaterialFlag(EMF_LIGHTING, false);
//animate between frames
ninja1->setFrameLoop(0,13);
ninja1->setAnimationSpeed(10);
//node->setMD2Animation(scene::EMAT_FIGHT);
ninja1->setMaterialTexture( 0, driver->getTexture("../media/nskinrd.jpg") );
}
ninja1->setPosition(vector3df(-60,-60,-75));
ninja1->setScale(vector3df(3,3,3));


//-------------------------------------------------------
// coppercube scene

//load scene
ISceneNode* building = smgr->getSceneNodeFromName("building");


//Load up the coppercube building irrFile
smgr->loadScene("../media/buildingMeshh.irr",0,building);


//--------------------------------------------------------------
//Cameras, hide mouse

// first person camera. rotate speed, move speed.
ISceneNode* fpsCam1 = smgr-> addCameraSceneNodeFPS(0,120.0f, .06f);
//start position
fpsCam1->setPosition(vector3df(-78.0f,-30.0f,120.0f));

//hide cursor
device->getCursorControl()->setVisible(false);

// no parent, active - false, position, point
ISceneNode* cam1 = smgr ->addCameraSceneNode(0, vector3df(5,-10,0), vector3df(0,-20,0), 0, false);
//ISceneNode* cam2 = smgr ->addCameraSceneNode(0, vector3df(5,5,20), vector3df(0,10,5));

//--------------------------------------------------------
//while run

int lastFps = -1;
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));

smgr->drawAll();
guienv->drawAll();

driver->endScene();

int fps = driver->getFPS();
if(fps != lastFps)
{
lastFps = fps;
core::stringw str = L"FPS: ";
str += fps;
str += L" Camera(";
str +=fpsCam1->getPosition().X; str += L",";
str +=fpsCam1->getPosition().Y; str += L",";
str +=fpsCam1->getPosition().Z; str+=L")";
device->setWindowCaption(str.c_str());
}
}
// drop created
device->drop();
return 0;
}

Re: .irr file not rendering near screen border

Posted: Sun Apr 28, 2013 6:08 pm
by Stauricus
wait. do you mean that when you're inside the room, everything draws correctly? and this happens when you leave the room?
if that's it, it's just a normal problem. you'll need double sided faces. it actually is rendered, but the texture don't shows.

search a double sided face option in the program you used to make the model. if i understand what the issue is, it is not an irrlicht problem, just a small thing that you need to configure in the 3d file.

Re: .irr file not rendering near screen border

Posted: Sun Apr 28, 2013 6:15 pm
by zakalakin
The screen-shot I sent, i'm currently inside the room.
when parts of the mesh (its a very simple triangulated mesh) touch the edge of the screen, that part of the mesh stops being rendered

I'll send more screenshots, so it's more clear what I mean

Re: .irr file not rendering near screen border

Posted: Sun Apr 28, 2013 6:23 pm
by zakalakin
Here is a 3 framed .gif showing what happens when the camera moves side to side

http://makeagif.com/media/4-28-2013/j1MHdE.gif

as you can see, as new bits of mesh reach the screen frame it stops being rendered and disappears

Re: .irr file not rendering near screen border

Posted: Sun Apr 28, 2013 7:33 pm
by zakalakin
I have solved the issue. was very simple. I had the wrong coding for my irrlicht device



// my original code
IrrlichtDevice *device = createDevice( video::EDT_SOFTWARE,
dimension2d<u32>(640, 480), 16,false, false, false, 0);


//code I needed
IrrlichtDevice* device = createDevice(EDT_OPENGL,
dimension2d<u32>(640, 480), 16, false, false, false, 0);