I am looking to find the average colour of the viewport as part of a modelling script. I am not familiar with using OpenGL commands in Python but I understand that I should be able to access the frame buffer directly and from this I can then calculate the average colour, this should be a lot quicker than using a render. Is anyone familiar enough with OpenGL in Blender Python to give me a hand?
I don’t really want to bring up an old thread, but this topic is still a problem for me and I wondered if someone could help or at least point me in the direction of something that would? Perhaps I should be learning OpenGL commands but I thought this would be something that might not need too in-depth knowledge to do.
I’d have a play with:
Thanks rarebit, but I was looking to try and access the frame buffer, or some other way that bypasses blender’s rendering in order to improve speed as much as possible
That’s not a proper render, it’s more like what’s in the viewport. Basically it’s the same code as that little camera icon button in any 3D viewport.
I know what you mean though, but you may be at too high a level for that type of access, this is the Python API.
Just looking for something else and came across, bpy.ops.screen.screenshot, i’ve not tried it so I don’t know if it’s what you wanted?
you are talkinga bout the viewport itself here not the render
for the render you could change the world color !
He wanted a non gl rendered viewport, actually direct access to the screen buffer.