#ifndef ECSGAME_LINES_H #define ECSGAME_LINES_H #include #include #include #include struct Lines { explicit Lines() { GLfloat lineSeg[] = { 0.0f, 0.0f, 0.0f, // first vertex 2.0f, 2.0f, 2.0f // second vertex }; glGenVertexArrays(1, &lineVAO); glGenBuffers(1, &lineVBO); glBindVertexArray(lineVAO); glBindBuffer(GL_ARRAY_BUFFER, lineVBO); glBufferData(GL_ARRAY_BUFFER, sizeof(lineSeg), &lineSeg, GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), (void *)0); } void render() const { // glEnable(GL_LINE_SMOOTH); // glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); glBindVertexArray(lineVAO); glLineWidth(3.3f); glDrawArrays(GL_LINES, 0, 2); glLineWidth(1.0f); } private: GLuint lineVAO, lineVBO; }; #endif // ECSGAME_LINES_H