# beginner's question about texture reference

**URL:** <https://forums.developer.nvidia.com/t/beginners-question-about-texture-reference/4867>\
**Category:** CUDA Programming and Performance\
**Created:** [August 2, 2008, 5:24pm UTC](https://forums.developer.nvidia.com/t/beginners-question-about-texture-reference/4867 "2008-08-02T17:24:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![timothy](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@timothy](https://forums.developer.nvidia.com/u/timothy)\
**Post date:** [August 2, 2008, 5:24pm UTC](https://forums.developer.nvidia.com/t/beginners-question-about-texture-reference/4867/1 "2008-08-02T17:24:44Z")

</div>

Hi there,

I am beginner to CUDA and I have a question about the compiling error:

“error: no instance of overloaded function “tex3D” matches the argument list” When

I am trying to reference data elements in a 3D texture:

```auto
texture<float4, 3, cudaReadModeNormalizedFloat> tex;

float u,v,w;

float4 P = tex3D(tex, u,v,w);

```

I wrote the above code by following the simpleTexture3D example in SDK:

```auto
texture<uchar, 3, cudaReadModeNormalizedFloat> tex;

float voxel = tex3D(tex, u, v, w);

```

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![timothy](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@timothy](https://forums.developer.nvidia.com/u/timothy)\
**Post date:** [August 3, 2008, 1:21am UTC](https://forums.developer.nvidia.com/t/beginners-question-about-texture-reference/4867/2 "2008-08-03T01:21:59Z")

</div>

> [@](#):
>
> Hi there,
> 
> I am beginner to CUDA and I have a question about the compiling error:
> 
> “error: no instance of overloaded function “tex3D” matches the argument list” When
> 
> I am trying to reference data elements in a 3D texture:
> 
> ```auto
> texture<float4, 3, cudaReadModeNormalizedFloat> tex;
> 
> float u,v,w;
> 
> float4 P = tex3D(tex, u,v,w);
> 
> ```
> 
> I wrote the above code by following the simpleTexture3D example in SDK:
> 
> ```auto
> texture<uchar, 3, cudaReadModeNormalizedFloat> tex;
> 
> float voxel = tex3D(tex, u, v, w);
> 
> ```
> 
> Thanks a lot!
> 
> [snapback]419826[/snapback]

It looks correct, but why compiler complains? [External Media](http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/ermm.gif "Media hosted on another site. Click to open in a new tab.")

---

<div class="post-metadata">

**Author:** ![timothy](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@timothy](https://forums.developer.nvidia.com/u/timothy)\
**Post date:** [August 3, 2008, 1:22pm UTC](https://forums.developer.nvidia.com/t/beginners-question-about-texture-reference/4867/3 "2008-08-03T13:22:14Z")

</div>

Is there anyone can help? [External Image](http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/argh.gif "Image hosted on another site. Click to open in a new tab.") Thanks!

---

<div class="post-metadata">

**Author:** ![immo](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@immo](https://forums.developer.nvidia.com/u/immo)\
**Post date:** [August 4, 2008, 7:12am UTC](https://forums.developer.nvidia.com/t/beginners-question-about-texture-reference/4867/4 "2008-08-04T07:12:24Z")

</div>

> [@](#):
>
> Is there anyone can help?&nbsp; [External Media](http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/argh.gif "Media hosted on another site. Click to open in a new tab.") Thanks!
> 
> [snapback]420118[/snapback]

My guess is that its just as the compiler says: there is no overloaded version of tex3D that returns a float4. You have the same problems when trying to adjust the type to just float or something else?

---

<div class="post-metadata">

**Author:** ![timothy](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@timothy](https://forums.developer.nvidia.com/u/timothy)\
**Post date:** [August 4, 2008, 1:27pm UTC](https://forums.developer.nvidia.com/t/beginners-question-about-texture-reference/4867/5 "2008-08-04T13:27:27Z")

</div>

> [@](#):
>
> My guess is that its just as the compiler says: there is no overloaded version of tex3D that returns a float4. You have the same problems when trying to adjust the type to just float or something else?
> 
> [snapback]420420[/snapback]

Yes, float3 and float2 are not supported for example. But other types like float, char…are ok. In fact, I successfully skipped this problem by using “\_\_ftexfetch”, which is defined in texND(). I don’t know if this is a bug of compiler. :mad:

---

<div class="post-metadata">

**Author:** ![papag62](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@papag62](https://forums.developer.nvidia.com/u/papag62)\
**Post date:** [August 4, 2008, 7:20pm UTC](https://forums.developer.nvidia.com/t/beginners-question-about-texture-reference/4867/6 "2008-08-04T19:20:24Z")

</div>

> [@](#):
>
> Yes, float3 and float2 are not supported for example. But other types like float, char…are ok. In fact, I successfully skipped this problem by using “\_\_ftexfetch”, which is defined in texND(). I don’t know if this is a bug of compiler.&nbsp; :mad:
> 
> [snapback]420549[/snapback]

I have used float4’s for 2D texture fetching and everything was fine. What does your channel descriptor look like?

---

<div class="post-metadata">

**Author:** ![timothy](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@timothy](https://forums.developer.nvidia.com/u/timothy)\
**Post date:** [August 5, 2008, 11:20am UTC](https://forums.developer.nvidia.com/t/beginners-question-about-texture-reference/4867/7 "2008-08-05T11:20:04Z")

</div>

> [@](#):
>
> I have used float4’s for 2D texture fetching and everything was fine. What does your channel descriptor look like?
> 
> [snapback]420696[/snapback]

The channel descriptor is like this:

cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc();

I figured out the reason of compiler error: the cudaReadModeNormalizedFloat should be replaced by cudaReadModeElementType.
