How to apply a constant alpha to a Texture...

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to apply a constant alpha to a Texture...

ThomasR
...with an ImageDataFormat of RGB or BGR? Would one use Texture.setConstantColor?
Reply | Threaded
Open this post in threaded view
|

Re: How to apply a constant alpha to a Texture...

gouessej
Administrator
Why not using ABGR or RGBA instead? You can use an helper to access each pixel and modify it if needed. You can use a shader too.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: How to apply a constant alpha to a Texture...

ThomasR
Hi,

That's very interesting, thank you. Do you have examples of application of shaders in Jogamp Ardor3D based applications so I can study up?

However, my interest in BGR, RGB is that I don't want to expand the final image by 1 1/3 in a situation where
alpha is truly constant - it's a common use case for us and we often have long sequences of imagery to animate.

Tom
Reply | Threaded
Open this post in threaded view
|

Re: How to apply a constant alpha to a Texture...

gouessej
Administrator
Look at ardor3d-terrain, it uses GLSLShaderObjectsState. However, expanding the image would be easier to implement.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: How to apply a constant alpha to a Texture...

ThomasR
okay thanks! But expanding the image is a resource hit. How would one get started implementing constant alpha
for Texture?
Reply | Threaded
Open this post in threaded view
|

Re: How to apply a constant alpha to a Texture...

gouessej
Administrator
Actually, maybe it isn't. If the storage is aligned on 32 bits in memory, using one more byte to store a color component won't be a resource hit.

You just need a very basic fragment shader in which you pass the alpha component, the sampler for the texture and the texture coordinates in input and you modify the alpha component of the color in output. You may have to enable the blending.
Julien Gouesse | Personal blog | Website