# UnStructuredGrid rendering with OSPRay

**URL:** https://discourse.vtk.org/t/unstructuredgrid-rendering-with-ospray/1826
**Category:** Support
**Created:** [September 26, 2019, 3:42am UTC](https://discourse.vtk.org/t/unstructuredgrid-rendering-with-ospray/1826 "2019-09-26T03:42:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ymhsieh](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/y/47e85d/32.png) [@ymhsieh](https://discourse.vtk.org/u/ymhsieh)
#### Post date: [September 26, 2019, 3:42am UTC](https://discourse.vtk.org/t/unstructuredgrid-rendering-with-ospray/1826/1 "2019-09-26T03:42:40Z")

</div>

Hello, I have problems with rendering a simple unstructuredgrid with OSPRay turned on. The UnStructuredGrid is constructed as attached, and it renders fine without OSPRay. I’ve also tested my setup and vtkSphereSource renders without a problem using OSPRay. Any soluiton/hint is appreciated.

Sincerely,  
Yo-Ming Hsieh

```
float pointData[] {
    0, 0, 0,
    1, 0, 0,
    1, 1, 0,
    0, 1, 0
};
vtkIdType faceData[] {
    0, 1, 3,
    1, 2, 3
};
float normalData[] {
    0, 0, 1,
    0, 0, 1,
    0, 0, 1,
    0, 0, 1
};

auto pts = vtkSmartPointer<vtkPoints>::New();
pts->Allocate(4);
pts->InsertPoint(0, pointData);
pts->InsertPoint(1, pointData+3);
pts->InsertPoint(2, pointData+6);
pts->InsertPoint(3, pointData+9);

auto normals = vtkSmartPointer<vtkFloatArray>::New();
normals->SetNumberOfComponents(3);
normals->SetNumberOfTuples(4);
normals->InsertTuple(0, normalData);
normals->InsertTuple(1, normalData+3);
normals->InsertTuple(2, normalData+6);
normals->InsertTuple(3, normalData+9);

auto mesh = vtkSmartPointer<vtkUnstructuredGrid>::New();
mesh->SetPoints(pts);
mesh->GetPointData()->SetNormals(normals);
mesh->Allocate( 2 );
mesh->InsertNextCell(VTK_TRIANGLE, 3, faceData);
mesh->InsertNextCell(VTK_TRIANGLE, 3, faceData+3);

auto mapper = vtkSmartPointer<vtkDataSetMapper>::New();
mapper->SetInputData( mesh );
auto actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper( mapper );
```
