seanmet
Topic Author
Posts: 4
Joined: 19 Jun 2024, 10:01

Drop shadow effect when rendering to SDL with OpenGL

30 Jul 2024, 15:34

Hello,
I'm running into an issue with the drop shadow effect (this is what ive noticed, there might be other effects or other features) when i render my application to SDL.
 <TextBlock Text="{Binding Path=Value, RelativeSource={RelativeSource AncestorType={x:Type Slider}}}"
                Foreground="White" FontSize="33.74" FontWeight="Bold" FontFamily="../../microscope_adjustment_screen/assets/#Mont-Regular"
                VerticalAlignment="Center" HorizontalAlignment="Left" Margin="-60,0,0,0">
                	<TextBlock.Effect>
                       		<DropShadowEffect Color="#48348F" BlurRadius="4" ShadowDepth="0"/>
                        </TextBlock.Effect>
</TextBlock>
This line of code works fine when I use the launcher, but for some reason when i render myself to SDL window, i get a black screen.
Noesis error handler wont raise any errors, thats why i suspect something else, and i couldnt find an answer in the "IntegrationGLUT" guide.

I registered all components with "RegisterAppComponents", could you think of a reason for this to happen?
Thanks in advance :)
 
User avatar
jsantos
Site Admin
Posts: 4042
Joined: 20 Jan 2012, 17:18
Contact:

Re: Drop shadow effect when rendering to SDL with OpenGL

30 Jul 2024, 15:38

Could you use RenderDoc to compare your integration vs our implementation? That should give you all the details.

This is probably happening because your are not injecting the offscreen phase at the right time.
 
seanmet
Topic Author
Posts: 4
Joined: 19 Jun 2024, 10:01

Re: Drop shadow effect when rendering to SDL with OpenGL

31 Jul 2024, 10:33

Doesn't look like the problem is with injecting the offscreen render.
This is the flow of the code:
   void cNoesisScreenManager::renderActiveScreenToFbo(GLuint fbo) {
        glBindFramebuffer(GL_FRAMEBUFFER, fbo); // Bind the framebuffer
        glViewport(0, 0, width, height); // Set the viewport to the FBO dimensions
        glClear(GL_COLOR_BUFFER_BIT); // Clear the FBO

        const auto active_view = getCurrentScreen()->screen_view;
        auto *renderer = active_view->GetRenderer(); // Get the renderer
        renderer->UpdateRenderTree(); // Applies last changes happened in view
        renderer->RenderOffscreen(); // Generates offscreen textures
        renderer->Render(); // Render UI in the active render target and viewport dimensions
        glBindFramebuffer(GL_FRAMEBUFFER, 0); // Unbind the framebuffer
    }
Also, to make sure, i tried adding "glFinish();" right after the Render line to make sure everything finishes rendering, but still i got a black screen..
Do you have any other suggestions?
Thanks :)
 
User avatar
jsantos
Site Admin
Posts: 4042
Joined: 20 Jan 2012, 17:18
Contact:

Re: Drop shadow effect when rendering to SDL with OpenGL

31 Jul 2024, 15:34

As suggested before, have you tried analyzing the differences with RenderDoc to understand what's going on?
 
User avatar
jsantos
Site Admin
Posts: 4042
Joined: 20 Jan 2012, 17:18
Contact:

Re: Drop shadow effect when rendering to SDL with OpenGL

31 Jul 2024, 18:45

After reviewing your code, it seems that the offscreen phase is not being rendered correctly. You need to call RenderOffscreen() before binding the main framebuffer. Additionally, when binding the main buffer, you're only clearing the color bits. Make sure to clear the stencil buffer as well.

These details are thoroughly explained in the Rendering Tutorial that was mentioned earlier.

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest