Python Opengl Render doesn't show texture when I click opengl render button in the GUI of the 3D view, the rendered image contains texture. However, when I use python script to render the same thing, I only get solid image without texture.

bpy.ops.render.opengl()


How can I make it so that script rendering also render with texture?

Thanks in advance!
If you can render from the GUI button I assume that you have the method to display/shade objects in the 3D view set to Texture. 

With that out of the way the only thing that you need to do is to set both the write_still and view_context to True like this: 

bpy.ops.render.opengl(animation=False, write_still=True, view_context=True)

If you only set one of them to True you get the solid display