Drawing lines and fonts into a texture?

Problems building or running the engine, queries about how to use features etc.
Post Reply
Nav
Halfling
Posts: 91
Joined: Fri Sep 30, 2011 11:22 am
x 2

Drawing lines and fonts into a texture?

Post by Nav »

I've seen the penguin sample code that comes with Ogre. It modifies a texture texel by texel.
I need to replace some opengl code with Ogre, and in opengl a texture is created in the gpu and opengl has commands to draw a polyline, given a bunch of vertices.

Is there an equivalent in Ogre? Can I draw a line into a texture/pixel-buffer? Can I draw a font into it? I've searched a lot, but am completely confused with the number of API's present.
User avatar
omniter
OGRE Contributor
OGRE Contributor
Posts: 424
Joined: Thu Mar 19, 2009 8:08 am
Location: Canada
x 44

Re: Drawing lines and fonts into a texture?

Post by omniter »

Sure, just use render-to-texture. Normally, you're rendering to the screen, but you can set the render target to a texture instead. The SDK contains a render-to-texture sample. In fact, there is code in there specifically to hide the overlays when rendering to texture so that you don't get GUI in the water reflections. Once, when I was converting that sample, I accidentally left that part out, and I saw buttons and text in the water. Pretty neat. I imagine that could be what you want.
Nav
Halfling
Posts: 91
Joined: Fri Sep 30, 2011 11:22 am
x 2

Re: Drawing lines and fonts into a texture?

Post by Nav »

Ah...that's possible? Cool! So I guess I can use ManualObject to draw lines and render it to a texture. Only disappointment was that manualObject didn't have functions for drawing circles etc.
A bit confusing as of now coz I didn't explore RTT etc. fully, but thanks so much! Will get back if I have any queries.
Post Reply