I
I
IliaNeverov2020-12-21 09:05:17
C++ / C#
IliaNeverov, 2020-12-21 09:05:17

Why do I get an error that the identifier was not found?

Please tell me why I get an error not found identifier although it (vector mBuffers) is declared.
here is my code:

#pragma once
#include "gl.h"
#include<vector>
namespace GL
{
  class VAO {

        public:
        	VAO();
        	VAO(const VAO&) = delete;
            void bind();
            void AddVertexBufferObjects(const std::vector<float> data);
        	~VAO();

        private:
            GLuint mVao;
            std::vector <GLuint> mBuffers;

        protected:
        
     };
};

<code lang="cpp">
#include "VAO.h"

#include "gl.h"
GL::VAO::VAO()
{
  glGenVertexArrays(1 , &mVao);
}

void GL::VAO::bind()
{
  glBindVertexArray(mVao);
}

void GL::VAO::AddVertexBufferObjects(const std::vector<float> data)
{
  GLuint vbo;
  glGenBuffers(1, &vbo);
  glBindBuffer(GL_ARRAY_BUFFER , vbo);
  glBufferData(GL_ARRAY_BUFFER, data.size() * sizeof(float), data.data(), GL_STATIC_DRAW);
  glVertexAttribPointer(mBuffers.size, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
  mBuffers.push_back(vbo);
}

GL::VAO::~VAO()
{
  glDeleteVertexArrays(1, &mVao);
}

</code>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question