2

私の問題は、単純な平面を適切に描画していません。開始時に一度エラーが発生する理由がわかりません:無効な操作1282.誰かがそれを確認できますか?

私の変数: インデックスGLfloat *tabの頂点平面 int *tab2

これは私のinit関数です:

// kolor tła - zawartość bufora koloru
glClearColor( 1.0f, 1.0f, 1.0f, 1.0f );

// wczytanie shaderów i przygotowanie obsługi programu
program=LoadShaders("shader.vert","shader.frag" );

//Vertexy
//VertexArrayID;
glGenVertexArrays(1, &VertexArrayID);
glBindVertexArray(VertexArrayID);

//Verticies;
glGenBuffers(1, &Verticies);
glBindBuffer(GL_ARRAY_BUFFER, Verticies);
glBufferData( GL_ARRAY_BUFFER,foo*sizeof(GLfloat), tab, GL_STATIC_DRAW );

unsigned int m_ciezarkow[]={0,1,0};


//Indicies
glGenBuffers(1,&Indeksy);
glBindBuffer(GL_ARRAY_BUFFER,Indeksy);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(unsigned int)*size, tab2, GL_STATIC_DRAW); 



glUseProgram( program );

pos_cam=glGetUniformLocation( program, "camera" );
pos_color=glGetUniformLocation( program, "_color" );

glUseProgram(0);

これは私の描画機能です:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(program);
//my camera
glUniformMatrix4fv(pos_cam,1,GL_FALSE,&cam.matrix()[0][0]);

//Verticies
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, Verticies);
glVertexAttribPointer( 0, 3 , GL_FLOAT, GL_FALSE, 0, (void*)0 );

//Masa
//glEnableVertexAttribArray(1);
//glBindBuffer(GL_ARRAY_BUFFER, Masa);
//glVertexAttribPointer( 0, 3 , GL_FLOAT, GL_FALSE, 0, (void*)0 );

//Indicies
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,Indeksy);

glDrawElements(GL_TRIANGLES,size,GL_UNSIGNED_INT,(void*)0); 
glUseProgram( 0 );
glDisableVertexAttribArray(0);`
4

1 に答える 1