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.
Drawing custom text
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
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
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
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
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.
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.
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
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
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
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
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
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.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Who is online
Users browsing this forum: No registered users and 2 guests