View.draw(GL_POINTS, points) - point size?
-
On my home computer (nVidia Geforce 8800 GT) when I use this:
view.draw(GL_POINTS, points)
I end up with points of about 5px size.On my work computer (ATI Radeon HD 4870 X2) and my co-workers computer (Quadro 3700FX) they are 1px - barely visible. How on earth does one control the size of the point?
-
view.line_width=5
called just before the draw command...
??? -
No - no effect.

And
view.draw_pointsis not the same either.view.draw_pointswill draw the points even if they are blocked by other geometry.view.draw(GL_POINTS, points)will ensure that point behind other geometry is not drawn - which is what I need. -
I wonder if something indirectly sets the point size...
http://newsgroups.derkeiler.com/Archive/Comp/comp.graphics.api.opengl/2008-09/msg00136.html
http://processing.org/discourse/yabb2/YaBB.pl?board=OpenGL;action=display;num=1217367002
http://www.gamedev.net/community/forums/topic.asp?topic_id=333237Can one send commands to the SU OpenGL from Ruby?
-
I found a hacky workaround:
def draw_points(points, color, view) return if points.is_a?(Array) && points.empty? #view.line_width = 5 # Does not appear to work view.drawing_color = color #view.draw(GL_POINTS, points) # How does one set point size? # http://newsgroups.derkeiler.com/Archive/Comp/comp.graphics.api.opengl/2008-09/msg00136.html # http://processing.org/discourse/yabb2/YaBB.pl?board=OpenGL;action=display;num=1217367002 # http://www.gamedev.net/community/forums/topic.asp?topic_id=333237 points = [points] if points.is_a?(Geom;;Point3d) points = [points] if points.is_a?(Array) && points.length == 3 && points.all?{ |i| i.is_a?(Numeric) } half_size = 2 view.line_width = half_size * 2 hack_points = [] points.each { |p| # This hack doesn't work because of another bug that makes the polygons render black. #size = view.pixels_to_model(5, p) #hack_points << p.offset(view.camera.xaxis + view.camera.yaxis.reverse, size) #hack_points << p.offset(view.camera.yaxis.reverse + view.camera.xaxis.reverse, size) #hack_points << p.offset(view.camera.xaxis.reverse + view.camera.yaxis, size) #hack_points << p.offset(view.camera.yaxis + view.camera.xaxis, size) # But this might be better in any case as it only computes two points. offset_length = view.pixels_to_model(half_size, p) hack_points << p.offset(view.camera.xaxis.reverse, offset_length) hack_points << p.offset(view.camera.xaxis, offset_length) } #view.draw(GL_QUADS, hack_points) view.draw(GL_LINES, hack_points) endBut I would still like to know why my home computer renders the points with a size, and all the work computers render them as just a pixel point. grumble
-
I've never seen that render them any differen than what is specified in the arguments. It never returned any error?
-
@chris fullmer said:
I've never seen that render them any differen than what is specified in the arguments. It never returned any error?
It's odd - I used
view.draw(GL_POINTS, points)in a futile desperate attempt to see what happened. I expected it would work asview.draw_pointswithout the ability to specify type and size. But for some reason on my home computer it rendered as ca 5px circles...
So I thought it was a fixed shape+size - until I came into work and tested it - just for the sake of it. Then I only got single pixels.
So now I convert the points into line segments and draw them. Not sure how that impacts performance - but at the moment it's the only thing I can work out how to control.When I get home I'll disable all other plugins and see if there's something there...
-
@thomthom said:
How on earth does one control the size of the point?
in OpenGL it's as simple as
glPointSize(5.0)but of course that may not help in the Ruby API world?
-
I don't know if/how one would issue that in SU Ruby :/.
What is more: I closed SU and renamed my plugins folder - testing only my own script. The points where drawn as pixels as I saw at the office. When I restored the plugin folder I still saw the points drawn as single pixels!
So there must have been some odd glitch. I did have that SU session open for a few days where I just put my computer in sleep mode. Maybe some other plugins changed the point size - when I ran it. Or some external glitch.... Really don't understand how it occurred. But I do want the effect of that glitch.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement