sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    View.draw(GL_POINTS, points) - point size?

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 4 Posters 2.5k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thomthomT Offline
      thomthom
      last edited by

      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?

      Thomas Thomassen β€” SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        view.line_width=5
        called just before the draw command...
        ???

        TIG

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          No - no effect. 😞

          And view.draw_points is not the same either. view.draw_points will 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.

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            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=333237

            Can one send commands to the SU OpenGL from Ruby?

            Thomas Thomassen β€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              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)
              end
              
              

              But 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

              Thomas Thomassen β€” SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • Chris FullmerC Offline
                Chris Fullmer
                last edited by

                I've never seen that render them any differen than what is specified in the arguments. It never returned any error?

                Lately you've been tan, suspicious for the winter.
                All my Plugins I've written

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  @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 as view.draw_points without 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...

                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    jessejames
                    last edited by

                    @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?

                    Always sleep with a loaded gun under your pillow!

                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      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.

                      Thomas Thomassen β€” SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post
                      Buy SketchPlus
                      Buy SUbD
                      Buy WrapR
                      Buy eBook
                      Buy Modelur
                      Buy Vertex Tools
                      Buy SketchCuisine
                      Buy FormFonts

                      Advertisement