On Fri, Feb 27, 2009 at 1:12 PM, Florian Bösch <[email protected]> wrote:
> > On Feb 27, 6:38 pm, Tristam MacDonald <[email protected]> wrote: > > The shader class is pulled from my current game project ( > http://darkcoda.googlecode.com). You can find a much newer version in the > > SVN there, which caches attribute locations, among other things - > although > > the source is not as clean. The project also contains a rudimentary > renderer > > built on top of pyglet, but it isn't particularly user friendly at this > > stage. > > The attribute location caching is nice. Though you should get GL_CURRENT_PROGRAM and save it to be able to restore it upon leaving > that context. I don't really see a use-case for that - unless you only have 2 shaders, you will typically not want to rebind the previous shader. I guess this is the difference between a stack-based approach to rendering, and a flat approach. > Maybe you should glValidateProgram after you've linked Most of my shaders won't validate without the texture units being setup - although this may be an oddity of the Mac OpenGL drivers. and you should check that 'GL_ARB_fragment_program' and > 'GL_ARB_vertex_program' are available as extensions before using them That would be a reasonable addition, although I don't support fixed-function at all in my renderer (which is intended to be GL 3.0 compatible). and sometimes you'd like not to attach a fragment or vertex shader > program. Just pass an empty list for that shader. > Sometimes it might be desirable to attach multiple Fragment/ > Vertex programs, which is why you should maybe split the objects up in > classes that can be passed to the program object. Do you mean connecting the same shader to multiple programs? This could be nice in some cases, but I mostly have a 1-to-1 correspondence between pixel and vertex shaders. -- Tristam MacDonald http://swiftcoder.wordpress.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
