Skip to content

Instantly share code, notes, and snippets.

@DavidYKay
Last active Dec 1, 2020
Embed
What would you like to do?
[OGRE 2.1] Rendering text to a 3D object

Hello everyone,

My team and I are working on rendering text onto the surface of a 3D object.

We need the ability re-render the texture at runtime as the text changes.

Our current approach is to:

  • Create a Texture -> textureManager.createTexture()
  • Write text onto the texture -> [project-specific code]
  • Create a Datablock -> hlmsPbs.createDatablock()
  • Set the Texture as the diffuse texture in the datablock -> datablock.setTexture()
  • Set the Datablock on an Item for rendering -> item.setDatablock()

Question 1: Is this a sane approach?

Question 2: Is there any sample code for how to correctly call datablock.setTexture()? We are having trouble with this step.

We have successfully rendered text onto a texture, verified by calling image.convertFromTexture(), image.save().

We have successfully used datablock.setDiffuse() to apply a color to an Item, but we have yet to change an Item's texture by calling datablock.setTexture().

==========

FYI: We began our journey by following this OGRE 1.X example: http://wiki.ogre3d.org/HowTo%3A+Write+text+on+texture.

==========

Please let me know if either:

A. Our approach is fundamentally flawed.
B. You need more information on our implementation to identify the particular issue.

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment