Plz Help! need to change draw distance!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
jhend60
Posts: 44
Joined: Mon Oct 27, 2008 10:11 am
Location: behind you
Contact:

Plz Help! need to change draw distance!

Post by jhend60 »

Hi. I am making a game for my programming assessment.
I am having a problem with a map I made in irrEdit (mesh from 3ds max)
It seems if you even get a small amount away from the mesh (with irrlicht), it becomes invisible until you go near it again. This is probably because my scale is too high, but I need it that way. Is there any variable I can edit to make the drawing distance larger. I am using OpenGl for my device. I know doing this will slow the game down but I really need a much higher draw distance, especially for really really large levels.

Please Help ASAP!
Here is my current code:

Code: Select all

#include <irrlicht.h>
#include <windows.h>

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


#pragma comment(lib, "Irrlicht.lib") 


int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow){

	IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<s32>(640, 480), 32, false, false, false, 0);

	if (device == 0){
		return 1; 
	}

IVideoDriver* driver = device->getVideoDriver();

ISceneManager* smgr = device->getSceneManager();

IGUIEnvironment* guienv = device->getGUIEnvironment();


smgr->loadScene("3d1.irr"); 


smgr->addCameraSceneNodeFPS(0,600.0f,500.0f,-1,0,0,false,400.0f);
HWND lHwnd = FindWindow("Shell_TrayWnd",NULL);
	SendMessage(lHwnd,WM_COMMAND,419,0);


	while(device->run()) 
	if (device->isWindowActive()) 
	{
		driver->beginScene(true, true, video::SColor(0,0,0,0)); 
		smgr->drawAll(); 
		driver->endScene(); 
	}
//Drop the textures and stuff that is already loaded to preserve memory, after it has been already loaded.

	device->drop();

//return 0 if everything has worked!
	return 0;
}
Last edited by jhend60 on Mon Oct 27, 2008 10:21 am, edited 1 time in total.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

When you've got a question your first stop is the API/docs, there can be found on the irrlicht website or in the SDK under the doc directory.

If you have no joy then you can search the forum and you may find an answer there.

But here's a freebie: ICameraSceneNode::setFarValue(distance); Where distance is the distance you wish things to be rendered up to.
Image Image Image
jhend60
Posts: 44
Joined: Mon Oct 27, 2008 10:11 am
Location: behind you
Contact:

Thanks!

Post by jhend60 »

Thanks for such a bloody quick reply! 3 mins! Wow!
I owe u one. Thanks.
jhend60
Posts: 44
Joined: Mon Oct 27, 2008 10:11 am
Location: behind you
Contact:

error

Post by jhend60 »

I get an error when trying to do that (Or i put the code in the wrong place)
illegal call of non-static member function see definition blah blah

I use
ICameraSceneNode::setFarValue(3000.0f);
in the while(device->run())
if (device->isWindowActive())
section
I tried it in declaring section, and other sections as well but it throwed that error. Plz don't put me down if I am just being stupid... I am very new to Irrlicht, and C++
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Yeah i just gave you the function name, not the code to use it ;)

try camera->setFarValue(3000.0f);

where 'camera' is the name of your ICameraSceneNode pointer which was returned from smgr->createCamera();
Image Image Image
jhend60
Posts: 44
Joined: Mon Oct 27, 2008 10:11 am
Location: behind you
Contact:

AHHHH!

Post by jhend60 »

Thanks so much! Sorry, I am new to this. To me this iss incredibly confusing...
jhend60
Posts: 44
Joined: Mon Oct 27, 2008 10:11 am
Location: behind you
Contact:

huh?

Post by jhend60 »

I didn't use CreateCamera...
I used smgr->addCameraSceneNodeFPS(0,600.0f,500.0f,-1,0,0,false,400.0f);
So what do I do? take a look at my code above if you don't understand what I have done...
jhend60
Posts: 44
Joined: Mon Oct 27, 2008 10:11 am
Location: behind you
Contact:

gott it

Post by jhend60 »

Dont worry I got it. Thanks anyway!
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Darn, there goes my lecture about reading the API documentation. :(

It's great to see you're making progress. If you really need to get this done right now, then you can also ask in the IRC channel (see my .sig) for real time help.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Austin
Posts: 4
Joined: Wed Mar 18, 2009 5:45 pm

Post by Austin »

Is there a maximum draw distance? Or maybe a maximum coordinate position?

Is it possible to draw objects out at say...3e+30 ?
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

setFarValue() takes a f32 as parameter. So you can only pass values that do not exceed the max value that can be put in a float variable.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
Austin
Posts: 4
Joined: Wed Mar 18, 2009 5:45 pm

Post by Austin »

That is what I had assumed, but I cannot seem to render a sphere past 1.0e6.
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Maybe some hardware or graphics API restriction.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Maybe your near value is too close?
http://www.sjbaker.org/steve/omniv/love ... uffer.html
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply