Another ghetto solution is to not map to 0 to 255. map to 0 to 254, and then
127 is your 0

On Fri, Jul 30, 2010 at 7:10 AM, Ian Mallett <geometr...@gmail.com> wrote:

> Hi,
>
> Intro:
> So, I'm working on computational fluid dynamics, and I need to initialize a
> velocity texture, which stores a vector field in an image.  Velocity vectors
> can have a range of values; each component could be either positive and
> negative.  The X component goes in the red channel, the Y in the green, and
> so on.  To store the values, the image maps the range [0,255] to
> [-1.0,1.0].  I need to have a surface set to precisely velocity = 0 on all
> channels.
>
> The problem:
> Because of this, I need a surface filled with the color 127.5.  Obviously,
> more than 8 bits per channel are required.  To update the texture, I'm using
> GL_RGBA32F_ARB, which allocates 32 bits per channel.  Unfortunately, the
> base image created by PyGame has a value of 127 ≈ -0.00196 velocity.  In
> practice, this leads to "drift" in the simulation.  Can something be done to
> send a 32 bit per channel surface filled with 127.5 values to the OpenGL?
>
> Thanks,
> Ian
>

Reply via email to