[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Shaders and Examples not Working



Hi,

I've been doing lots of cool stuff with PyOpenGL, but frankly, with cooler effects comes more complexity, and when things get more complex, PyOpenGL "fixed function" techniques do not seem to be the answer.  A dynamically rendered cubic reflectionmapped object is complicated enough.  So is a dynamically updated framebuffer shadowmapped object.  I just barely got these working, and they aren't simple to implement at all.  Try putting the two together?  How would you add real-time refraction?  Caustics?  Some of these fixed function effects aren't exact either, and some are slow. 

The solution, I've gathered from day 1, is to use shaders, which are programs run on the GPU.  They're faster, simpler to use, more powerful and flexible, and all-around just cool.  That's great and everything, but shaders, simplifying and inherently simple though they are, seem immune to implementation in PyGame, by which I mean, no one seems to know how to do it.  Which brings me to my point, or rather my exception.  There are shader examples on our very own pygame.org.  However, neither of the shader examples work for me, even after I made the obvious modifications. 

The obvious observations were made:
-These apparently worked as recently as OpenGL 2.0, which is recent, but not amazingly so.
-My computer does support shaders, so it's not a hardware issue--It was bought after these tutorials were written, and it was middle-range at that time.  Further, PyGlet shader programs, and commercial programs seem to work just dapper. 
-Aside from these tutorials, no other shader examples in PyGame and PyOpenGL could be had anywhere on the net. 
-PyGlet supports shaders, but PyGame doesn't?  Seems improbable, as shaders are PyOpenGL stuff.  Does PyGlet use the PyOpenGL port of the outdated OpenGL 2.0?  If so, why did the PyOpenGL people depreciate what they call "the future of graphics" in a newer release?  OpenGL 2.1 sure doesn't. 

So, does anyone know how to make a shader program?  They should be really simple judging by the complexity of the broken examples and what I already know on the topic.  Perhaps someone who knows a bit more PyOpenGL and/or is more familiar with Python and/or PyGame than I do could write a new tutorial? 

I'm really hoping to get somewhere with shaders, but the examples on pygame.org don't work.

Please help, thanks,
Ian