In my experience of trying a procedural material is it is slow unless you
really know what you are doing. Trying to brute force change every pixel
every call to the regenerator met with bad results unless the texture was
256x256 or smaller.
----- Original Message -----
From: "Janek" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, November 16, 2007 3:57 AM
Subject: Re: [hlcoders] Dynamically creating material including text


--
[ Picked text/plain from multipart/alternative ]
Thx Paul and Mike for your suggestions. I think I will try both of them.
Paul's solution seems easier as we can use standard vgui functions
(surface->Draw*) but I don't know if render target will be updated at the
correct framerate.
Mike's solution sounds more complex (I don't know which command I can use
to
select a font, a color and to draw text) but it is a real material.

I'll work on that. Ty very much for your help mates.

2007/11/16, Paul Peloski <[EMAIL PROTECTED]>:

--
[ Picked text/plain from multipart/alternative ]
Another, easier way is with a render target.

Initializing:

- Create a render target texture of the size you need (derive
CBaseClientRenderTargets, you have to init a render target at the right
time), call it something like _my_rt0

Drawing:

- Use SetRenderTargetAndViewPort to set the render target and view area
- Clear the render target
- Paint a vgui control or several vgui controls (call Paint/PaintTraverse
or
something manually) or, use surface->Draw*
- The render target now contains whatever vgui painted, and you can
reference it in a .vmt using $basetexture "_my_rt0".

The way Mike suggested hasn't really worked for me, I had problems trying
to
get the procedural texture to work. This way is somewhat easier if you
just
want to draw text the way vgui does. If you need to upload text where you
already have the raw image data then use the procedural texture. Likewise
if
you wanted to read image data from a video decoder or unsupported image
format.

Regards,

Paul

On Nov 15, 2007 1:19 PM, Janek <[EMAIL PROTECTED]> wrote:

> --
> [ Picked text/plain from multipart/alternative ]
> Thx Mike. I'll read that again and again. At the moment I don't
understand
> everything. I hope I can write text using this method but I'm not sure.
>
> 2007/11/15, Mike Durand <[EMAIL PROTECTED]>:
> >
> > Try this:
> >
> > http://developer.valvesoftware.com/wiki/Procedural_Materials
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Janek
> > Sent: Thursday, November 15, 2007 7:45 AM
> > To: [email protected]
> > Subject: [hlcoders] Dynamically creating material including text
> >
> > --
> > [ Picked text/plain from multipart/alternative ]
> > Hi all,
> >
> > I would like to know if it is possible to dynamically create a
> > clean IMaterial (client side only) in which I write some texts which
can
> > be
> > an argument like "My text" or whatever.
> > I know the materials->FindMaterial( name, group ) which is using an
> > exisiting material. What I want is to create my own one dynamically
coz
> > I
> > don't know what text will be in this material.
> >
> > Any idea ?
> > --
> >
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list
> > archives,
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >
> >
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list
> > archives,
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >
> >
>
>
> --
> -------------------
> [EMAIL PROTECTED]
> --
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
--

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders




--
-------------------
[EMAIL PROTECTED]
--

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to