# Rendering Using GPU

**URL:** https://discourse.vtk.org/t/rendering-using-gpu/3423
**Category:** Development
**Created:** [May 30, 2020, 11:31am UTC](https://discourse.vtk.org/t/rendering-using-gpu/3423 "2020-05-30T11:31:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Rasoul\_Sharifian](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rasoul_sharifian/32/1883_2.png) [@Rasoul\_Sharifian](https://discourse.vtk.org/u/Rasoul_Sharifian)
#### Post date: [May 30, 2020, 11:31am UTC](https://discourse.vtk.org/t/rendering-using-gpu/3423/1 "2020-05-30T11:31:18Z")

</div>

Hi all,  
I have a question about using GPU for rendering 3d data.  
I found [this example](https://lorensen.github.io/VTKExamples/site/Cxx/VolumeRendering/RayCastIsosurface) in lorensen site, but I have an error. The exception is:

```
Exception thrown at 0x00007FF8631E96BC (vtkRenderingVolume-8.1.dll) in VTK_Example.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
If there is a handler for this exception, the program may be safely continued.

```

the error occurs in line 38:  
auto mapper =  
vtkSmartPointer::New();

I do not know if I should for example enable something in building steps to use GPU or VTK will find my GPU (Nvidia 1050Ti) by default.

any suggestion would be helpful,  
regards, Rasoul

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [June 1, 2020, 1:31am UTC](https://discourse.vtk.org/t/rendering-using-gpu/3423/2 "2020-06-01T01:31:23Z")

</div>

Looks like you copied incorrectly :

```
  auto mapper =
    vtkSmartPointer<vtkOpenGLGPUVolumeRayCastMapper>::New();
```

---

<div class="post-metadata">

### Author: ![Rasoul\_Sharifian](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rasoul_sharifian/32/1883_2.png) [@Rasoul\_Sharifian](https://discourse.vtk.org/u/Rasoul_Sharifian)
#### Post date: [June 2, 2020, 7:54am UTC](https://discourse.vtk.org/t/rendering-using-gpu/3423/3 "2020-06-02T07:54:42Z")

</div>

yes!  
do you have any suggestion for using gpu?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [June 2, 2020, 9:09am UTC](https://discourse.vtk.org/t/rendering-using-gpu/3423/4 "2020-06-02T09:09:26Z")

</div>

So you have the same error with the correct code ?

What is your OS ? GPU ? driver ?

---

<div class="post-metadata">

### Author: ![wulicheng](https://discourse.vtk.org/user_avatar/discourse.vtk.org/wulicheng/32/1990_2.png) [@wulicheng](https://discourse.vtk.org/u/wulicheng)
#### Post date: [June 17, 2020, 6:28am UTC](https://discourse.vtk.org/t/rendering-using-gpu/3423/5 "2020-06-17T06:28:58Z")

</div>

> [@Rasoul\_Sharifian](#):
>
> uggestion for using gpu

I think you should :  
auto mapper = vtkSmartPointer\< vtkRenderingVolume\>::New();

others, complier don’t define the type of the mapper.
