Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have created several simple games with PyGame, but until now, I have focused on mechanics rather than graphics. The graphics in my games have been extremely rudimentary, consisting of basic shapes on black backgrounds.

I've recently decided to change that and create a 2D graphics engine supporting proper texturing, some animation, and most importantly: lighting. While researching these, especially the last, I've started doubting whether PyGame is the right tool for this. Many tutorials concering implementation of lighting, shadows, et cetera recommend using techniques such as GPU shaders and pixel-level manipulation.

Looking at the documentation of PyGame, I don't see anything that would let me implement such things with any degree of efficiency. I can access bitmaps directly with PixelArray, but doing any significant processing this way seems like it would be a performance nightmare.

How can I get hardware accelerated graphics, vertex and pixel shaders when making a game with PyGame?

share|improve this question
My problem isn't quite what technology to use in my specific case, but rather understanding the capabilities and applications of the technologies I mentioned. I honestly can't tell if that is within the guidelines. –  orost Apr 12 at 22:58
I edited your question to focus on getting hardware/GPU access with PyGame. For your original, more broad questions, you may want to read the help center and look for the list of other sites you can ask those broad discussion-oriented questions on. –  Josh Petrie Apr 12 at 23:06
Thank you, that's better than I could have done. I'm very confused about this topic as a whole, so knowing how to ask a specific question is difficult for me. –  orost Apr 12 at 23:21

1 Answer 1

up vote 4 down vote accepted

PyGame itself, being a wrapper around SDL, is unable to directly use hardware acceleration. You can, however, use PyGame to create an OpenGL context and then render into that via an OpenGL library like pyglet or PyOpenGL, which will let you then also use GLSL vertex and fragment shaders.

This blog post does a good job of explaining the basics of using PyGame in conjunction with each other.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.