Skip to content

Add OpenGL example #20

@gcardozo123

Description

@gcardozo123

Hi,
first, thanks for mantaining Python bindings for ImGui!
I noticed this line on bimpy readme file:
bimpy already has all necessary functionality for window/OpenGL context creation and hides those details from the user.

But I can't find examples anywhere. It would be awesome to have a simple "OpenGL Bimpy hello world", maybe just a triangle that you can switch its color with a color picker.

I'm already trying to implement this, but my triangles are not being rendered. I suppose I should just put the rendering code inside bimpy context loop like this:

        while not ctx.should_close():

            ctx.new_frame()

            glClearColor(0.0, 0.0, 0.0, 1.0)
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
            glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, None)

            ctx.render()

I got no errors, just an empty window, although changing the color in glClearColor properly changes the window background color.

Any pointers are welcome.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions