Font does not display

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
drhenry
Posts: 16
Joined: Fri Mar 26, 2010 8:03 am

Font does not display

Post by drhenry »

Hello,

I'm trying to add some Gui functionality to my Irrlicht application without success. Only black dots appear, where the button caption should be...
See my screenshot:
http://rapidshare.com/files/413764772/S ... enshot.jpg
((Button is to the left and another static text is some pixels above it - both only show some black dots...)

Here's a snapshot of my code:

Code: Select all

//------------ main.cpp ---------------------
int main()
{
...
    CSsaoGui ssaoGui = CSsaoGui(device);
    ssaoGui.initGui();
    while(device->run())
    {
        ...
	driver->beginScene(true, true, SColor(0x0));

	// EffectHandler->update() replaces smgr->drawAll(). It handles all
	// of the shadow maps, render targets switching, post processing, etc.
	effect->update();
	ssaoGui.drawGui();

	driver->endScene();
    }   
}


//-------------- CSsaoGui.h ---------------------
...
class CSsaoEventReceiver : public IEventReceiver
{
public:
        CSsaoEventReceiver(SAppContext& context) : m_context(context) { }

        virtual bool OnEvent(const SEvent& event);

private:
	//local reference to the parameter struct variable
	SAppContext& m_context;
};


class CSsaoGui
{
public:
	CSsaoGui(IrrlichtDevice* device);

	void drawGui();
	void initGui();
...
private:

	SAppContext m_paramContext;
	IrrlichtDevice* m_device;
	IVideoDriver* m_driver;
	IGUIEnvironment* m_guiEnv;
	CSsaoEventReceiver* m_receiver;

//-------------- CSsaoGui.cpp ---------------------

bool CSsaoEventReceiver::OnEvent(const SEvent& event)
{
...
}

CSsaoGui::CSsaoGui(IrrlichtDevice* device) : m_device (device)
{
	m_driver = device->getVideoDriver();
	m_guiEnv = device->getGUIEnvironment();
	m_paramContext.device = m_device;
	m_receiver = new CSsaoEventReceiver(m_paramContext);
	m_device->setEventReceiver(m_receiver);
}

void CSsaoGui::initGui()
{
...
	IGUISkin* skin = m_guiEnv->getSkin();
	skin->setFont(m_guiEnv->getBuiltInFont());

	IGUIButton* button = m_guiEnv->addButton(rect<s32>(10,240,110,240 + 32), 0, GUI_ID_QUIT_BUTTON,
		L"Quit", L"Exits Program!");
	IGUIStaticText* staticText = m_guiEnv->addStaticText(L"Blabla", rect<s32>(10,130,110,130 + 64));
}

void CSsaoGui::drawGui()
{
	m_guiEnv->drawAll();
}
What's wrong? Any ideas?
I've already tried to change compiler settings from "Use Unicode" to "Use Multibyte" without success.
drhenry
Posts: 16
Joined: Fri Mar 26, 2010 8:03 am

Post by drhenry »

Meanwhile I've used another font ("fontcourier.bmp") which doesn't work either. But interesting: instead of the black spots (see screenshot above) where the text should be, now a few cryptic letters appear.
Any ideas?
drhenry
Posts: 16
Joined: Fri Mar 26, 2010 8:03 am

Post by drhenry »

I compiled and executed Tutorial 5 ("User interface"), which works fine - the fonts are displayed correctly. Project settings are nearly the same as mine.

Ah, wait: I've just added an image to the window:

Code: Select all

m_guiEnv->addImage(m_driver->getTexture("./media/irrlichtlogo2.png"), position2d<int>(10,10));
and the image is upside down! Maybe the reason for this causes the font image to be accessed upside down, too...

Any idea, why the image is displayed upside down automatically?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

that's strange, and I can't reproduce it... :shock:
so more informations are needed !!!

what Irrlicht version ???
which driver ???
do you use any other stuff (eg. xeffects) ???
I don't know what it was, but IIRC there was a lib that had such problems with openGL...

try other drivers...
make a simple test case that reproduces the behavior...
if you're using additional stuff try the test case with/without it...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
drhenry
Posts: 16
Joined: Fri Mar 26, 2010 8:03 am

Post by drhenry »

Irrlicht version 1.7.1.
Open GL driver (via EDT_OPENGL)
Windows XP Home SP3
renderer OpenGL 3.3.0
GeForce 8600GT
GLSL version 3.3

Yes, I've based my project on XEffects (I just wanted to code another ScreenSpace Ambient Occlusion demo).

I can't change EDT_OPENGL to DirectX, cause I have some glsl shaders only (no hlsl - and probably won't implement them).

Download my VS 2008 project here:
http://rapidshare.com/files/413905318/SSAOEffect.zip
(it's in development, so don't expect too much :))
You'll find a CSsaoGui class, which is responsible for buttons and so on.
drhenry
Posts: 16
Joined: Fri Mar 26, 2010 8:03 am

Post by drhenry »

Jesus!
Thanks for the hint with XEffects.
There's another post dscribing the issue:
http://irrlicht.sourceforge.net/phpBB2/ ... 3842800ce5

I just had to add

Code: Select all

driver->setMaterial(irr::video::SMaterial());
to the end of EffectHandler::update and the GUI font displays correctly.
I don't really know, what caused the problem, but anyway, thanks a lot, Acki![/code]
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

yeah, so I recalled correctly and it was indeed xeffects like I thought !!! :lol:
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply