Tristam, Serdar,
Thanks, I forgot about the Mac OpenGL situation. Modernizing the batch
class really is starting to look like a necessity.
There are other bits that need modernizing as well, such as some of the
Window class methods. Window.on_resize, for example, uses classic
glMatrixMode calls. Currently this needs to be over-ridden when using a
higher version context. At the least:
@window.event
def on_resize(w, h):
return pyglet.event.EVENT_HANDLED
This is not ideal for users, so It would make sense for the Window class to
have something like a "self._is_core_profile = True" flag. To go along with
that, a very basic pass-through vertex/fragment shader pair for 2D
projection (to mimic the current default window projection). The methods
could be different depending on the context the Window is created with.
Maybe supplying a custom shader would automatically override the default
Window methods?
A seems like a good plan of attack would be:
1. Get a shader class finished that can compile/link shaders, and expose
their attributes/uniforms.
2. Update the Window class with basic 2D shader and methods.
3. Update the Batch class.
I'm realizing this is a lot of work.I would just handle these things
manually in my own application, but pyglet really does need to be updated
at some point.
On Saturday, February 20, 2016 at 12:06:05 AM UTC+9, swiftcoder wrote:
>
> It's worth documenting, it I wouldn't intentionally limit the version.
> Upgrading batch to work with modern OpenGL is a reasonable priority - on
> Mac today your choice is OpenGL 2.0 or 4.2 (there is no way to allocate a
> context between those two versions), so batch is basically useless.
> On Fri, Feb 19, 2016 at 2:53 AM, Benjamin Moran <[email protected]
> <javascript:>> wrote:
>
>>
>> As some of you probably already know, it's not possible to use the
>> built-in pyglet.graphics.Batch() and vertex_lists with an OpenGL context
>> that is later than 3.0.
>> (Due to deprecated OpenGL functions that are used by those classes, such
>> as "glPushClientAttrib").
>>
>> My question is whether or not it makes sense to limit shader support to
>> GLSL 1.30 (OpenGL 3.0 GLSL), in order to allow Batch usage? GLSL 130
>> shaders and Batch drawing does work together, but I've never mixed it this
>> way before.
>>
>> Idealy the Batch class could be modernized to take advantage of OpenGL
>> 3.2+ when such a context is available, but that's a bit beyond my current
>> understanding.
>>
>> Any feedback welcome!
>> -Ben
>>
>>
>>
>> On Tuesday, February 16, 2016 at 9:53:46 AM UTC+9, Benjamin Moran wrote:
>>>
>>> Hi guys,
>>>
>>> How would everyone feel about adding a simple shader Class to the
>>> graphics module? There have been a few go-to examples out there, such as
>>> Tristan McDonald's popular one here:
>>> https://swiftcoder.wordpress.com/2008/12/19/simple-glsl-wrapper-for-pyglet/
>>> And Leonhard Vogt's framebuffer code that includes shaders here:
>>>
>>> https://leovt.wordpress.com/2015/10/04/render-to-texture-with-python-3-and-pyglet/
>>> https://github.com/leovt/leovt/blob/master/framebuffer.py
>>>
>>> The reason I would like to see it included is because of the ctypes
>>> magic being a bit of a blocker for new users. A simple class could handle
>>> this for the users, and allow them to easily try more modern contexts with
>>> pyglet.
>>>
>>> If I wrote this code, would it be accepted? I'm thinking a simple class,
>>> plus basic example code. (Speaking of which, many of those examples need to
>>> be updated!)
>>>
>>> -Ben
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "pyglet-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/pyglet-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.