"sizeof(points)"はエラーを投げている部分です(以下にマークします)。私は何が起こっているのか分からない。私はOpenGLの初心者です。私は、それで複数の三角形を描画できるようにするために学んだことを実験しています。要素のPCAFが言ったように私もsizeof(Points)
はあなたにポインタのサイズを与え、pastebin here"不完全な種類が許可されていません"エラー
VertexObject.h
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <GL\glew.h>
#include <GLFW\glfw3.h>
class VertexObject
{
public:
VertexObject ();
void SetArray (GLfloat Points []);
void SetBuffer (GLuint* VBO);
GLfloat Points [ ] = {
1.0f , 0.0f , 1.0f,
0.0f , 1.0f , 1.0f,
-1.0f , 0.0f , 1.0f
};
private:
};
VertexObject.cpp
#include "VertexObject.h"
#include <stdio.h>
#include <stdlib.h>
#include <GL\glew.h>
#include <GLFW\glfw3.h>
void VertexObject::SetArray (GLfloat Points [ ])
{
//Generate Vertex Array Object
GLuint vaoID1;
//Generates an array for the VAO
glGenVertexArrays (1 , &vaoID1);
//Assigns the array to the Vertex Array Object
glBindVertexArray (vaoID1);
//Fills in the array
for (int i = 0; i < sizeof (Points); i++) //Error occurs here
{
this->Points [ i ] = Points [ i ];
}
}
void VertexObject::SetBuffer (GLuint* VBO)
{
//Generate Vertex Buffer Object
glGenBuffers (1 , VBO);
glBindBuffer (GL_ARRAY_BUFFER , *VBO);
glBufferData (GL_ARRAY_BUFFER ,sizeof(Points) , Points , GL_STATIC_DRAW);
}
で、サイクルで使用します。 –
ヘッダファイル –
で定義されていますが、 "this-> points"を使用しても、それでもエラーがスローされます –