use attributes object dimensions and type functions
This commit is contained in:
parent
d2f97edab9
commit
25e2a7ad4f
|
@ -47,7 +47,7 @@
|
|||
"enabled": true,
|
||||
"json-save": true,
|
||||
"json-save-directory": "local/scans",
|
||||
"barcode": "",
|
||||
"barcode": "045496591922",
|
||||
"capture-device": "/dev/video0"
|
||||
},
|
||||
"api":
|
||||
|
|
2
lib/sb
2
lib/sb
|
@ -1 +1 @@
|
|||
Subproject commit 64f6b765a76a5839dda44e5ca0dd153d17245aec
|
||||
Subproject commit 3baaa7624e42880a47d55b2e659038019131ee02
|
|
@ -210,23 +210,28 @@ void Pudding::load_gl_context()
|
|||
pudding_attributes["vertices"].size() + pudding_attributes["colors"].size();
|
||||
glBufferData(GL_ARRAY_BUFFER, vbo_size, rectangle_attributes["position"], GL_STATIC_DRAW);
|
||||
/* specify the rectangle vertex attributes as consecutive 2D float coords */
|
||||
glVertexAttribPointer(rectangle_attributes["position"].index(), 2, GL_FLOAT, GL_FALSE, 0, nullptr);
|
||||
glVertexAttribPointer(rectangle_attributes["position"].index(), rectangle_attributes["position"].dimensions(),
|
||||
rectangle_attributes["position"].type(), GL_FALSE, 0, nullptr);
|
||||
/* copy rectangle UV data into the VBO, offset to after the vertex data, set up attributes */
|
||||
GLintptr offset = rectangle_attributes["position"].size();
|
||||
glBufferSubData(GL_ARRAY_BUFFER, offset, rectangle_attributes["uv"].size(), rectangle_attributes["uv"]);
|
||||
glVertexAttribPointer(rectangle_attributes["uv"].index(), 2, GL_FLOAT, GL_FALSE, 0, reinterpret_cast<GLvoid*>(offset));
|
||||
glVertexAttribPointer(rectangle_attributes["uv"].index(), rectangle_attributes["uv"].dimensions(),
|
||||
rectangle_attributes["uv"].type(), GL_FALSE, 0, reinterpret_cast<GLvoid*>(offset));
|
||||
/* copy pudding vertices into VBO, offset to after the rectangle UV, and set up vertex attributes for 3D */
|
||||
offset += rectangle_attributes["uv"].size();
|
||||
glBufferSubData(GL_ARRAY_BUFFER, offset, pudding_attributes["vertices"].size(), pudding_attributes["vertices"]);
|
||||
glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, 0, reinterpret_cast<GLvoid*>(offset));
|
||||
glVertexAttribPointer(2, pudding_attributes["vertices"].dimensions(), pudding_attributes["vertices"].type(),
|
||||
GL_FALSE, 0, reinterpret_cast<GLvoid*>(offset));
|
||||
/* copy pudding color values into VBO, offset to after pudding vertices and set as 3D */
|
||||
offset += pudding_attributes["vertices"].size();
|
||||
glBufferSubData(GL_ARRAY_BUFFER, offset, pudding_attributes["colors"].size(), pudding_attributes["colors"]);
|
||||
glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, 0, reinterpret_cast<GLvoid*>(offset));
|
||||
glVertexAttribPointer(3, pudding_attributes["colors"].dimensions(), pudding_attributes["colors"].type(),
|
||||
GL_FALSE, 0, reinterpret_cast<GLvoid*>(offset));
|
||||
/* copy pudding UV values into VBO, offset to after pudding color vertices and set as 2D */
|
||||
offset += pudding_attributes["colors"].size();
|
||||
glBufferSubData(GL_ARRAY_BUFFER, offset, pudding_attributes["uv"].size(), pudding_attributes["uv"]);
|
||||
glVertexAttribPointer(4, 2, GL_FLOAT, GL_FALSE, 0, reinterpret_cast<GLvoid*>(offset));
|
||||
glVertexAttribPointer(4, pudding_attributes["uv"].dimensions(), pudding_attributes["uv"].type(),
|
||||
GL_FALSE, 0, reinterpret_cast<GLvoid*>(offset));
|
||||
sb::Log::gl_errors("after loading attributes");
|
||||
/* link shaders */
|
||||
link_shader(flat_program);
|
||||
|
|
Loading…
Reference in New Issue