OpenGL 2.0.6847
ATI MOBILITY RADEON X700
Irrlicht 1.4
DevC++
Materials are not rendered with correct attributes (as if some attributes were not updated between materials when they are rendered). Not sure however if it is not caused by my hardware so please run test below.
Here is example:
Two spheres using different specular color and shininess but both rendered with the same ones. First rendered incorrectly.
first sphere: specular = r0, g0, b255 shininess = 0.0f
second sphere: specular = r255, g0, b0 shininess = 10.0f
Both are rendered the with the same red specular effect (first should have no specular effect at all and if then blue).
Code: Select all
#include <irrlicht.h>
using namespace irr;
int main()
{
IrrlichtDevice* device = createDevice(
video::EDT_OPENGL,
core::dimension2d<s32>(640, 480), 32, false, false, false, 0);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
// firsth sphere, its specular is set to blue and shininess to 0 but it shows
// red specular instead (should not reflect specular at all)
// its renders same specular as second shpere
scene::ISceneNode *sphere1 = smgr->addSphereSceneNode(5,128);
sphere1->setPosition(core::vector3df(-6,0,0));
sphere1->getMaterial(0).AmbientColor = video::SColor(255, 255, 255, 255);
sphere1->getMaterial(0).DiffuseColor = video::SColor(255, 255, 255, 255);
sphere1->getMaterial(0).SpecularColor = video::SColor(255, 0, 0, 255);
sphere1->getMaterial(0).Shininess = 0;
// second sphere its specular is set to red and shininess to 10
scene::ISceneNode *sphere2 = smgr->addSphereSceneNode(5,128);
sphere2->setPosition(core::vector3df(6,0,0));
sphere2->getMaterial(0).AmbientColor = video::SColor(255, 255, 255, 255);
sphere2->getMaterial(0).DiffuseColor = video::SColor(255, 255, 255, 255);
sphere2->getMaterial(0).SpecularColor = video::SColor(255, 255, 0, 0);
sphere2->getMaterial(0).Shininess = 10;
// third to show light position
scene::ISceneNode *sphere3 = smgr->addSphereSceneNode(1,128);
sphere3->setMaterialFlag(video::EMF_LIGHTING, false);
sphere3->setMaterialFlag(video::EMF_WIREFRAME, true);
// camera
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS(0, 50, 10);
camera->setPosition(core::vector3df(0,10,-10));
camera->setTarget(core::vector3df(0,0,0));
// light
scene::ILightSceneNode *light = smgr->addLightSceneNode(sphere3, core::vector3df(0,0,0));
// animate light
scene::ISceneNodeAnimator *anim = smgr->createFlyCircleAnimator(core::vector3df(0,0,-25), 20.0f, 0.001f);
sphere3->addAnimator(anim);
while(device->run())
{
driver->beginScene(true, true, video::SColor(255,100,101,140));
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}