Page 1 of 1

image texture

Posted: Tue Apr 01, 2008 05:24
by ttom
Dear All:
I get the image from the imageset and I want texture of the image. How I do this.
thans
ttom

Posted: Tue Apr 01, 2008 09:03
by CrazyEddie
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

Posted: Wed Apr 02, 2008 01:29
by ttom
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

Posted: Thu Apr 03, 2008 08:36
by CrazyEddie
Yes, I believe this is the approach to take.

Good luck!!

CE.