moderngl / moderngl-window

A cross platform utility library for ModernGL making window creation and resource loading simple
MIT License
244 stars 57 forks source link

copying buffer / trying to render to texture and screen again #29

Closed pavelkrupala closed 5 years ago

pavelkrupala commented 5 years ago

Hello, I'm trying to render to a texture and render to screen again (hopefully just once). However I tried 2 versions and at both I failed: A) RTT, copy to screen B) RTT, render to screen

min code:

self.vao = self.ctx.vertex_array(self.prog2, self.vao_content, self.ibo)
size = (1024, 1024)
self.texture = self.ctx.texture(size, components=3, dtype='f1')
depth_attachment = self.ctx.depth_renderbuffer(size)
self.fbo1 = self.ctx.framebuffer(self.texture, depth_attachment)

#render method A
self.fbo1.use()
self.vao.render()
self.ctx.detect_framebuffer().use()
self.vao.render()
self.ctx.finish()

#render method B
self.fbo1.use()
self.vao.render()
#self.ctx.detect_framebuffer().use()
self.ctx.copy_framebuffer(self.ctx.screen, self.fbo1)
self.ctx.finish()

Is there something obvious I do miss?

einarf commented 5 years ago

This issue probably belongs to the moderngl project : https://github.com/moderngl/moderngl

I suggest reporting the issue there.

pavelkrupala commented 5 years ago

yup, sorry about that