change uint to int for attributes bind index

This commit is contained in:
frank 2021-10-29 22:09:01 -04:00
parent 950a95502b
commit 2c0517b9e2
3 changed files with 9 additions and 8 deletions

View File

@ -24,7 +24,7 @@
* Once assigned, the index can be passed to glVertexAttribPointer to set the properties of the
* attributes on the GPU, either manually or automatically through the add member function in the
* VBO class. */
void sb::Attributes::index(GLuint index)
void sb::Attributes::index(GLint index)
{
attribute_index = index;
}
@ -33,7 +33,7 @@ void sb::Attributes::index(GLuint index)
* glBindAttribLocation to assign the index to a shader input variable if the index isn't already
* assigned by a layout qualifier in the GLSL source code. The index should be passed to
* glVertexAttribPointer to specify the location to use when rendering. */
GLuint sb::Attributes::index() const
GLint sb::Attributes::index() const
{
return attribute_index;
}
@ -88,6 +88,9 @@ std::size_t sb::Attributes::size() const
void sb::Attributes::bind(GLuint program, const std::string& name)
{
index(glGetAttribLocation(program, name.c_str()));
std::ostringstream message;
message << "index for " << name << " is " << index();
sb::Log::log(message, sb::Log::DEBUG);
}
/* Set the index and bind it to the given name in a shader program. This should be called before

View File

@ -128,7 +128,7 @@ namespace sb
std::vector<glm::bvec3>, std::vector<glm::uvec3>, std::vector<glm::ivec3>, std::vector<glm::vec3>,
std::vector<glm::bvec4>, std::vector<glm::uvec4>, std::vector<glm::ivec4>, std::vector<glm::vec4>>;
Vertices vertices;
GLuint attribute_index = 0;
GLint attribute_index = 0;
public:
@ -211,8 +211,8 @@ namespace sb
}
void extend(const Attributes&, std::size_t = 1);
void index(std::uint32_t);
GLuint index() const;
void index(GLint);
GLint index() const;
void bind(GLuint, const std::string&);
void bind(std::uint32_t, GLuint, const std::string&);
void enable() const;

View File

@ -6,9 +6,7 @@
| ~~~~~~~~~~~~ | +--------------------------------------------------------------+
| SPACE ~~~~~ | /
| ~~~~~~~ BOX |/
+--------------+
*/
+-------------*/
#include "Texture.hpp"
using namespace sb;