opengl render with python gives different result to opengl render with button in UI

Hey everyone!

I’ve got a problem with a python script thats creating a screenshot using the opengl renderer in Cycles. Here you can see the python command:


If I’m using this I’ve got this result:

The blue color is my viewport color … what means that blender is using the Solid Mode when it runs the command even If I’m in Material Viewport Mode.

But if I’m using the OpenGL Render Button in the 3D Viewport I’ve got this result:

The red color is my material.Thats the result I’m looking for.

I’m trying to get the same result with the python command but I don’t get it. Can anybody help me?

Thanks a lot!

Best regards!