C++ OpenGL - Overlay example -
i've opengl application (maze style) need work on possible. problem @ moment following:
- i've 3 subwindows on main window , working fine. aparently should using 1 subwindow , left side subwindows (smaller ones) should displayed overlay. actual app has following window display:
and go this:
i've searched internet , far i've found nothing subject. there anywhere can read on how solve this?
thank much.
you render overlays texture, , render wherever want on screen. gl*framebuffer functions. might this:
// create texture render glgentextures(1, &overlay_tex); glbindtexture(gl_texture_2d, overlay_tex); gltexparameteri(gl_texture_2d, gl_texture_wrap_s, gl_repeat); gltexparameteri(gl_texture_2d, gl_texture_wrap_t, gl_repeat); gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_nearest); gltexparameteri(gl_texture_2d, gl_texture_mag_filter, gl_nearest); // null means reserve texture memory glteximage2d(gl_texture_2d, 0, gl_rgba8, width, height, 0, gl_bgra, gl_unsigned_byte, null); glgenframebuffers(1, &fb); glbindframebuffer(gl_framebuffer, fb); // attach texture framebuffer glframebuffertexture2d(gl_framebuffer, gl_color_attachment0, gl_texture_2d, overlay_tex, 0); glgenrenderbuffers(1, &depth_rb); glbindrenderbuffer(gl_renderbuffer, depth_rb); glrenderbufferstorage(gl_renderbuffer, gl_depth_component24, width, height); glframebufferrenderbuffer(gl_framebuffer, gl_depth_attachment, gl_renderbuffer, depth_rb); glbindframebuffer(gl_framebuffer, fb); // render overlay here glbindframebuffer(gl_framebuffer, 0); // render backbuffer again
Comments
Post a Comment