";
130 | htmlStream << "| GL_VENDOR | ";
131 | htmlStream << vendor << " |
" ;
132 | htmlStream << "| GL_RENDERER | ";
133 | htmlStream << renderer << " |
" ;
134 | htmlStream << "| GL_VERSION | ";
135 | htmlStream << version << " |
" ;
136 | htmlStream << "| GLSL_VERSION | ";
137 | htmlStream << glsl_version << " |
" ;
138 | htmlStream << "
";
139 | htmlStream.flush();
140 | qApp->setProperty("OpenGLinfoHTML", htmlString );
141 |
142 |
143 | QString plainString;
144 | QTextStream stream(&plainString);
145 | stream << "GL_VENDOR : ";
146 | stream << vendor << endl;
147 | stream << "GL_RENDERER : ";
148 | stream << renderer << endl;
149 | stream << "GL_VERSION : ";
150 | stream << version << endl;
151 | stream << "GLSL_VERSION : ";
152 | stream << glsl_version << endl;
153 | stream.flush();
154 | qApp->setProperty("OpenGLinfo", plainString);
155 |
156 | // Add a callback to the main camera to make it use the default Qt framebuffer
157 | int fboInt = this->defaultFramebufferObject();
158 | this->getCamera()->setPreDrawCallback(new CameraPreDrawCallback(fboInt));
159 | }
160 |
161 | osg::Vec2d Osg3dViewWithCamera::getNormalizedDeviceCoords(const int ix, const int iy)
162 | {
163 | osg::Vec2d ndc;
164 |
165 | int center = width()/2;
166 | ndc[0] = ((double)ix - (double)center) / (double)center;
167 | if (ndc[0] > 1.0) ndc[0] = 1.0;
168 |
169 | center = height()/2;
170 | int invertedY = height() - iy;
171 | ndc[1] = ((double)invertedY - (double)center) / (double)center;
172 | if (ndc[1] > 1.0) ndc[1] = 1.0;
173 |
174 | return ndc;
175 | }
176 |
177 | void Osg3dViewWithCamera::addNode(osg::Node *root)
178 | {
179 | m_scene->addChild(root);
180 | }
181 | void Osg3dViewWithCamera::removeNode(osg::Node *root)
182 | {
183 | m_scene->removeChild(root);
184 | }
185 | void Osg3dViewWithCamera::clearNodes()
186 | {
187 | m_scene->removeChildren(0, m_scene->getNumChildren());
188 | }
189 |
190 | void Osg3dViewWithCamera::setLightingTwoSided(bool tf)
191 | {
192 | osg::ref_ptr