I've a rendering problem with skydome when the texture is bigger then 1024px. I've used Ozone3d Caps viewer to check my openGL implementation and it says that it support 2048.
The problem is here:
http://imagebin.ca/view/nTSEeLKt.html
that's the top part.
And this is the offending code:
Code: Select all
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace gui;
IrrlichtDevice *videodevice = NULL;
IVideoDriver* videodriver = NULL;
ISceneManager* scenedriver = NULL;
IGUIEnvironment* guidriver = NULL;
class CustomEventReceiver : public IEventReceiver {
public:
virtual bool OnEvent(const SEvent &event) {
if (event.EventType == irr::EET_KEY_INPUT_EVENT&& !event.KeyInput.PressedDown) {
switch(event.KeyInput.Key) {
case KEY_ESCAPE: {
videodevice->closeDevice();
}
}
}
return false;
}
} eventreceiver;
void initialize_irr_devices(void)
{
videodevice = createDevice(
video::EDT_OPENGL,
dimension2d<s32>(640, 480),
// pixel depth
16,
// fullscreen
false,
// stencil buffer
false,
// vsync
false,
// eventReceiver
&eventreceiver
);
if (!videodevice) {
printf("[FATAL ERROR] unable to initialize videodevice");
system("pause");
exit(1);
}
videodriver = videodevice->getVideoDriver();
scenedriver = videodevice->getSceneManager();
guidriver = videodevice->getGUIEnvironment();
if ((!videodriver)||(!scenedriver)||(!guidriver)) {
printf("[FATAL ERROR] unable to initialize a driver subsystem");
system("pause");
exit(1);
}
// Hide cursor
videodevice->getCursorControl()->setVisible(false);
}
void destroy_irr_devices(void)
{
// release the scene manager
scenedriver->clear();
// clear all the loaded meshes
IMeshCache* mcache=scenedriver->getMeshCache();
for(unsigned int rm=0; rm< mcache->getMeshCount(); rm++){
IAnimatedMesh* mesh=mcache->getMeshByIndex(rm);
mcache->removeMesh(mesh);
}
// clear all the textures
videodriver->removeAllTextures();
// Free
videodevice->drop();
// reset
videodriver = NULL;
scenedriver = NULL;
guidriver = NULL;
videodevice = NULL;
}
int main()
{
initialize_irr_devices();
videodevice->setWindowCaption(L"This is my test application");
guidriver->addStaticText(L"Hello World! This is the Irrlicht OpenGL renderer!",
rect<s32>(10,10,260,22), true);
IAnimatedMesh* mesh1 = scenedriver->getMesh("data/carrier3.3DS");
printf("- frame count: %i\n", mesh1->getFrameCount() );
IAnimatedMeshSceneNode* node1 = scenedriver->addAnimatedMeshSceneNode( mesh1 );
printf("- material count: %d\n", node1->getMaterialCount() );
printf("- material R/O ?: %s\n", (node1->isReadOnlyMaterials() ? "SI" : "NO") );
node1->setReadOnlyMaterials(false);
node1->setPosition(core::vector3df(0,0,800));
node1->setMaterialFlag(EMF_LIGHTING, false);
node1->setMD2Animation ( scene::EMAT_STAND );
node1->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
node1->getMaterial(0).Shininess = 20.0f;
node1->getMaterial(1).Shininess = 20.0f;
node1->getMaterial(2).Shininess = 20.0f;
node1->setMaterialFlag(EMF_LIGHTING, true);
ILightSceneNode* light1 = scenedriver->addLightSceneNode(
0,
core::vector3df(0,400,-200),
video::SColorf(1,1,1,1),
1.0f,
1
);
scenedriver->setAmbientLight(video::SColorf(0.3,0.3,0.3,1));
ICameraSceneNode *camera1;
camera1=scenedriver->addCameraSceneNodeFPS();
camera1->setPosition(core::vector3df(100,100,-100));
camera1->setTarget(node1->getPosition());
// 1024x1024: work
// scenedriver->addSkyDomeSceneNode(videodriver->getTexture("data/galaxy.jpg"),16,16,1.0f,2.0f);
// 2048x2048: problem
scenedriver->addSkyDomeSceneNode(videodriver->getTexture("j:/Sky_1.jpg"),16,16,1.0f,2.0f);
IAnimatedMesh* mesh2 = scenedriver->getMesh("data/pyramid.3ds");
IAnimatedMeshSceneNode* node2 = scenedriver->addAnimatedMeshSceneNode( mesh2 );
node2->setMaterialFlag(EMF_LIGHTING, false);
node2->setPosition(light1->getPosition());
// Main Loop
while(videodriver && videodevice->run())
{
videodriver->beginScene(true, true, SColor(255,100,101,140));
scenedriver->drawAll();
guidriver->drawAll();
videodriver->endScene();
// Calc FPS int fps = videodriver->getFPS();
}
destroy_irr_devices();
return 0;
}
BOX VAPORIZERS