sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    GL_TRIANGLES and COLOR

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 2 Posters 391 Views 2 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.
    • P Offline
      PascalHenry
      last edited by

      Hi all,
      I've tried to draw triangles with a given color. But my triangles stay black !!
      I use the method draw from class View with GL_TRIANGLES parameter. This draw method is called
      in draw(view) method from Tool class. Color is set with the function drawing_color
      See code as example below

      %(#0000BF)[def draw(view)
      color1=Sketchup::Color.new(150,100, 0)
      pt=Array.new
      pt[0]=Geom::Point3d.new(0,0,0)
      pt[1]=Geom::Point3d.new(0,10,0)
      pt[2]=Geom::Point3d.new(10,0,10)
      view.drawing_color=color1
      view.draw(GL_TRIANGLES,pt)
      end
      ]

      Is it possible to colorize my triangle with a chosen color?

      Thanks

      1 Reply Last reply Reply Quote 0
      • fredo6F Offline
        fredo6
        last edited by

        Don't worry.
        This looks like a bug (or a feature?) of the API in SU6 and SU7. I never found any workaround.
        Why do you think the divider in Stretch happens to be black!?

        However, in 2D mode (view.draw2d), you can control the color.

        Fredo

        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