Draw circles without using a geometry shader, layer offset broken

This commit is contained in:
2025-11-20 21:29:21 +00:00
parent 5c5d9ef0e3
commit 4e7bd4831d
7 changed files with 55 additions and 24 deletions
+1
View File
@@ -3,6 +3,7 @@ layout (location = 0) in vec4 pos;
layout (location = 1) in vec4 col;
layout (location = 2) in vec3 boxXboxYwidth;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
layout (location = 0) uniform int layoff;
out vec4 vCol;
out vec3 vPos;
out vec3 vparams;
+1
View File
@@ -1,6 +1,7 @@
#version 450 core
layout (location = 0) in vec4 pos;
layout (location = 1) in vec4 col;
layout (location = 0) uniform int layoff;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out vec4 vCol;
out vec3 vPos;
+28 -10
View File
@@ -1,15 +1,33 @@
#version 450 core
layout (location = 0) in vec4 pos;
layout (location = 1) in vec4 col;
struct PosCol { vec4 posx; vec4 colx; };
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out vec4 vCol;
//const int ks[6] = //
// {0,1,2 // 2--3
// ,2,1,3 // | |
// }; // 0--1
// //
layout (std430, binding = 13) readonly buffer Data { PosCol data[]; };
layout (location = 0) uniform int n;
out vec4 gColC; // center color
out vec4 gColE; // edge color
out vec2 gBoundingBox;
out vec3 gPos;
const int ks[6] = //
{1,0,2 // 2--3
,2,0,3 // | |
}; // 1--0
//
const vec2 bs[4] =
{ vec2( 1, 1)
, vec2(-1, 1)
, vec2(-1,-1)
, vec2( 1,-1)
} ;
void main()
{
gl_Position = pos;
vCol = col;
int i0 = n + (3 * (gl_VertexID/6) );
gColC = data[i0].colx;
gColE = data[i0+1].colx;
int k = ks[gl_VertexID % 6];
gBoundingBox = bs[k];
gPos = (k > 2.5
? data[i0].posx + data[i0+2].posx - data[i0+1].posx
: data[i0+k].posx
).xyz;
gl_Position = theMat * vec4(gPos,1);
}
+1 -1
View File
@@ -1,8 +1,8 @@
#version 450 core
layout (location = 0) in vec4 pos;
layout (location = 1) in vec4 inColor;
//layout (location = 2) in vec4 inTexCoord;
layout (location = 2) in vec3 inTexCoord;
layout (location = 0) uniform int layoff;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out vec4 vColor;
out vec3 vTexCoord;