Too slow 2D
Too slow 2D
Hello everyone!
I just recently started to use IrrLicht
I decided to experiment with 2D graphics. upload picture "demoback.jpg" from the folder "media". well, and rendered them in the loop 4 times. draw the same cursor-image.
when drawing visible plume from the cursor x_x.
Surely such a small speed of rendering in 2D IrrLicht?
I work in ubuntu9.10, using code blocks.
video card - gf9500gt, 2 gigabytes of RAM, intel dual core 3GHz.
sorry for my bad english
I just recently started to use IrrLicht
I decided to experiment with 2D graphics. upload picture "demoback.jpg" from the folder "media". well, and rendered them in the loop 4 times. draw the same cursor-image.
when drawing visible plume from the cursor x_x.
Surely such a small speed of rendering in 2D IrrLicht?
I work in ubuntu9.10, using code blocks.
video card - gf9500gt, 2 gigabytes of RAM, intel dual core 3GHz.
sorry for my bad english
Last edited by GRAVITY on Sun Feb 28, 2010 5:02 pm, edited 1 time in total.
Code: Select all
#include <irrlicht.h>
#include "driverChoice.h"
#include <string.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
int initGraphics(void);
IrrlichtDevice *device;
IVideoDriver* driver;
ISceneManager* smgr;
IGUIEnvironment* guienv;
class MyEventReceiver : public IEventReceiver
{
public:
// This is the one method that we have to implement
virtual bool OnEvent(const SEvent& event)
{
// Remember whether each key is down or up
if (event.EventType == irr::EET_KEY_INPUT_EVENT)
KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
return false;
}
// This is used to check whether a key is being held down
virtual bool IsKeyDown(EKEY_CODE keyCode) const
{
return KeyIsDown[keyCode];
}
MyEventReceiver()
{
for (u32 i=0; i<KEY_KEY_CODES_COUNT; ++i)
KeyIsDown[i] = false;
}
private:
// We use this array to store the current state of each key
bool KeyIsDown[KEY_KEY_CODES_COUNT];
};
MyEventReceiver receiver;
int main()
{
initGraphics();
ITexture* img_pl = driver->getTexture("demoback.jpg");
// ITexture* img_pl = driver->getTexture("pl.png");
//driver->makeColorKeyTexture(images, position2d<s32>(0,0));
gui::IGUIFont* font = device->getGUIEnvironment()->getBuiltInFont();
gui::IGUIFont* font2 = device->getGUIEnvironment()->getFont("../irrlicht-1.7.1/media/fonthaettenschweiler.bmp");
//rect<s32> imp1(0,0,385,78);
// rect<s32> imp2(387,15,423,78);
driver->getMaterial2D().TextureLayer[0].BilinearFilter=true;
driver->getMaterial2D().AntiAliasing=16;
while(device->run())
{
u32 time = device->getTimer()->getTime();
position2d<s32> m = device->getCursorControl()->getPosition();
if(receiver.IsKeyDown(KEY_ESCAPE)) break;
driver->beginScene(true, true, SColor(255,100,101,140));
driver->draw2DImage(img_pl, position2d<s32>(0,0),
rect<s32>(0,0,512,512), 0,
SColor(255,255,255,255), true);
driver->draw2DImage(img_pl, position2d<s32>(0,512),
rect<s32>(0,0,512,512), 0,
SColor(155,255,255,255), true);
driver->draw2DImage(img_pl, position2d<s32>(512,512),
rect<s32>(0,0,512,512), 0,
SColor(155,255,255,255), true);
driver->draw2DImage(img_pl, position2d<s32>(512,0),
rect<s32>(0,0,512,512), 0,
SColor(155,255,255,255), true);
font2->draw(L"This demo shows that Irrlicht is also capable of drawing 2D graphics.",
core::rect<s32>(m.X-20, m.Y-20, m.X+20, m.Y+20),
video::SColor(255,255,255,255),1,1);
driver->draw2DRectangle(video::SColor(155,255,255,0),
core::rect<s32>(m.X-20, m.Y-20, m.X+20, m.Y+20));
smgr->drawAll();
// guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
int initGraphics()
{
device = createDevice(EDT_OPENGL, dimension2d<u32>(1280, 1024), 32, true, false, false, &receiver);
if (!device) return 1;
device->setWindowCaption(L"Just a caption :)");
driver = device->getVideoDriver();
smgr = device->getSceneManager();
guienv = device->getGUIEnvironment();
return 0;
}
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Are you sure your graphic card supports this strange resolution? Maybe try a more common one.GRAVITY wrote:Code: Select all
dimension2d<u32>(1280, 1024)
Last edited by randomMesh on Sun Feb 28, 2010 8:44 pm, edited 1 time in total.
"Whoops..."
That's not a strange resolution That's a common 4:3 19" displayrandomMesh wrote:Are you sure your graphic card supports this strange resolution? Maybe try a more common one.GRAVITY wrote:Code: Select all
device = dimension2d<u32>(1280, 1024)
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am