Skip to content

Commit f42ce3b

Browse files
committed
fixed Texture constructor to work with uints
1 parent 6694b67 commit f42ce3b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

data/shaders/mortonCodes.comp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ uint morton3D(float x, float y, float z)
2727
}
2828

2929
void main(){
30-
// ivec2 texelCoord = ivec2(gl_GlobalInvocationID.xy);
31-
//vec4 position = imageLoad(posImgInput, texelCoord);
32-
//uint mortonCode = morton3D(position.x, position.y, position.z);
33-
//imageStore(mortonCodesImg, texelCoord, position);
30+
ivec2 texelCoord = ivec2(gl_GlobalInvocationID.xy);
31+
vec4 position = imageLoad(posImgInput, texelCoord);
32+
uint mortonCode = morton3D(position.x, position.y, position.z);
33+
imageStore(mortonCodesImg, texelCoord, position);
3434

3535
}

src/Texture.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Texture::Texture(int w, int h, unsigned int* data)
4242
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
4343
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
4444
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
45-
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, w, h, 0, GL_RGBA, GL_FLOAT, data);
45+
glTexImage2D(GL_TEXTURE_2D, 0, 1, w, h, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, data);
4646

4747

4848
Unbind();

0 commit comments

Comments
 (0)