0

Suppose we have a texture of size 2560*240 that we want to render in an screen area of 320*240 pixels. So, each screen pixel is overlap of 2560/320=8 texture samples. I want the OpenGL shader be able to choose maximum color value among these 4 texture samples. How can I achieve this?

Next step is to downsample a texture of size 2560*240 to 640*480 screen, in such a way that each two consecutive screen pixels cover minimum and maximum of 8 texture samples that fall in two consecutive screen pixels. So, user can always spot minimum and maximum color values if texture minification happens.

Ali Tavakol
  • 405
  • 3
  • 11
  • 2
    what about leave texture as is and use Fragment shader ... fetching all needed texels and choosing which you want ... – Spektre Oct 06 '18 at 06:40
  • Fetching all overlapping texels in fragment shader is exactly what I need. But how to fetch? Could you post an example? – Ali Tavakol Oct 06 '18 at 06:56
  • 1
    Are you familiar with GLSL shaders? here [How to implement 2D raycasting light effect in GLSL](https://stackoverflow.com/a/34708022/2521214) is small example that fetches a lot of texels per each fragment. And here a full example how to use GL+GLSL in C++ [complete GL+GLSL+VAO/VBO C++ example](https://stackoverflow.com/a/31913542/2521214) – Spektre Oct 06 '18 at 07:03
  • @Ali as you're new here, you should be aware that this is not the most correct way to ask for help.You must provide a specific technical problem including some example of what you're already trying to do.You can't expect people just do everything for you or guess what's your problem. Your question is just TOO BROAD. – Michael IV Oct 07 '18 at 10:53
  • @MichaelIV Yes, you are right. But I have asked two questions recently, and I received very helpful answers that opened new doors to me. I believe a little hint from experts who answer questions, can open up my mind when I read and work on the answers very carefully. I use those little answers too. Anyway, I am very happy with such a good place! – Ali Tavakol Oct 07 '18 at 14:37
  • @Ali adding sample texture and some code you currently have as an MCVE would narrow the question down and also encourage others to answer as right now the answer would mean to code everything from scratch and create own sample data which is way much more work than the solution itself... and people like me are too lazy to do it unless I got it already in some form ... – Spektre Oct 08 '18 at 10:08

0 Answers0