Skybox - all right but dont show !?!

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
mcunha98
Posts: 16
Joined: Mon Jan 02, 2006 6:58 pm
Location: Curitiba / PR - Brazil
Contact:

Skybox - all right but dont show !?!

Post by mcunha98 »

Based in an example of IRR, i started the first step : put a skybox in my world. Reading about the question i found the AddSkyBoxSceneNode method but i use the method correctly but the sky dont is showed

I need use more code in my "main loop" to work ?

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include <string.h> 
#include <irrlicht.h>
#include "cinifile.h"

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

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

int main()
{
	IrrlichtDevice *device = createDevice(EDT_SOFTWARE, dimension2d<s32>(800, 600), 16, false, false, false, 0);
	device->setWindowCaption(L"Resgate do Rebanho");
	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();
	IGUIEnvironment* guienv = device->getGUIEnvironment();
	int lastFPS = -1;

	guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",rect<int>(10,10,200,22), true);
	IAnimatedMesh* mesh = smgr->getMesh("C:/irrlicht-1.3/media/sydney.md2");
	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );

	if (node)
	{
		node->setMaterialFlag(EMF_LIGHTING, false);
		node->setFrameLoop(0, 310);
		node->setMaterialTexture( 0, driver->getTexture("C:/irrlicht-1.3/media/sydney.bmp") );
	}

  char fileup[50]="D:/apl/games/HP/textures/skies/l1_UP.bmp";
  char filedn[50]="D:/apl/games/HP/textures/skies/l1_DN.bmp";
  char filelf[50]="D:/apl/games/HP/textures/skies/l1_LT.bmp";
  char filert[50]="D:/apl/games/HP/textures/skies/l1_RT.bmp";
  char fileft[50]="D:/apl/games/HP/textures/skies/l1_FR.bmp";
  char filebk[50]="D:/apl/games/HP/textures/skies/l1_BK.bmp";  

	ICameraSceneNode *camera = smgr->addCameraSceneNode( 0,vector3df(0,30,-40), vector3df(0,5,0));
	ISceneNode *sky = smgr->addSkyBoxSceneNode(
                           driver->getTexture(fileup),
                           driver->getTexture(filedn),
                           driver->getTexture(filelf),
                           driver->getTexture(filert),
                           driver->getTexture(fileft),
                           driver->getTexture(filebk));
  driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
  camera->setFarValue(50000); 
  	
	while(device->run())
	{
		driver->beginScene(true, true, SColor(255,113,113,133) );
		smgr->drawAll();
		guienv->drawAll();
		driver->endScene();

  	sky->setVisible(true);

  	int FPS = driver->getFPS();
  	if (lastFPS != FPS)
  	{
       wchar_t tmp[1024];
       swprintf(tmp,1024,L"[WIP] Rebanho Resgate - [%ls] fps: %d",driver->getName(), FPS);
       device->setWindowCaption(tmp);
       lastFPS = FPS;
    }
	}
	device->drop();
	return 0;
}

greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

Look into the console window: possibly it saying "Couldn't open ... " or you have to see "Texture loaded ... ". Please, show the console output.

Also this is unnecessary:

Code: Select all

sky->setVisible(true);
mcunha98
Posts: 16
Joined: Mon Jan 02, 2006 6:58 pm
Location: Curitiba / PR - Brazil
Contact:

Post by mcunha98 »

Ok, i delete the setVisible call...
The output window:

Code: Select all

Irrlicht Engine version 1.3
Microsoft Windows 2000 Professional Service Pack 4 (Build 2195)
Loaded mesh: C:/irrlicht-1.3/media/sydney.md2
Loaded texture: C:/irrlicht-1.3/media/sydney.bmp
Loaded texture: D:/apl/games/HP/textures/skies/l1_BK.bmp
Loaded texture: D:/apl/games/HP/textures/skies/l1_FR.bmp
Loaded texture: D:/apl/games/HP/textures/skies/l1_RT.bmp
Loaded texture: D:/apl/games/HP/textures/skies/l1_LT.bmp
Loaded texture: D:/apl/games/HP/textures/skies/l1_DN.bmp
Loaded texture: D:/apl/games/HP/textures/skies/l1_UP.bmp
How you see, all textures loaded with sucessfull !


:cry:
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

hmm linkoraclehero had this problem earlier when setting the near value of the camera further than 1.0. Try setting your skybox scale to (100,100,100)

Also, you may have z-fighting problems if you set your far value so far away
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

It looks to me like the software device is having problems rendering 3d objects. The example programs render nothing when using the EDT_SOFTWARE driver also. I'm seeing the same problem with Irrlicht 1.2, so this seems to have been broken for some time.

Travis
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ahh, of course, the software renderer does not show skyboxes. Since all triangles which overlap the frustum are culled completely the skybox is always not drawn. So choose a different renderer!
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Right.

I don't know what it is, but I'm unable to draw any 3d primitives at all with the software renderer. It works fine if I use an clean SDK install, but if I use my current build it doesn't work at all. :(

Travis
Post Reply