made setAttriute const
This commit is contained in:
parent
7df873b445
commit
06c1ef467e
2 changed files with 6 additions and 4 deletions
|
@ -7,6 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "basic.h"
|
#include "basic.h"
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
namespace J {
|
namespace J {
|
||||||
void check_error(){
|
void check_error(){
|
||||||
|
|
|
@ -105,10 +105,11 @@ public:
|
||||||
// *****************
|
// *****************
|
||||||
// attribute setters
|
// attribute setters
|
||||||
// NOTE: the normalized parameter is for integer types, if true they will be mapped to [0, 1], if false it stays in [0, 256] or so.
|
// NOTE: the normalized parameter is for integer types, if true they will be mapped to [0, 1], if false it stays in [0, 256] or so.
|
||||||
void set_attribute(const std::string& name, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr){
|
void set_attribute(const std::string& name, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) const {
|
||||||
const GLuint index = attributes[name];
|
auto it = attributes.find(name);
|
||||||
glVertexAttribPointer(index, size, type, normalized, stride, ptr);
|
if(it == attributes.end()) throw std::runtime_error(name + " attribute could not be found");
|
||||||
glEnableVertexAttribArray(index);
|
glVertexAttribPointer(it->second, size, type, normalized, stride, ptr);
|
||||||
|
glEnableVertexAttribArray(it->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************
|
// ***************
|
||||||
|
|
Reference in a new issue