Skip to content

Commit

Permalink
Merge branch 'schemes-ssbo'
Browse files Browse the repository at this point in the history
  • Loading branch information
jimy-byerley committed Nov 13, 2024
2 parents d6565d8 + ea2b04f commit 884c160
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion madcad/rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class display:
from .nprint import nprint

# minimum opengl version required by the rendering pipeline
opengl_version = (3,3)
opengl_version = (4,3)
# shared open gl context, None if not yet initialized
global_context = None

Expand Down
4 changes: 2 additions & 2 deletions madcad/scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def render(self, view):
va = self.vas[name]
ctx.enable_only(shader.enable)
ctx.blend_func = shader.blend_func
self.b_spaces.bind_to_uniform_block(0)
self.b_spaces.bind_to_storage_buffer(0)
shader.program['b_spaces'].binding = 0
shader.program['proj'].write(view.uniforms['proj'])
shader.program['highlight'].write( fvec4(fvec3(settings.display['select_color_line']), 0.5) if self.selected else fvec4(0) )
Expand All @@ -371,7 +371,7 @@ def render(self, view):

def identify(self, view):
''' Render all the triangles and lines for identification '''
self.b_spaces.bind_to_uniform_block(0)
self.b_spaces.bind_to_storage_buffer(0)
self.shader_ident['b_spaces'].binding = 0
self.shader_ident['startident'] = view.identstep(self.nidents)
self.shader_ident['proj'].write(view.uniforms['proj'])
Expand Down
12 changes: 6 additions & 6 deletions madcad/shaders/scheme.vert
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#version 330
#version 430

in uint space;
in vec3 v_position;
Expand All @@ -9,9 +9,9 @@ in uint v_ident;
in uint v_flags;

uniform mat4 proj;
uniform b_spaces {
mat4[4096] spaces; // the GPU and CPU allocated buffers can be smaller, but we need to define a max size
} spaces;
buffer b_spaces {
mat4 spaces[]; // the GPU and CPU allocated buffers can be smaller, but we need to define a max size
};
uniform uint startident;

out vec3 normal;
Expand All @@ -29,8 +29,8 @@ void main()
color = v_color;
uint ident = startident + v_ident;
identcolor = vec3(float(ident % uint(256)), float(ident/uint(256)), 0)/255.;
vec4 position = spaces.spaces[space] * vec4(v_position,1);
normal = mat3(spaces.spaces[space]) * v_normal;
vec4 position = spaces[space] * vec4(v_position,1);
normal = mat3(spaces[space]) * v_normal;
sight = sight_direction(position);
gl_Position = proj * position;
gl_Position[2] += v_layer * gl_Position[3];
Expand Down

0 comments on commit 884c160

Please sign in to comment.