image texture

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
ttom
Just popping in
Just popping in
Posts: 16
Joined: Wed Jan 12, 2005 12:06

image texture

Postby ttom » Tue Apr 01, 2008 05:24

Dear All:
I get the image from the imageset and I want texture of the image. How I do this.
thans
ttom

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

Postby CrazyEddie » Tue Apr 01, 2008 09:03

Hi,

When you load the imageset, the underlying imagery file loaded is copied into a texture. When referencing a CEGUI::Image on the imageset, you're accessing a small area of an existing, usually larger, texture.

If you want a texture containing a sub-rectangle of the larger whole imageset, you have to get the larger texture and perform the subrect copy yourself. If you just want the whole texture, that is slightly easier. In both cases the overall way you do this will depend upon the underlying renderer in use.

As an example, in OpenGL you might do something like this to access the underlying texture...

Code: Select all

using namespace CEGUI;

Imageset* myImageset =
    ImagesetManager::getSingleton().getImageset( "SomeImageset" );

Texture* cegui_tex = myImageset->getTexture();

GLuint gl_tex_id =
    static_cast<OpenGLTexture *>(cegui_tex)->getOGLTexid();

//
// TODO: Perform API specific operations on gl_tex_id
//
...



The approach for other rendering APIs is different, although similar, I hope this gives some ideas ;)

CE

User avatar
ttom
Just popping in
Just popping in
Posts: 16
Joined: Wed Jan 12, 2005 12:06

Postby ttom » Wed Apr 02, 2008 01:29

Thanks to CE to answer my question. :D
I want a texture containing a sub-rectangle of the larger whole imageset, so I need to perform subrect copy it to the texture. If it is ok, so I can write the code to test it.
Thanks again.
ttom

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

Postby CrazyEddie » Thu Apr 03, 2008 08:36

Yes, I believe this is the approach to take.

Good luck!!

CE.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 7 guests