Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
SwitchCase
Posts: 170 Joined: Sun Jul 01, 2007 11:41 pm
Location: Manchester, UK
Post
by SwitchCase » Sat Nov 24, 2007 5:12 pm
Thanks. The following code compiles but crashes at runtime.
Code: Select all
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#include "grid.h"
int main(int argc, char** argv)
{
IrrlichtDevice *device =
createDevice(EDT_SOFTWARE, dimension2d<s32>(640, 480), 16,
false, false, false, 0);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
device->setWindowCaption(L"IrrTest");
ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS(0,100.0f,300.0f);
Grid* grid;
while(device->run())
{
driver->beginScene(true, true, SColor(0,0,0,0));
smgr->drawAll();
grid->draw(smgr);
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
It's the...
IrrTest.exe has encoutered a problem and needs to close. We are sorry for the incovenience.
error message that I get.
Thanks for any help.
vitek
Bug Slayer
Posts: 3919 Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR
Post
by vitek » Sat Nov 24, 2007 7:49 pm
If you use pointers you need to initialize them. I see two choices, but both involve initializing the grid properly before using it.
Code: Select all
// you can put a grid on the stack.
Grid option1;
// or you can allocate one from the heap. notice i'm initializing the pointer
// to point to an actual grid instance.
Grid* option2 = new Grid;
//
while (device->run())
{
if (driver->beginScene(...))
{
// if you have a reference to an instance, you would draw it like this.
option1.draw(smgr);
// if you have a pointer to the instance, you would draw it like this.
option2->draw(smgr);
// other stuff
driver->endScene();
}
}
delete option2;
Personally, I think this grid should be a scene node like everything else in Irrlicht.
Travis
SwitchCase
Posts: 170 Joined: Sun Jul 01, 2007 11:41 pm
Location: Manchester, UK
Post
by SwitchCase » Sat Nov 24, 2007 7:57 pm
oh bollocks... cheers vitek i didnt relise.
I feel stupid now
humbrol
Posts: 83 Joined: Sun Nov 18, 2007 8:22 pm
Post
by humbrol » Sat Nov 24, 2007 8:20 pm
MasterGod wrote: Virion wrote: Grid* grid;
Grid* whatever;
and..
Thank you very much, using irrlicht to round out my c++, its easier to learn when your trying to do something you like.
Dark_Kilauea
Posts: 368 Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere
Post
by Dark_Kilauea » Mon Nov 26, 2007 10:10 pm
Shamelessly pimping my own Scenenode here:
I finally managed to convert this class into a scene node, while adding a few optional features. You can get it at this thread:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24938
Thanks mohaps for creating this base class!
rogerborg wrote: Every time someone learns to use a debugger, an angel gets their wings.
mohaps
Posts: 248 Joined: Tue Jun 08, 2004 1:54 pm
Location: Shrewsbury MA
Contact:
Post
by mohaps » Thu May 22, 2008 7:12 pm
wow! returning after a long time to irrlicht forums... nice to see people using this...
---
Saurav Mohapatra
author, artist and bona fide geek
web:
http://www.mohaps.com
email: mohaps AT gmail DOT com
MasterGod
Posts: 2061 Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:
Post
by MasterGod » Fri May 23, 2008 10:57 am
mohaps wrote: wow! returning after a long time to irrlicht forums... nice to see people using this...
You're kidding? It's so damn good it should get into the lib (Dark_Kilauea's version of it as a scene node..)
.
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
Dark_Kilauea
Posts: 368 Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere
Post
by Dark_Kilauea » Sat May 24, 2008 8:14 am
I did minor optimizations to your method, but my scenenode is very much the same internally. The next step in my mind is being able to either add LOD to the grid to save rendering time, or convert over to a dynamically textured quad for the grid itself. Unfortunately, I do not have the time to implement either of these approaches.
rogerborg wrote: Every time someone learns to use a debugger, an angel gets their wings.