Issues with bgl.Buffer() VAO,VBO and python wrapper #65208
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#65208
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Windows-10-10.0.17763 64 Bits
Graphics card: GeForce GT 740M/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 419.35
Blender Version
Broken: version: 2.80 (sub 72), branch: blender2.7, commit date: 2019-05-26 22:34, hash:
blender/blender@d525c76003
Worked: (optional)
Short description of error
Issue in https://devtalk.blender.org/t/bgl-simple-triangle-what-am-i-doing-wrong/6811
Exact steps for others to reproduce the error
I've contacted Clément Foucault about the issue. After his help, it appears that either the Buffer() is acting strange, or the VAO assignment is messed up.
he said : "I think the memory used by the BGL.Buffer gets released and reused by another thing before the draw callback.There is somethign strange with BGL.Buffer
or the VAO managment"
I went in and moved all my OpenGL code to the
draw()
function. This made it work as expected, but this means that on every draw call, OpenGL creates a VAO,VBO,Shaders and a program. Which I think won't be the best solution.In the end Clément Foucault assumed that it's an issue with the python API or the python wrapper.
Added subscriber: @okuma_10
Added subscribers: @fclem, @JacquesLucke
Added subscriber: @ideasman42
Added subscriber: @mano-wii
The problem with the code is that it disregards the fact that Blender works with more than one OpenGL context.
There is the OpenGL context offscreen and a context for each window.
The callback added to
draw_handler_add
runs in the offscreen context, but the rest of the code runs in the context of the window.VBOs, Programs, Textures are shared between different contexts. But the VAO does not.
So a solution would be to create the VAO inside the callback with a lazy initialization.
Ah! I see...this explains why if I add all my code to the draw() function I see everything as it should be.Because the draw() function is what is getting the view3D OpenGL window context.
The problem is that I have no idea how to implement your suggested solution.
As I said ....when I added everything to the draw() function, every time the view was updated a VAO,VBO,Shaders and a Program was created. It was VAO id:2000+ in no time.
Maybe a solution is to have an option for the Buffer() ,that tells it which OpenGL context it should use.
Changed status from 'Open' to: 'Archived'
Since it is not a bug (but a known limitation). Better close and continue on Devtalk .