different formats for glsl color

Started by
6 comments, last by _Flame_ 5 years, 5 months ago

Hello.

I can only use vec4 in glsl as out color. How to use other formats like int, uint, ivec4, ..?

Advertisement

Have you tried this? http://lmgtfy.com/?q=opengl+pixel+output+uint ?

Okay, so I'm not just evil:


#version 440

layout(location = 0) out uvec4 rgba0;

https://www.khronos.org/opengl/wiki/Data_Type_(GLSL)

26 minutes ago, pcmaster said:

Have you tried this? http://lmgtfy.com/?q=opengl+pixel+output+uint ?

Okay, so I'm not just evil:



#version 440

layout(location = 0) out uvec4 rgba0;

https://www.khronos.org/opengl/wiki/Data_Type_(GLSL)

Hello . Yes, black screen.

Maybe we need to change framebuffer pixel format somehow.

I guess what exactly are you expecting or trying to achieve ? If you are changing the output type of your fragment shader, how are you visualizing the output? Please remember that no matter what the out of your fragment shader is, if you are expecting a visual feedback then that out will still be converted to some 'visual' by the windowing system responsible for realizing the output of the framebuffer. In the end the display you are looking at operates on RGB primaries ( 8-bit for the most part ) so integral types as somewhat meaningless unless you are using them for intermediate buffers...Also as stated above, the framebuffer being rendered to have a big impact on how the resulting fragment shader output get 'converted' and stored.

45 minutes ago, cgrant said:

I guess what exactly are you expecting or trying to achieve ? If you are changing the output type of your fragment shader, how are you visualizing the output? Please remember that no matter what the out of your fragment shader is, if you are expecting a visual feedback then that out will still be converted to some 'visual' by the windowing system responsible for realizing the output of the framebuffer. In the end the display you are looking at operates on RGB primaries ( 8-bit for the most part ) so integral types as somewhat meaningless unless you are using them for intermediate buffers...Also as stated above, the framebuffer being rendered to have a big impact on how the resulting fragment shader output get 'converted' and stored.

What I actually expect is to change a format of output into something like GL_RGBAI8 and be able to write int where each byte prepesents corresponding color.

I found several post in the internet where people state that the only possible format is vec4. Is it true?

Yes, I want to change the format of resulting color but not intermediate buffer.

On 11/23/2018 at 7:46 AM, _Flame_ said:

Hello.

I can only use vec4 in glsl as out color. How to use other formats like int, uint, ivec4, ..?

Read this. Your draw buffer input must correspond to your fragment shader output type.

6 hours ago, _Silence_ said:

Read this. Your draw buffer input must correspond to your fragment shader output type.

Thank you, now it's clear that I need to create a different framebuffer with specific format.

This topic is closed to new replies.

Advertisement