Skip to content

Instantly share code, notes, and snippets.

@DavidYKay
Last active December 1, 2020 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidYKay/2c70522f42a98d4672dc384b338cb7ac to your computer and use it in GitHub Desktop.
Save DavidYKay/2c70522f42a98d4672dc384b338cb7ac to your computer and use it in GitHub Desktop.
[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