Texture Feedback

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of Shaun Shaun 3 months, 1 week ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #55417
    Profile photo of john
    john
    Member

    Has anyone tried using an RGBA texture as both and output and input. I realise this is not advised but I wonder if it would be possible to use the R channel as the output while reading from the B channels. Technically it is feedback but I would have thought it could be possible if they were on separate color channels, using a glcolor mask to ensure B channel is not written to ?

    Thanks for any info

    #55418
    Profile photo of Shaun
    Shaun
    Member

    Hi John,

    As far as I am aware reading & writing to the same texture (FBO attachment) could result in undefined behavior (may return garbage data); to prevent this the attachment should only be a data source or target not both at the same time. I would recommend using two textures, i.e. fill the first texture with some data then set it as an input to the next stage in your pipeline and use the second texture as an output. If you only require one channel you can set the texture format to R8 which will give you a texture with a single 8 bit channel.

    Kind regards,
    Shaun

    #55606
    Profile photo of john
    john
    Member

    Thanks for the reply Shaun,
    Just leaving this as a note here – I did manage to get this working in the end, of course as I said at the outset, this is not a recommended approach. In our case we were very careful to ensure both reading (texture2d) and writing was not done to the same color channel.

    Regards

    #55607
    Profile photo of Shaun
    Shaun
    Member

    Hi John,

    I am glad to hear you got this working, one thing to keep in mind though is that different devices may handle this situation differently so it may work on one platform but not on another, the behavior is dependent on the implementation provided by the graphics driver.

    Kind Regards,
    Shaun

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.