Menu

FBORenderer

Help
Daniel
2018-10-17
2018-10-20
  • Daniel

    Daniel - 2018-10-17

    Hi!
    I'm trying to make the FBOrenderer only save a texture of the scene while a clipplane is enabled, and as soon as it's done, disable the clipplane and render the scene normally.

    This is what I have in the sceneViewers beforeRender:

    fboR.Active:=true;
    
      GL.Enable(GL_CLIP_PLANE0);
      SetPlane(clipPlane, PlaneMake(AffineVectorMake(myClip.AbsolutePosition),
      VectorNegate(AffineVectorMake(myClip.AbsoluteDirection))));
      GL.ClipPlane(GL_CLIP_PLANE0, @clipPlane);
    
      GLScene1.Objects.DoRender(rci,true,true);
    
      fboR.Active:=false;
    
      GL.Disable(GL_CLIP_PLANE0);
    

    The texture in the materiallibrary becomes weird...
    If I don't disable the clipplane, then the texture is ok.

    Any idea how I can save only the clipped scene to a texture?

    Cheers

     
  • Jerome.D (BeanzMaster)

    Hi Daniel, can you make a simple test case ?

    Have you try with the FBO's onBefore/OnAfter event ? Take a look in examples/effects/shadowfbo demo

    Cheers

     
  • Daniel

    Daniel - 2018-10-18

    Hi Jerome!

    Thanks, I will give it a try!

    Any chance to get this demo updated and converted to Lazarus?
    https://sourceforge.net/p/glscene/code/HEAD/tree/branches/Examples/Shaders/GLSL/GLSL_Water/
    I cannot manage to get it to compile in Lazarus.

    It seems to have all the stuff I'm after, reflective water.

    Cheers!

     
  • Jerome.D (BeanzMaster)

    Hi, this demo need some work in code tor be compatible with Lazarus. The best way is to make a child of TGLSLCustomShader like the simple water shader i've done.
    You need translate all opengl Command ike glCommandNameb become *GL.CommandName*
    After accessing matrix not working like in the original delphi code

    Have you try Ocean demo in samples/shader/glsl/ocean ?

     
  • Daniel

    Daniel - 2018-10-19

    Thanks Jerome!
    I will try som more to convert it.

    Yes, I have used that demo and it helped me with other parts.
    In this case I'm interested in reflection on objects on a surface, and using a clipplane to only reflect parts above the surface.
    I'm trying to use the FBORenderer for the sampler2D in the shader.
    But I cannot make it create the texture while the clipplane is enabled, and then disable the clipplane again.

    I will upload a test case when I have one.
    Currently I have a hard time making the FBORenderer work at all...

    Cheers!

     
  • Daniel

    Daniel - 2018-10-20

    A few lines who generate errors:
    gl.LoadMatrixf(@FScene.CurrentBuffer.ModelMatrix); // incompatible types, Matrix4f expected single
    FScene.CurrentBuffer.PopModelViewMatrix; // no identified member
    gl.LoadMatrixf(FScene.CurrentBuffer.ModelMatrix); // incompatible types, Matrix4f expected single

    Any idea what's wrong here?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.