Drawing custom text

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Sun Jun 01, 2008 19:10

Hi,

I'm not sure why the rendering would show up at other times but not when done in that member function.

All I was saying in relation to state was that when I made a test app unless I setup some state in that function before doing the rendering, nothing was showing up, after adding some state settings things started showing up.

If you were to add some init code in that member func - maybe only temporarily, as a test - you would at least be able to confirm one way or the other whether this is the issue at hand.

Now in my test case, I had done no prior initialisation of the GL state, obviously you are doing this, so you may need to further investigate how / why / where the state is getting subsequently modified (it should not be CEGUI that's causing issue since the GL renderer module saves and restores the prior state).

CE.

User avatar
Kevin
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Mon May 26, 2008 15:44

Postby Kevin » Sun Jun 01, 2008 21:16

Hello,

As I said, it's not that nothing was showing up - when I made the background a colour besides black it would draw a square of the appropriate size in the appropriate place of a slightly darker colour than the background. And I have since discovered (sort of) why it was doing that...

I tried getting it to save the whole screen (800 x 600) into the texture, and draw the entire thing like this. When doing this, it did show the square and line it was supposed to. However, for some reason, the glOrtho(0, 800, 600, 0, 1, -1); was not being preserved - i.e., the texture it drew was upside-down. However, even if calling glOrtho(0, 800, 600, 0, 1, -1); again at various points through this populateRenderCache() function, it's still upside-down.

The other slightly odd thing is the texture is showing up as slightly transparent when using GL_RGBA and CEGUI::Texture::PF_RGBA, and slightly darker when using GL_RGB and CEGUI::Texture::PF_RGB, and I'm not sure why...

Thanks again,
Kevin

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Mon Jun 02, 2008 08:31

Hi,

This is just a "quickie" reply - not much time for anything else just now :)

Thanks for clarifying the issue, and for the tests / results that you've done - that's most useful...

I think, but am not 100% sure, the issue with the texture being upside down is largely due to the GL having the origin at the bottom left corner, where CEGUI is expecting it to be the top-left corner; for example when loading some image types with the origin at the bottom-left we have to flip them prior to loading the data onto a texture.

As for the issues with slight transparency / darker images, I have no ideas right at this moment - are the colours otherwise correct (meaning, it's not a channel getting put in the wrong place somewhere / somehow?)

CE.

User avatar
Kevin
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Mon May 26, 2008 15:44

Postby Kevin » Wed Jun 04, 2008 16:29

Hello again,

It seems that the problem was something with OpenGL's drawing and/or readPixels(...)... but I'm still not sure what exactly.

Just to test it, I remembered I had some code from a while back that draws lines, circles, polygons, etc to memory using the "industry standard" algorithms... so I tried using that instead, and it works as expected - the image is not flipped, and the transparency / darkness are as expected.

After doing this, I decided that it was sort of wasteful / hack-ish anyways to have OpenGL draw it to the screen, save it to memory, and clear it, so I think I'll just leave it as it is.

Thanks again for all your help!
Kevin

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Thu Jun 05, 2008 08:53

Hi,

Ok. Thanks for reporting back :)

I think at some stage (though not in the next couple of days or anything) I might create an example of something like this (custom widget doing custom drawing), since it's a really good 'advanced' use of the system and demonstrates a few things that people are probably not aware of (obviously need to overcome some issues though!)...

CE

daves
Home away from home
Home away from home
Posts: 253
Joined: Thu Feb 02, 2006 20:12

Postby daves » Mon Jun 16, 2008 13:46

CrazyEddie wrote:Hi,

Ok. Thanks for reporting back :)

I think at some stage (though not in the next couple of days or anything) I might create an example of something like this (custom widget doing custom drawing), since it's a really good 'advanced' use of the system and demonstrates a few things that people are probably not aware of (obviously need to overcome some issues though!)...

CE


Looking forward to this.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Mon Jun 16, 2008 18:14

Cool. I'd forgotten all about this - such a shame everybody else didn't :lol:

Seriously though, I'll definitely get around to this sometime soon (perhaps around the time 0.6.1 gets released).

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 14 guests