Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use of gl_VertexID #2171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manimlib/mobject/types/vectorized_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ def get_shader_data(self) -> Iterable[np.ndarray]:
# Do we want this elsewhere? Say whenever points are refreshed or something?
self.get_joint_angles()
self.data["base_normal"][0::2] = self.data["point"][0]
return [self.data, self.data[-1:]]
return [self.data[self.get_outer_vert_indices()]]


class VGroup(Group, VMobject, Generic[SubVmobjectType]):
Expand Down
2 changes: 1 addition & 1 deletion manimlib/shader_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def __init__(
mobject_uniforms: Optional[UniformDict] = None, # A dictionary mapping names of uniform variables
texture_paths: Optional[dict[str, str]] = None, # A dictionary mapping names to filepaths for textures.
depth_test: bool = False,
render_primitive: int = moderngl.TRIANGLE_STRIP,
render_primitive: int = moderngl.TRIANGLES,
code_replacements: dict[str, str] = dict(),
stroke_behind: bool = False,
):
Expand Down
5 changes: 0 additions & 5 deletions manimlib/shaders/quadratic_bezier/depth/geom.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ layout (triangle_strip, max_vertices = 6) out;

in vec3 verts[3];
in vec3 v_base_point[3];
in int v_vert_index[3];

out float depth;

Expand All @@ -22,10 +21,6 @@ void emit_triangle(vec3 points[3]){


void main(){
// Vector graphic shaders use TRIANGLE_STRIP, but only
// every other one needs to be rendered
if (v_vert_index[0] % 2 != 0) return;

// Curves are marked as ended when the handle after
// the first anchor is set equal to that anchor
if (verts[0] == verts[1]) return;
Expand Down
2 changes: 0 additions & 2 deletions manimlib/shaders/quadratic_bezier/depth/vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ in vec3 base_normal;

out vec3 verts;
out vec3 v_base_point;
out int v_vert_index;

void main(){
verts = point;
v_base_point = base_normal;
v_vert_index = gl_VertexID;
}
5 changes: 0 additions & 5 deletions manimlib/shaders/quadratic_bezier/fill/geom.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ layout (triangle_strip, max_vertices = 6) out;
in vec3 verts[3];
in vec4 v_color[3];
in vec3 v_base_normal[3];
in int v_vert_index[3];

out vec4 color;
out float fill_all;
Expand Down Expand Up @@ -44,10 +43,6 @@ void emit_triangle(vec3 points[3], vec4 v_color[3], vec3 unit_normal){


void main(){
// Vector graphic shaders use TRIANGLE_STRIP, but only
// every other one needs to be rendered
if (v_vert_index[0] % 2 != 0) return;

// Curves are marked as ended when the handle after
// the first anchor is set equal to that anchor
if (verts[0] == verts[1]) return;
Expand Down
2 changes: 0 additions & 2 deletions manimlib/shaders/quadratic_bezier/fill/vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ in vec3 base_normal;
out vec3 verts; // Bezier control point
out vec4 v_color;
out vec3 v_base_normal;
out int v_vert_index;

void main(){
verts = point;
v_color = fill_rgba;
v_base_normal = base_normal;
v_vert_index = gl_VertexID;
}
5 changes: 0 additions & 5 deletions manimlib/shaders/quadratic_bezier/stroke/geom.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ in float v_joint_angle[3];
in float v_stroke_width[3];
in vec4 v_color[3];
in vec3 v_unit_normal[3];
in int v_vert_index[3];

out vec4 color;
out float dist_to_aaw;
Expand Down Expand Up @@ -156,10 +155,6 @@ void emit_point_with_width(


void main() {
// Vector graphic shaders use TRIANGLE_STRIP, but only
// every other one needs to be rendered
if (v_vert_index[0] % 2 != 0) return;

// Curves are marked as ended when the handle after
// the first anchor is set equal to that anchor
if (verts[0] == verts[1]) return;
Expand Down
2 changes: 0 additions & 2 deletions manimlib/shaders/quadratic_bezier/stroke/vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ out vec4 v_color;
out float v_stroke_width;
out float v_joint_angle;
out vec3 v_unit_normal;
out int v_vert_index;

const float STROKE_WIDTH_CONVERSION = 0.01;

Expand All @@ -26,5 +25,4 @@ void main(){
v_stroke_width = STROKE_WIDTH_CONVERSION * stroke_width * mix(frame_scale, 1, is_fixed_in_frame);
v_joint_angle = joint_angle;
v_unit_normal = unit_normal;
v_vert_index = gl_VertexID;
}