Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - naylinntu

#1
Help requests / tgui::CanvasOpenGl3 widget
12 October 2024, 21:42:45
I am using TGUI compiled with GLFW, it works well for common widgets like buttons and message boxes.

How can I render an OpenGL scene on tgui::CanvasOpenGl3 widget?
My code looks like below::

`#include <gl/glew.h>

auto canvas = tgui::CanvasOpenGL3::create({200,200});
canvas->setPosition(300, 200);
gui.add(canvas); canvas->bindFramebuffer();
'

`auto canvas_size_button = tgui::Button::create("Get canvas size");
gui.add(canvas_size_button);
// few other widgets added here

while (!glfwWindowShouldClose(window)){
glUseProgram(shaderProgram);
gui.draw();
glDrawArrays(GL_LINES, 0, 2);
}`


I am using GLEW with this.
but it does not work. It only show other widgets placed into `gui` and they work well.

Appreciate if an example show how to render a simple triangle on Canvas along side with few simple widgets like buttons. or point to the correct way.
Thanks