Geometry shader support?

77 views
Skip to first unread message

Gábor Fekete

unread,
Sep 29, 2016, 6:41:00 PM9/29/16
to pyglet-users
I'm working on a little project as hobby. It uses pyglet mostly and I want to render procedural planets and stuff with it.
My main problem is that pyglet does not support geometry shaders.

Why is that? Is there any way that it will be supported in the near future?
I really need this feature and I don't want to move to another language.

If there is nobody on this feature, may I try to get to it?

Thanks!

Benjamin Moran

unread,
Sep 30, 2016, 8:56:49 AM9/30/16
to pyglet-users
Hi Gábor,

Currently, pyglet has no built-in shader classes. This is something I would also like to see included in the future. I did start working on an implementation myself (just frag/vertex shaders for a start), but Gabe Dube released a very nice shader library for pyglet here: https://github.com/gabdube/pyshaders
and also a nice gl buffers library here: https://github.com/gabdube/pyglbuffers
As you can see though, there is no geometry shader support yet in his libraries, although it is on the TODO list.

There are a few reasons why nobody got around to this yet. Pyglet recently went through an upgrade to a dual Python2/3 compatible codebase. Because of that, most of the commits happening in the last months/years have been bugfixes and only minor feature additions.

The other reason, and perhaps the main one, is that pyglet's internal graphics module is mainly written around "classic" OpenGL. It's a really awesome module, but won't work if you request a newer OpenGL context.

I think we're already reaching the point where it makes sense to update the graphics module to at least OpenGL 3.x profile, including some simple vertex/fragment shaders that mimic the current needs of the built-in sprite and text modules, so that it can remain easy to use for novice users.

Gábor Fekete

unread,
Sep 30, 2016, 9:40:27 AM9/30/16
to pyglet...@googlegroups.com
Then I guess I have to go and convince Gabe Dube for the extension.

Thanks for the info!

--
You received this message because you are subscribed to a topic in the Google Groups "pyglet-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyglet-users/qKam91KNBnE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyglet-users+unsubscribe@googlegroups.com.
To post to this group, send email to pyglet...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Adam Bark

unread,
Sep 30, 2016, 9:44:31 AM9/30/16
to pyglet...@googlegroups.com
Have you tried pyopengl for your rendering?
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Gábor Fekete

unread,
Oct 3, 2016, 4:14:02 AM10/3/16
to pyglet...@googlegroups.com
Do I just import pyopengl and call gl* functions and it will be the same? I couldn't find the usage of pyglet and pyopengl together.

--

Gábor Fekete

unread,
Oct 4, 2016, 9:29:48 AM10/4/16
to pyglet...@googlegroups.com
It seems I got it working using pyopengl shaders. A simple passthrough shader program with vertex,geometry and fragment shaders does work. Now I only have to switch rendering from immediate mode to modern buffers.
Thank you Adam Bark!

Benjamin Moran

unread,
Oct 4, 2016, 9:36:33 AM10/4/16
to pyglet-users
By the way, if you are using a modern OpenGL context (3.2+) you may have to override the default pyglet window's "on_resize" method. This is becuase it contains some legacy OpenGL code to reset the view when you resize the window. Since you're using shaders this will be unnecessary, so you can just bypass it with:

@window.event
def on_resize(w, h):
return pyglet.event.EVENT_HANDLED

Of course, replace the @window.event with whatever your window instance is named, or just make this method in your class if you're subclassing pyglet.window.Window. You may also want to put some code in here for updating your shader uniforms and such with the w & h values, if needed.

-Ben




On Tuesday, October 4, 2016 at 10:29:48 PM UTC+9, Gábor Fekete wrote:
It seems I got it working using pyopengl shaders. A simple passthrough shader program with vertex,geometry and fragment shaders does work. Now I only have to switch rendering from immediate mode to modern buffers.
Thank you Adam Bark!
2016-10-03 10:13 GMT+02:00 Gábor Fekete <gabor.bal...@gmail.com>:
Do I just import pyopengl and call gl* functions and it will be the same? I couldn't find the usage of pyglet and pyopengl together.
2016-09-30 15:44 GMT+02:00 Adam Bark <adam....@gmail.com>:
Have you tried pyopengl for your rendering?

On 29 September 2016 23:41:00 BST, "Gábor Fekete" <gabor.bal...@gmail.com> wrote:
I'm working on a little project as hobby. It uses pyglet mostly and I want to render procedural planets and stuff with it.
My main problem is that pyglet does not support geometry shaders.

Why is that? Is there any way that it will be supported in the near future?
I really need this feature and I don't want to move to another language.

If there is nobody on this feature, may I try to get to it?

Thanks!


--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

--
You received this message because you are subscribed to a topic in the Google Groups "pyglet-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyglet-users/qKam91KNBnE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyglet-users...@googlegroups.com.

Gábor Fekete

unread,
Oct 6, 2016, 5:52:01 AM10/6/16
to pyglet...@googlegroups.com
Yeah, thanks, I already had to override that method for resizing the viewport.

To unsubscribe from this group and all its topics, send an email to pyglet-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages