fix: GL_POINT_SPRITE was not enabled for NoProfile#3236
fix: GL_POINT_SPRITE was not enabled for NoProfile#3236j9ac9k merged 2 commits intopyqtgraph:masterfrom
Conversation
|
In addition to fixing the bug, I also took the opportunity to move the computation of A script to demonstrate the improvement. On my laptop, import importlib
import numpy as np
import pyqtgraph as pg
import pyqtgraph.opengl as gl
from pyqtgraph.Qt import QtCore, QtGui
from pyqtgraph.examples.utils import FrameCounter
pngfile = importlib.resources.files("pyqtgraph.icons.peegee") / "peegee_512px@2x.png"
qimg = QtGui.QImage.fromData(pngfile.read_bytes()).mirrored(True, True)
qimg.convertTo(QtGui.QImage.Format.Format_RGBA8888)
data = pg.functions.ndarray_from_qimage(qimg).astype(np.float32) / 255
colors = data.reshape((-1, 4))
pg.mkQApp()
win = gl.GLViewWidget()
win.show()
win.setCameraPosition(distance=2, elevation=30)
rows, cols = data.shape[:2]
pos3 = np.zeros((rows,cols,3))
pos3[...,:2] = np.mgrid[:rows, :cols].transpose(1,2,0) / rows
pos3 = pos3.reshape(-1, 3)
item = gl.GLScatterPlotItem(pos=pos3, color=colors, size=0.001, pxMode=False, glOptions='translucent')
win.addItem(item)
def update():
win.orbit(-1, 0)
framecnt.update()
timer = QtCore.QTimer()
timer.timeout.connect(update)
timer.start(0)
framecnt = FrameCounter()
framecnt.sigFpsUpdate.connect(lambda fps: win.setWindowTitle(f'{fps:.1f} fps'))
pg.exec() |
7c2dc12 to
eff64f9
Compare
|
I had identical speedups on macOS (using M2 Max chip). Nice work! |
|
If you look closely, the left and right dots are smaller than the one in the center, even though they are all at the same depth. An alternative implementation would be to have dots at the same depth to have the same size. This is a simpler calculation and doesn't require the camera position and view transform to be sent to the shader. |


The previous implementation had notably neglected to enable GL_POINT_SPRITE for OpenGL <= 2.1.
If it had previously worked, it would probably be due to the permissiveness of the various OpenGL implementations.
Remarks: