DisplayGroupRenderer::DisplayGroupRenderer( RenderContextPtr renderContext )
    : renderContext_( renderContext )
    , displayGroup_( new DisplayGroup( QSize( )))
    , displayGroupItem_( 0 )
{
    setRenderingOptions( boost::make_shared<Options>( ));
}
Exemplo n.º 2
0
void
SliceRenderer::renderSlice(
	const soglu::GLViewSetup &aViewSetup,
	const soglu::GLTextureImageTyped<3> &aImage,
	const SliceConfiguration &aSlice,
	const SliceRenderingQuality &aRenderingQuality,
	const TRenderingOptions &aRenderingOptions
	)
{
	soglu::GLSLProgram &shaderProgram = getShaderProgram(aRenderingOptions, aRenderingQuality);

	int vertexLocation = shaderProgram.getAttributeLocation("vertex");
	auto programBinder = getBinder(shaderProgram);

	setViewSetup(shaderProgram, aViewSetup);
	setSliceRenderingImageData(shaderProgram, aImage, aRenderingQuality.enableInterpolation);

	setRenderingOptions(shaderProgram, aRenderingOptions);

	shaderProgram.use([&aImage, &aSlice, vertexLocation]() {
			soglu::drawVertexBuffer(
				generateVolumeSlice(aImage.getExtents().realMinimum, aImage.getExtents().realMaximum, aSlice.slice, aSlice.plane),
				GL_TRIANGLE_FAN,
				vertexLocation
				);
		});
}
Exemplo n.º 3
0
/**
 * This method initializes the opengl settings. its invoked defaultly by Qt when the widget
 * is initialized.
 */
void MantidGLWidget::initializeGL()
{
  setCursor(cursorShape); // This is to set the initial window mouse cursor to Hand icon
  
  // Set the relevant OpenGL rendering options
  setRenderingOptions();
  glViewport(0,0,width(),height());
  
  // Clear the memory buffers
  QColor bgColor = currentBackgroundColor();
  glClearColor(GLclampf(bgColor.red()/255.0),GLclampf(bgColor.green()/255.0),GLclampf(bgColor.blue()/255.0),1.0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}