Skip to content
This repository has been archived by the owner on Apr 28, 2021. It is now read-only.

Resizing window does not work #95

Open
floriangriese opened this issue May 3, 2016 · 3 comments
Open

Resizing window does not work #95

floriangriese opened this issue May 3, 2016 · 3 comments

Comments

@floriangriese
Copy link

I tried the example on http://www.glvisualize.com/examples/volumes/ and if I resize the window the rendering does not work anymore.
glvisualizeresizewindowbug

@SimonDanisch
Copy link
Member

That's a linux driver bug :( I have a fix for that, which I deactivated because it worked fine for me lately. Maybe try updating the drivers!? I can also put back the (ugly) workaround...

@SimonDanisch
Copy link
Member

Try replacing resize! in:
https://github.com/JuliaGL/GLWindow.jl/blob/v0.1.2/src/types.jl#L63
with :

function Base.resize!(fb::GLFramebuffer, window_size)
    ws = tuple(window_size...)
    if ws!=size(fb) && all(x->x>0, window_size)
        buffersize = tuple(window_size...)
        if OS_NAME == :Linux
            render_framebuffer = glGenFramebuffers()
            glBindFramebuffer(GL_FRAMEBUFFER, render_framebuffer)

            color_buffer    = Texture(RGBA{UFixed8},    buffersize, minfilter=:nearest, x_repeat=:clamp_to_edge)
            objectid_buffer = Texture(Vec{2, GLushort}, buffersize, minfilter=:nearest, x_repeat=:clamp_to_edge)
            depth_buffer    = Texture(Float32, buffersize,
                internalformat = GL_DEPTH_COMPONENT32F,
                format         = GL_DEPTH_COMPONENT,
                minfilter=:nearest, x_repeat=:clamp_to_edge
            )
            attach_framebuffer(color_buffer, GL_COLOR_ATTACHMENT0)
            attach_framebuffer(objectid_buffer, GL_COLOR_ATTACHMENT1)
            attach_framebuffer(depth_buffer, GL_DEPTH_ATTACHMENT)

            p  = postprocess(color_buffer, Signal(window_size))
            fb.id = render_framebuffer
            fb.color = color_buffer
            fb.objectid = objectid_buffer
            fb.depth = depth_buffer
            fb.postprocess = p
            glBindFramebuffer(GL_FRAMEBUFFER, 0)
        else
            resize_nocopy!(fb.color, buffersize)
            resize_nocopy!(fb.objectid, buffersize)
            resize_nocopy!(fb.depth, buffersize)
        end
    end
    nothing
end

@floriangriese
Copy link
Author

thx I will first check the drivers!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants