------------------------------------------------------------------------------
| 59 | |
| 60 | //------------------------------------------------------------------------------ |
| 61 | bool vtkVRModel::Build(vtkOpenGLRenderWindow* win) |
| 62 | { |
| 63 | this->FillModelHelper(); |
| 64 | |
| 65 | this->ModelHelper.Program = win->GetShaderCache()->ReadyShaderProgram( |
| 66 | |
| 67 | // vertex shader -- use normals?? yes? |
| 68 | "//VTK::System::Dec\n" |
| 69 | "uniform mat4 matrix;\n" |
| 70 | "in vec4 position;\n" |
| 71 | // "attribute vec3 v3NormalIn;\n" |
| 72 | "in vec2 v2TexCoordsIn;\n" |
| 73 | "out vec2 v2TexCoord;\n" |
| 74 | "void main()\n" |
| 75 | "{\n" |
| 76 | " v2TexCoord = v2TexCoordsIn;\n" |
| 77 | " gl_Position = matrix * vec4(position.xyz, 1);\n" |
| 78 | "}\n", |
| 79 | |
| 80 | // fragment shader |
| 81 | "//VTK::System::Dec\n" |
| 82 | "//VTK::Output::Dec\n" |
| 83 | "uniform sampler2D diffuse;\n" |
| 84 | "in vec2 v2TexCoord;\n" |
| 85 | "out vec4 outputColor;\n" |
| 86 | "void main()\n" |
| 87 | "{\n" |
| 88 | " gl_FragData[0] = texture(diffuse, v2TexCoord);\n" |
| 89 | "}\n", |
| 90 | |
| 91 | // geom shader |
| 92 | ""); |
| 93 | |
| 94 | this->SetPositionAndTCoords(); |
| 95 | |
| 96 | // create and populate the texture |
| 97 | this->CreateTextureObject(win); |
| 98 | |
| 99 | return true; |
| 100 | } |
| 101 | |
| 102 | //------------------------------------------------------------------------------ |
| 103 | void vtkVRModel::Render(vtkOpenGLRenderWindow* win, vtkMatrix4x4* modelToPhysicalMatrix) |