openGL rendering

Hi I am trying to do an openGL render through console but I am getting this error!

RuntimeError: Error: Cannot use OpenGL render in background mode <no opengl context>

This is my code:

bpy.context.scene.render.image_settings.file_format = ‘XVID’
bpy.ops.render.opengl(animation=True, write_still=True)

Unfortunately that won’t work. The Context is inherently tied to the state of the UI. When you run in background mode, there is no screen and hence no context.

so there is no workaround to you use the opengl render? without keeping on copy open at all times?

what if I switched the opengl to run on the cpu instead of the GPU?

As far as I know, when Blender is in background mode you won’t be able to do an OpenGL render. I doubt that Blender is setup to jump though the hoops required to render OpenGL results without the screen present.

You probably won’t be able to run a software based OpenGL renderer either. That won’t change the fact that Blender probably does not startup OpenGL at all if it is running headless.

Perhaps there is another work around. What are you trying to do?

I am trying to render multiple .blend file animations through console- and there are alot of them, and I am looking for a faster render alternative to the blender internal render. The animations are quite simple and not complicated - so I don’t need to use a rich render- I just need to spit out the images so they are recognizable.