I encountered an unexpected problem with my plugin in the new version of SketchUp 2024.
What I do: I create buttons in the workspace, on them I need to draw some icons. I do this using my own workarounds and drawing icons with pixels. This method worked in all versions of SketchUp until 2024.
The rendering method that always worked before:
def print_pic(pic,lt_x,lt_y, view)
if pic!=nil
pic.each do |color|
view = Sketchup.active_model.active_view if view==nil
if (color!=nil)&&(view!=nil)
rgbcolor = Sketchup::Color.new(color[:color].red, color[:color].green, color[:color].blue, color[:color].alpha)
rgbcolor.alpha = 155
view.drawing_color = rgbcolor
pts = []
to_z = color[:x].length-1
x_arr = color[:x]
y_arr = color[:y]
for i in 0..(to_z)
x = x_arr[i]+lt_x
y = y_arr[i]+lt_y
pts << (Geom::Point3d.new(x,y,0))
end
view.draw2d GL_POINTS, pts if pts.length>1
end
end
end
end
An example of a picture that is fed into this method:
pic = [{:color=>Sketchup::Color.new(255,20,20),:x=>[24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25],:y=>[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42]},{:color=>Sketchup::Color.new(140,20,20,140),:x=>[24,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26],:y=>[43,43,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42]}]
Result in SketchUp 2024:
Result in SketchUp of any other version:
The problem is in the line: view.draw2d GL_POINTS, pts
Namely, in the GL_POINTS constant, it draws in model space, and not in monitor screen space. The rest of the constants (GL_QUADS, GL_LINE_STRIP, GL_TRIANGLES …) seem to work fine.



