Trimap implemented; need bugfixes

This commit is contained in:
Caesar2011
2016-09-05 21:58:45 +02:00
parent fe718a4658
commit 2acbd0c10f
5 changed files with 82 additions and 16 deletions

View File

@@ -251,12 +251,17 @@ int main(int argc, char* args[]) {
tex_jpe=LoadTexture("../img/tests/test.bmp",&textw,&texth);
tex_jpe=LoadTexture("../img/tests/test.png",&textw,&texth);
GLuint programID = LoadShaders("trimap.vertexshader", "trimap.fragmentshader");
printf("%d", programID);
GLint textureLocation = glGetUniformLocationARB(programID, "myTextureSampler");
glUniform1i(textureLocation, tex_jpe);
GLint textureLocation = glGetUniformLocation(programID, "myTextureSampler");
GLint widthLocation = glGetUniformLocation(programID, "pixWidth");
GLint heigthLocation = glGetUniformLocation(programID, "pixHeight");
printf("Shader program ID: %d\n", programID);
printf("textureLocation: %d\n", textureLocation);
printf("widthLocation: %d\n", widthLocation);
printf("heigthLocation: %d\n", heigthLocation);
printf("Width: %f", 1.0f/textw);
@@ -270,7 +275,8 @@ int main(int argc, char* args[]) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(programID);
glUniform1f(widthLocation, 1.0f/textw);
glUniform1f(heigthLocation, 1.0f/texth);
// 1rst attribute buffer : vertices
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
@@ -286,12 +292,12 @@ int main(int argc, char* args[]) {
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER, colorbuffer);
glVertexAttribPointer(
1, // attribute. No particular reason for 1, but must match the layout in the shader.
2, // size
GL_FLOAT, // type
GL_FALSE, // normalized?
0, // stride
(void*)0 // array buffer offset
1, // attribute. No particular reason for 1, but must match the layout in the shader.
2, // size
GL_FLOAT, // type
GL_FALSE, // normalized?
0, // stride
(void*)0 // array buffer offset
);