Re: Drawing an Image

2020-03-06 Thread Jonathon Parker
Thanks for the posts. I am stubborn and went with option 3. The code below does what I want, and I can leverage cv2 to do it: import pyglet import ctypes import itertools import numpy as np import cv2 image = np.zeros((50, 50, 3), np.uint8) pt1 = (1, 1) pt2 = (48, 24) pt3 = (1, 48)

Re: Drawing an Image

2020-03-04 Thread Charles M
A sprite by definition is basically a wrapper around a texture and it's 4 vertices. If you want a Sprite class around OpenGL primitives like triangles, polygons, there is nothing out of the box that you can use other than what Benjamin showed you. Your options are: 1) Create the shapes you

Re: Drawing an Image

2020-03-04 Thread Jonathon Parker
Benjamin, The math for rotation was the thing I was most trying to avoid. If I have a complex shape, I would need to know the center, rotate every point, and fill the colored portions in. That sounds hard. I want to use Sprites as the visual component of a simulation. The behaviors of

Re: Drawing an Image

2020-03-04 Thread Benjamin Moran
Hi Jonathon, Rather than trying to turn GL primitives in to an image to use with a Sprite, you could also make a Sprite-like class for the various shapes. This can get tricky if you want to rotate them, as you'll have to add your own math to do that work, but as an example I'll post a simple