Recent

Author Topic: Fast hardware image blur  (Read 39766 times)

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: Fast hardware image blur
« Reply #15 on: October 03, 2016, 09:15:32 pm »
Interesting.

I haven't implemented framebuffers yet.  :-[

I am learning as well. So using glBindFrameBuffer can change the current canvas. Hmmm...
Conscience is the debugger of the mind

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Fast hardware image blur
« Reply #16 on: October 04, 2016, 11:09:15 am »
OK, So if you got time to implement it please let me know. Excuse me for not implementing this myself, you know m, I just know how to use these to make  higher level work. these are way more complicated for me :D

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: Fast hardware image blur
« Reply #17 on: October 04, 2016, 02:10:26 pm »
I will do when I have some time. That will be a nice feature and will allow to do antialiasing via resampling. At least now I have a rough idea of how to do it. There are some examples there:
https://www.opengl.org/wiki/Framebuffer_Object_Examples
Conscience is the debugger of the mind

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Fast hardware image blur
« Reply #18 on: October 04, 2016, 02:21:03 pm »
Happty to hear that ;)

Sanem

  • Full Member
  • ***
  • Posts: 173
Re: Fast hardware image blur
« Reply #19 on: January 19, 2017, 01:25:15 pm »
Hi

I was testing Circular testshader1 project in this post:
http://forum.lazarus.freepascal.org/index.php/topic,30012.msg211701.html#msg211701

with the new fragment glsl code in this post for fast blur:
http://forum.lazarus.freepascal.org/index.php/topic,30012.msg224043.html#msg224043

and I got this error you can see in the picture attached, then I set the version in the code "440" because my OpenGL version is 4.4, but it seams that the version in TBGLShader3D did not assign correctly, or I am not setting the version correctly in the create shader function in UMyShader class, and I do not know where is the problem with glsl version. Here is the code :

Code: Pascal  [Select][+][-]
  1. constructor TMyShader.Create(ACanvas: TBGLCustomCanvas);
  2. begin
  3.   inherited Create(ACanvas, ReadFileToString('mix.vertex.glsl'), ReadFileToString('mix.fragment.glsl'), '', '440');
  4.   FFadeFactorUniform := UniformSingle['fade_factor'];
  5.   FTexturesUniform[0] := UniformInteger['textures[0]'];
  6. end;
  7.  

I am using windows 10, Lazarus 1.6 and BGRABitmap from Git.

Any help appreciated prior
« Last Edit: January 22, 2017, 10:15:59 am by simin_sh »

Sanem

  • Full Member
  • ***
  • Posts: 173
Re: Fast hardware image blur
« Reply #20 on: January 22, 2017, 12:12:43 pm »
Hi

I was testing Circular testshader1 project in this post:
http://forum.lazarus.freepascal.org/index.php/topic,30012.msg211701.html#msg211701

with the new fragment glsl code in this post for fast blur:
http://forum.lazarus.freepascal.org/index.php/topic,30012.msg224043.html#msg224043

and I got this error you can see in the picture attached, then I set the version in the code "440" because my OpenGL version is 4.4, but it seams that the version in TBGLShader3D did not assign correctly, or I am not setting the version correctly in the create shader function in UMyShader class, and I do not know where is the problem with glsl version. Here is the code :

Code: Pascal  [Select][+][-]
  1. constructor TMyShader.Create(ACanvas: TBGLCustomCanvas);
  2. begin
  3.   inherited Create(ACanvas, ReadFileToString('mix.vertex.glsl'), ReadFileToString('mix.fragment.glsl'), '', '440');
  4.   FFadeFactorUniform := UniformSingle['fade_factor'];
  5.   FTexturesUniform[0] := UniformInteger['textures[0]'];
  6. end;
  7.  

I am using windows 10, Lazarus 1.6 and BGRABitmap from Git.

Any help appreciated prior



Here is what I did to solve the problem: As said in https://en.wikipedia.org/wiki/OpenGL_Shading_Language#Versions, setting version should be like #version440, then when I remove word "define" in "TBGLShader3D.Create" constructor, it sets version correctly and runs the program.

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: Fast hardware image blur
« Reply #21 on: January 23, 2017, 06:16:48 pm »
Ok thanks. I've applied the change on Git.
Conscience is the debugger of the mind

Sanem

  • Full Member
  • ***
  • Posts: 173
Re: Fast hardware image blur
« Reply #22 on: January 24, 2017, 07:12:29 am »
You are welcome.

How can I have multiple fragments glsl code files and a vertex glsl code?? for having a blur in vertical and horizontal orientations for example. I know I can use glBindFramebuffer in glsl and they are not yet impelemented in TBGLShader3D class, but do you have any advice or guidance for doing this?? or is it possible to have framBuffers in BGRA soon??

Any help appreciated prior
« Last Edit: January 24, 2017, 07:14:31 am by simin_sh »

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: Fast hardware image blur
« Reply #23 on: January 27, 2017, 01:46:45 pm »
Indeed framebuffers are not implemented yet and that would be the way to go.
Conscience is the debugger of the mind

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Fast hardware image blur
« Reply #24 on: January 27, 2017, 06:14:37 pm »
If you want to use different glsl codes per polygons, you might want to change "program". glUseProgram(n) will do that.

If you want to study such code from nxpascal you are free to https://github.com/Zaflis/nxpascal/blob/master/src/nxGL.pas#L209  It has example of that in walker_shaders demo. Also a demo about framebuffer where it draws a cube in texture that it uses on the cube faces so... it makes the "infinite mirror" effect.

Sanem

  • Full Member
  • ***
  • Posts: 173
Re: Fast hardware image blur
« Reply #25 on: January 28, 2017, 11:24:15 am »
Thank you for your reply User137, I will check it.
« Last Edit: January 28, 2017, 11:44:16 am by simin_sh »

Sanem

  • Full Member
  • ***
  • Posts: 173
Re: Fast hardware image blur
« Reply #26 on: January 28, 2017, 11:43:34 am »
Indeed framebuffers are not implemented yet and that would be the way to go.

Thank you for your replay Circular.
Is it possible for you to give me an estimated time for implementing FrameBuffers??

Regards

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: Fast hardware image blur
« Reply #27 on: February 13, 2017, 05:43:46 pm »
I've been quite busy but I guess now I will have a bit of free time. I am not sure how long it would take, but probably 6 hours would do. Now I just have to find 6 hours in my weekends.
Conscience is the debugger of the mind

Sanem

  • Full Member
  • ***
  • Posts: 173
Re: Fast hardware image blur
« Reply #28 on: February 14, 2017, 07:17:37 am »
I've been quite busy but I guess now I will have a bit of free time. I am not sure how long it would take, but probably 6 hours would do. Now I just have to find 6 hours in my weekends.


Great, thank you so much. So I will waiting.
« Last Edit: February 14, 2017, 07:25:52 am by simin_sh »

Sanem

  • Full Member
  • ***
  • Posts: 173
Re: Fast hardware image blur
« Reply #29 on: March 04, 2017, 09:25:38 am »
Hi Circular
Did you get a chance to look at the FrameBuffer part?
Regards
« Last Edit: March 04, 2017, 03:12:35 pm by simin_sh »

 

TinyPortal © 2005-2018