Horde3D

Next-Generation Graphics Engine
It is currently 28.03.2024, 11:31

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Dynamic Textures
PostPosted: 18.04.2013, 04:07 
Offline

Joined: 19.01.2012, 21:01
Posts: 55
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?


Top
 Profile  
Reply with quote  
 Post subject: Re: Dynamic Textures
PostPosted: 18.04.2013, 14:32 
Offline

Joined: 17.11.2009, 17:00
Posts: 205
Location: Russia, Moscow
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 );


Top
 Profile  
Reply with quote  
 Post subject: Re: Dynamic Textures
PostPosted: 19.04.2013, 03:09 
Offline

Joined: 19.01.2012, 21:01
Posts: 55
SetResparam was what I was missing.

Thanks,


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 26 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group