Horde3D http://horde3d.org/forums/ |
|
Dynamic Textures http://horde3d.org/forums/viewtopic.php?f=1&t=1879 |
Page 1 of 1 |
Author: | tshannon [ 18.04.2013, 04:07 ] |
Post subject: | Dynamic Textures |
I've seen the wiki entry on dynamic textures for use in shaders, but I'm having issues with what I'm trying to do. I'm using a freetype library to rasterize text to a png image in memory. I'm hoping to instead write a dynamic texture and use it in an overlay to get around the current text limit (overlay limit) I'm having with the built in bitmap based text (h3dutshowtext). Should this be possible? The engine supports .png files, but I'm wondering if I write directly to the texture stream that's post decoding. Is what I'm proposing even possible? |
Author: | Irdis [ 18.04.2013, 14:32 ] |
Post subject: | Re: Dynamic Textures |
If freetype library supports rasterizing text just to array of bytes, then you can create a new texture in horde once through h3dCreateTexture and update it dynamically when you need. Otherwise, you are doing a lot of work - encode texture to png, copy it to horde, decode it again to byte array and push it to opengl. Something like this should work well for you: Code: std::string texName = "DynamicText";
width = 256; height = 256; H3DRes TextureID = h3dCreateTexture( texName.c_str(), width, height, H3DFormats::TEX_BGRA8, H3DResFlags::NoTexMipmaps ); h3dSetResParamI( yourMaterial, H3DMatRes::SamplerElem, 0, H3DMatRes::SampTexResI, TextureID ); // sets the created texture to your text material // updating unsigned char* texData = ( unsigned char * )h3dMapResStream( TextureID, H3DTexRes::TextureElem, 0, H3DTexRes::ImgPixelStream, true, false ); memcpy( texData, freeTypeData, dataSize ); h3dUnmapResStream( TextureID ); |
Author: | tshannon [ 19.04.2013, 03:09 ] |
Post subject: | Re: Dynamic Textures |
SetResparam was what I was missing. Thanks, |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |