Issue involves:
python 2.7
pil
pyopengl
pyside


In the midst of developing a small drawing test, I've run into a situation involving line computations.

Currently the drawing test works, but only enables singular point drawing at the cursor position.

[IMG]http://i246.photobucket.com/albums/gg94/Braschko/Forum%20Posts/Screenshot-1.png[/IMG]


I've seen python interpretations of Bresenham's line algorithm, which works as expected.
However, with loop overhead, the calculations become slow... revealing a slowly generating line of sorts.

Threading might be an answer, my understanding is limited though.

The question being, what would be a better method to allow for faster line drawing in this situation?

My thoughts are to reduce the number of glUpdate calls... still testing.


*source available, feel free to use*

To my mind comes at least using numpy for generating the point list. Numpy was missing from your list.

To my mind comes at least using numpy for generating the point list. Numpy was missing from your list.

I will look into that. *thumbs up*


In the mean time, things are being changed to see if I can limit the number of refresh rates to GL.. or at least some sort of frame dropping mechanism.
*will post later*

I've been looking through google and numpy documentation, which has confused memor than anything.

My understanding so far to create the points between two cursor positions is:

import numpy as np

x,y,x2,y2 = 0,0,10,10
xVec = np.arange(x,x2)
yVec = np.arange(y,y2)

points = xVec+yVec

This only work in the respect of both x and y distances being equal..
*scratches head*

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.