mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-12 02:29:04 +08:00
libvgcode - Replace 'glVertexAttribIPointer()' with 'glVertexAttribPointer()' in SegmentTemplate::init() for OpenGL ES
This commit is contained in:
parent
8b0142fcce
commit
e7b22a8d3b
@ -44,10 +44,10 @@ set(LIBVGCODE_SOURCES
|
||||
src/ViewerImpl.cpp
|
||||
src/ViewRange.hpp
|
||||
src/ViewRange.cpp
|
||||
# glad OpenGL
|
||||
glad/include/glad/gl.h
|
||||
glad/include/KHR/khrplatform.h
|
||||
glad/src/gl.c
|
||||
# glad OpenGL
|
||||
glad/include/glad/gl.h
|
||||
glad/include/KHR/khrplatform.h
|
||||
glad/src/gl.c
|
||||
# # glad OpenGL ES
|
||||
# glad/include/glad/gles2.h
|
||||
# glad/include/KHR/khrplatform.h
|
||||
|
@ -45,7 +45,11 @@ void SegmentTemplate::init()
|
||||
glsafe(glBindBuffer(GL_ARRAY_BUFFER, m_vbo_id));
|
||||
glsafe(glBufferData(GL_ARRAY_BUFFER, VERTEX_DATA.size() * sizeof(uint8_t), VERTEX_DATA.data(), GL_STATIC_DRAW));
|
||||
glsafe(glEnableVertexAttribArray(0));
|
||||
glsafe(glVertexAttribIPointer(0, 1, GL_UNSIGNED_BYTE, sizeof(uint8_t), (const void*)0));
|
||||
#if VGCODE_ENABLE_OPENGL_ES
|
||||
glsafe(glVertexAttribPointer(0, 1, GL_UNSIGNED_BYTE, GL_FALSE, 0, (const void*)0));
|
||||
#else
|
||||
glsafe(glVertexAttribIPointer(0, 1, GL_UNSIGNED_BYTE, 0, (const void*)0));
|
||||
#endif // VGCODE_ENABLE_OPENGL_ES
|
||||
|
||||
glsafe(glBindBuffer(GL_ARRAY_BUFFER, curr_array_buffer));
|
||||
glsafe(glBindVertexArray(curr_vertex_array));
|
||||
|
@ -31,7 +31,7 @@ static const char* Segments_Vertex_Shader_ES =
|
||||
"uniform sampler2D height_width_angle_tex;\n"
|
||||
"uniform sampler2D color_tex;\n"
|
||||
"uniform usampler2D segment_index_tex;\n"
|
||||
"in int vertex_id;\n"
|
||||
"in float vertex_id_float;\n"
|
||||
"out vec3 color;\n"
|
||||
"vec3 decode_color(float color) {\n"
|
||||
" int c = int(round(color));\n"
|
||||
@ -56,6 +56,7 @@ static const char* Segments_Vertex_Shader_ES =
|
||||
" return (tex_size.y == 1) ? ivec2(id, 0) : ivec2(id % tex_size.x, id / tex_size.x);\n"
|
||||
"}\n"
|
||||
"void main() {\n"
|
||||
" int vertex_id = int(vertex_id_float);\n"
|
||||
" int id_a = int(texelFetch(segment_index_tex, tex_coord_u(segment_index_tex, gl_InstanceID), 0).r);\n"
|
||||
" int id_b = id_a + 1;\n"
|
||||
" vec3 pos_a = texelFetch(position_tex, tex_coord(position_tex, id_a), 0).xyz;\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user