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.

CEGUI::BasicImage * reserveImage(std::string name){ // The ImageManager must be given the type of Image to create, in this case, it is "Basic Image", which is important. // The second argument is the name CEGUI will use to identify the item. // If loaded via an imageset, the name would be "TaharezLook/name" for example, it is not needed to add something like 'TaharezLook/' // in front of the name, as long as the image has a unique name, it will be usable, of course adding a little 'namespace' can help with that.

//To check if the empty Image, lacking any information about UVs or texture dimensions has been created, use the ImageManager if(!CEGUI::ImageManager::getSingleton().isDefined(name)) { /* do your error handling code here */ }

return out;}

Next, an empty CEGUI::OpenGLTexture, which will merely act as a bridge between your own OpenGL texture from your application/game and the CEGUI renderer.

// Put something like this where you are creating and initializing all your Widgets, like your textboxes and whatnot.CEGUI::BasicImage * myOwnIconImage = reserveImage("myOwnIconImage);CEGUI::OpenGLTexture * myOwnIconTexture = reserveGlTexture("myOwnIconTexture", m_yourCeguiOgl3Renderer);

//Add the texture to the image, but both are still empty and dumb and useless at this point.myOwnIconImage->setTexture(myOwnIconTexture);

Now your Image/Texture combo is ready to be filled ingame/application.

Let's say you want to render a tile from your tileset into a StaticText window, this is how you could do it.Again, don't blindly copy and paste.

//Now that the CEGUI OpenGLTexture has the handle to the same texture handle you use when you're rendering your tileset with your own logic, //We will now use the CEGUI::BasicImage to tell CEGUI which region of this texture it should render when we use the BasicImage as an Asset for a CEGUI widget //Note: This method uses actual pixel dimensions, and not UV ranges from 0 to 1, etc //We want to render the first image of the Atlas, it's at 0,0 and is 32 pixels wide and high. myOwnIconImage->setArea(CEGUI::Rectf(0,0,32,32));

//Now let's stringstream it into a static Text widget //Which we have created elsewhere, if you need an example, TaharezLook has a TaharezLook/StaticText widget, which you can create and cast into a CEGUI::Window* //We must use the name of "myOwnIconImage", which, in this case is "myOwnIconImage"

I hope this helps a little bit.The BasicImage and GLTexture, combined, are the star of the show, at least for the OpenGL3 renderer and CEGUI 8.7.

Caveat:This only works for me for static text boxes, so far. Adding the image as a Button state or the background of a window seems to turn things upside down,but I don't want to think about that right now, I don't want to go to that place again...that dark place.

It seems that inserting your image into a widget via "text tags" ([image='myOwnIconImage]) corrects the "internal BasicImage Area" (aka the texture atlas region it represents) on its own.(Probably by checking if the height is smaller than the Y position of the region, or something)Just so anyone reading this knows. The other ways, by setting them via properties had the textures flipped, so in that case you have to also flip the Basic image area, like in this example, instead of

It will then work for, so far, all methods of inserting a picture into a widget..Blindsided me at first, though, since the stringstreamed version I had was rightside up from the get go, and the other two test windows were upside down, after flipping the area, I expected the strinstreamed version to then be upside down and the others right side up, but, no...all were right side up.

Caveat:Even if you give CEGUI your own texture by putting the OpenGL handle into an empty CEGUI texture, if you change OpenGL texture handles for the CEGUI texture, the CEGUI texture WILL DELETE THE PREVIOUS OF YOUR OWN OPEN GL TEXTURE THROUGH THE HANDLE YOU GAVE IT BEFORE CHANGING TO THE NEW HANDLE.So, think ahead and make as many CEGUI textures as you have different own GL textures you plan to hand over to CEGUI through handles.(Aka, the most resource friendly way since it recycles your own texture by using it directly)

This also confused me for a moment because suddenly everything using the first texture went black, and I had to lay down for a bit to not get a lethal stroke.

I don't know if the new dev version has fixed it, but, 8.7 users ...keep this in mind.You will have to write your own wrapper/hacky thing around, if you don't want to write an entirely new renderer or texture class just for this single issue.I went with a class that inherits the CEGUI Gl texture and makes it not clobber the user given GL texture handle, it's very messy and a monkey on theback, but better than having to ship the program with a custom cegui lib...Although I might go for that in the end.

Last edited by Damnit on Wed Apr 24, 2019 12:20, edited 10 times in total.

I am sorry that you had issues with this, the documentation definitely needs improvements. Since we are low on active devs atm it would be great if you could add any of your findings to the wiki. You can access it with your forum account.