Text X Shader

If there is something important you think is missing in the current version of ZGameEditor then you can post a feature request here!

Moderator: Moderators

Post Reply
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Text X Shader

Post by Kjell »

:?:

Since RenderText doesn't pass the automated UV mapping coordinates to its Material, there's no way to get this data into a Shader ( unless you pass it yourself explicitly ). Could this be fixed somehow?

K
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

I haven't thought about this. When using RenderText (I'm assuming with an imported texture font, not the built-in system font) it does not send texture coordinates, instead it modifies the texture matrix to translate the UV coords to the correct position on the font texture.

So try writing a shader that uses the texture matrix. I found an example here:

http://www.lighthouse3d.com/opengl/glsl ... hp?texture
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Ah,

That's good news .. should have tried that ( or looked in the source ). As you mention, you can just fetch the texture matrix using "gl_MultiTexCoord * gl_TextureMatrix" .. tested and working :)

K
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

I'm just curious what your font shader is doing,. care to post a little demo?
In fact, you seem to have been doing a load of shader development for the last while,. I for one would love to see some more demos,. (source released or not).
iterationGAMES.com
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Sure,

It's nothing special .. just a "typewriter" effect*. Attached is a test build and two screenshots of how it's supposed to look in case anything goes wrong :roll:

*You could also do this without a Shader by pushing letters outside of the screen depending on CharI, but you wouldn't for example be able to fade in the text as it appears.

K
Attachments
Text.jpg
Text.jpg (24.3 KiB) Viewed 5050 times
Text.zip
(44.89 KiB) Downloaded 461 times
Post Reply