3 #include <vtkOpenGLHelper.h>
4 #include <vtkShaderProgram.h>
5 #include <vtkOpenGLBufferObject.h>
7 #include <vtkOpenGLVertexArrayObject.h>
8 #include <vtkOpenGLIndexBufferObject.h>
10 #include <vtkOpenGLRenderWindow.h>
11 #include <vtkTextureObject.h>
110 std::cout <<
" START TEST" << std::endl;
111 if(event == vtkCommand::UpdateShaderEvent)
113 std::cout <<
"--- START UpdateShaderEvent" << std::endl;
114 vtkOpenGLHelper *cellBO =
reinterpret_cast<vtkOpenGLHelper*
>(cbo);
117 if(cellBO && cellBO->VAO)
121 vtkShaderProgram *program = cellBO->Program;
122 vtkOpenGLVertexArrayObject *vao = cellBO->VAO;
124 std::cout <<
"Program is compiled? " << program->GetCompiled() << std::endl;
125 std::cout <<
"Program is bound? " << program->isBound() << std::endl;
126 std::cout <<
"IBO index count " << cellBO->IBO->IndexCount << std::endl;
130 GLint color_frag_out_index = glGetFragDataLocation(cellBO->Program->GetHandle(),
"color");
131 std::cout <<
"color index " << color_frag_out_index << std::endl;
132 glBindFragDataLocation(cellBO->Program->GetHandle(), color_frag_out_index,
"color");
135 std::cout <<
"ADDING ATTRIBUTE ARRAY" << std::endl;
146 if (!vao->AddAttributeArray(
157 vtkGenericWarningMacro(<<
"Error setting 'COLOR' in shader VAO.");
162 if (!vao->AddAttributeArray(
165 "TEXTURE_COORDINATE_VSIN",
173 vtkGenericWarningMacro(<<
"Error setting 'COLOR' in shader VAO.");
177 if(!program->SetUniformi(
"my_texture_1",
mTextureObject1->GetTextureUnit()))
178 std::cout <<
"my_texture_1 -------------------------------------> ERROR!!!" << std::endl;
181 if(!program->SetUniformi(
"my_texture_2",
mTextureObject2->GetTextureUnit()))
182 std::cout <<
"my_texture_2 -------------------------------------> ERROR!!!" << std::endl;
185 std::cout <<
"--- END UpdateShaderEvent" << std::endl;
190 std::cout <<
"END TEST" << std::endl;
196 std::cout <<
"ERROR NO CONTEXT!!!" << std::endl;