DRAW PROBLEMS

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
Mh025
Posts: 16
Joined: Wed Jul 11, 2007 4:10 pm

DRAW PROBLEMS

Post by Mh025 »

Hi, I have a new problem, if I try to change the position of an object in the while loop like this:

Code: Select all

while(device->run())
{
    driver->beginScene(true, true, SColor(255,100,101,140));
          vector3df pos = object->getPosition();
          pos.Z += 100;
          object->setPosition(pos);

          smgr->drawAll(); 
          guienv->drawAll();  
    driver->endScene();
}
The drawing is not fluid and slow, the same problem there is with 2D image or general after getPosition() function, I have to insert the code in other part of the source or there is a method for fix it?
Masterhawk
Posts: 299
Joined: Mon Nov 27, 2006 6:52 pm
Location: GERMANY
Contact:

Post by Masterhawk »

You add 100 units to the Z-value every frame. With 75 fps you add 7500 every second. I think that it's a little too fast.
Try to reduce the pos.Z += 100; to somthing like "pos.Z += 1" ;)
Image
Mh025
Posts: 16
Joined: Wed Jul 11, 2007 4:10 pm

Post by Mh025 »

Masterhawk wrote:You add 100 units to the Z-value every frame. With 75 fps you add 7500 every second. I think that it's a little too fast.
Try to reduce the pos.Z += 100; to somthing like "pos.Z += 1" ;)
Eheheh sorry for the mistake the real code was:

Code: Select all

while(device->run())
{
    driver->beginScene(true, true, SColor(255,100,101,140));
          vector3df pos = camera->getPosition();
          pos.Z += 100;
          object->setPosition(pos);

          smgr->drawAll();
          guienv->drawAll(); 
    driver->endScene();
} 
It draw object at camera pos + 100Z, but the problem there is also with draw2DImage and many other stuff in while()

Also with this:

Code: Select all

while(device->run()) 
{                         
	driver->beginScene(true, true, SColor(255,100,101,140));
             	smgr->drawAll(); 
             	guienv->drawAll();  
                 
                	core::position2d<s32> m = device->getCursorControl()->getPosition();
                	// Drawa il mirino
                	driver->draw2DImage(images, core::position2d<s32>(m.X+20,m.Y+20),core::rect<s32>(0,0,32,32),0,video::SColor(255,255,255,255), true);
           driver->endScene();
}
The target is drawed very bad and slow :|
Post Reply