pass data (xyz, uv) with 1 buffer to shader,

bugs:
2 triangles are not painted, one is wrong positioned
This commit is contained in:
Anakin
2016-11-01 11:51:04 +01:00
parent a875820f48
commit 9d35634c0c
3 changed files with 50 additions and 52 deletions

View File

@@ -6,6 +6,23 @@
#include <vector>
#include "Object.h"
#define VERTEX_INDEX_XYZ 0
#define VERTEX_INDEX_UV 1
#define VERTEX_COMPONENTS_XYZ 3
#define VERTEX_COMPONENTS_UV 4
#define VERTEX_SIZE_XYZ (sizeof(float) * VERTEX_COMPONENTS_XYZ)
#define VERTEX_SIZE_UV (sizeof(float) * VERTEX_COMPONENTS_UV)
#define VERTEX_OFFSET_XYZ 0
#define VERTEX_OFFSET_UV (VERTEX_SIZE_XYZ)
struct Vertex {
GLfloat position[3];
GLfloat uv[2];
};
class OpenGLController
{
////////////////////////////////////////////////////////////////////////////////////////////
@@ -35,10 +52,10 @@ private:
// IDs ==========================
//object data
GLuint gluiVertexArrayID;
GLuint gluiInstanceBufferID;
GLuint gluiVertexBufferID;
//obj color
GLuint gluiUVBufferID;
GLuint gluiTextureID;
GLuint gluiShaderPrgmID;
GLuint gluiSamplerID;