Page MenuHome

Knife tool draws huge vertices (it draws verts with glPointSize is not initialized)
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Linux-5.8.16-2-MANJARO-x86_64-with-arch-Manjaro-Linux 64 Bits
Graphics card: GeForce GTX 1660 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.100

Blender Version
Broken: version: 2.91.0 Beta, branch: master, commit date: 2020-10-26 17:29, hash: rBedf4378c442a
Worked: 2.90

Short description of error
When I draw something with bgl and use:

bgl.glPointSize(41) #to default 1

The build-in knife tool UI is affected (knife draws huge vertices):

Exact steps for others to reproduce the error
Run script from attached blend file
Then run knife tool - it vertices higlight will be huge

import bpy
import gpu
import bgl
from gpu_extras.batch import batch_for_shader

coords = [(1, 1, 1), (-2, 0, 0), (-2, -1, 3), (0, 1, 1)]
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos": coords})


def draw():
    shader.bind()
    shader.uniform_float("color", (1, 1, 0, 1))
    batch.draw(shader)
    bgl.glPointSize(41) #default 1 


bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')

Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Oct 28 2020, 9:47 AM
Philipp Oeser (lichtwerk) changed the subtype of this task from "Report" to "Bug".

@Germano Cavalcante (mano-wii): assume D8728: Knife: Use specialized shader for drawing points would resolve this, too, so do you have plans to finish that up?

It would solve, but the problem is more internal.
The knife tool shows only a side effect of the real problem.

The real problem is known and should be resolved before the final release.

Jacques Lucke (JacquesLucke) triaged this task as High priority.Nov 5 2020, 3:48 PM

I'll set the priority to high, because you said this should be solved before the release.

@Germano Cavalcante (mano-wii) but what is the "real problem"? And who is planning to tackle it? (assigning it to you, assuming it is in your agenda).

That said I would hardly consider this a bug, specially not a high priority one. The script should change the point size back to the default after using it. @Clément Foucault (fclem) thoughts?

The probem is if I reset point size to 1, then knife tool vert size will be to small (should be around 3-5 px by default?) It like the knife tool does not initialize point size correctly for itself.