Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
d5e87fe4
Commit
d5e87fe4
authored
Oct 14, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graph] fix screenshot fragment shader function
parent
2a31e454
Pipeline
#3278
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
13 deletions
+20
-13
sigmajs-screenshot.js
src/external-deps/sigmajs-screenshot.js
+20
-13
No files found.
src/external-deps/sigmajs-screenshot.js
View file @
d5e87fe4
...
...
@@ -31,8 +31,8 @@ const fragmentShader = `
precision mediump float;
// our 2 canvases
uniform sampler2D u_
canvas1
;
uniform sampler2D u_
canvas2
;
uniform sampler2D u_
nodes
;
uniform sampler2D u_
edges
;
// the texCoords passed in from the vertex shader.
// note: we're only using 1 set of texCoords which means
...
...
@@ -40,15 +40,22 @@ precision mediump float;
varying vec2 v_texCoord;
void main() {
// Look up a pixel from first canvas
vec4 color1 = texture2D(u_canvas1, v_texCoord);
// Look up a pixel from second canvas
vec4 color2 = texture2D(u_canvas2, v_texCoord);
// return the 2 colors multiplied
// TODO Modify this
gl_FragColor = color1 * color2;
// Look up a pixel from nodes canvas
vec4 n_color = texture2D(u_nodes, v_texCoord);
// Look up a pixel from edges canvas
vec4 e_color = texture2D(u_edges, v_texCoord);
// return overlay of n_color on e_color
if(all(equal(n_color.rgb, vec3(1, 1, 1)))) { // n_color is white, use e_color
gl_FragColor = e_color;
} else {
if(all(equal(e_color.rgb, vec3(1, 1, 1)))) { // e_color is white, set transparent
gl_FragColor = vec4(e_color.rgb, 1);
} else {
gl_FragColor = n_color;
}
}
}
`
;
...
...
@@ -125,8 +132,8 @@ export function takeScreenshot(sigma) {
// Set a rectangle the same size as the image.
setRectangle
(
gl
,
0
,
0
,
gl
.
canvas
.
width
,
gl
.
canvas
.
height
);
let
tex1
=
setupTexture
(
gl
,
nodes
,
0
,
program
,
"u_
canvas1
"
);
let
tex2
=
setupTexture
(
gl
,
edges
,
1
,
program
,
"u_
canvas2
"
);
let
tex1
=
setupTexture
(
gl
,
nodes
,
0
,
program
,
"u_
nodes
"
);
let
tex2
=
setupTexture
(
gl
,
edges
,
1
,
program
,
"u_
edges
"
);
// Draw the rectangle.
gl
.
drawArrays
(
gl
.
TRIANGLES
,
0
,
6
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment