# Where is shader function "texture()" defined? (GLMakie.jl/volume())

**URL:** <https://discourse.julialang.org/t/where-is-shader-function-texture-defined-glmakie-jl-volume/133062>\
**Category:** Visualization\
**Tags:** makie, glmakie\
**Created:** [October 11, 2025, 12:32am UTC](https://discourse.julialang.org/t/where-is-shader-function-texture-defined-glmakie-jl-volume/133062 "2025-10-11T00:32:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hsgg](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hsgg](https://discourse.julialang.org/u/hsgg)\
**Post date:** [October 11, 2025, 12:32am UTC](https://discourse.julialang.org/t/where-is-shader-function-texture-defined-glmakie-jl-volume/133062/1 "2025-10-11T00:32:31Z")

</div>

Hi, I am looking into implementing adaptive sampling for the GLMakie `volume()` visualizations. However, being new to OpenGL, I cannot find where the `texture()` function is defined. I believe the implementation of that function should give all the information needed to implement adaptive sampling.

Specifically, I will need to know the positions of two opposing vertices of the grid cell containing a given position in the volumedata. Thanks!

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [October 11, 2025, 8:12am UTC](https://discourse.julialang.org/t/where-is-shader-function-texture-defined-glmakie-jl-volume/133062/2 "2025-10-11T08:12:45Z")

</div>

it’s an glsl internal function implemented in the OpenGL driver.  
If I’m not misunderstanding you, the current volume shaders already calculate the opposing vertices, or rather intersections of the ray with the cube of the volume.

---

<div class="post-metadata">

**Author:** ![hsgg](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hsgg](https://discourse.julialang.org/u/hsgg)\
**Post date:** [October 12, 2025, 8:20pm UTC](https://discourse.julialang.org/t/where-is-shader-function-texture-defined-glmakie-jl-volume/133062/3 "2025-10-12T20:20:55Z")

</div>

Thanks, I had not expected that! What I need is the shape of a single grid cell. However, given that the whole volume data is in a 1x1x1 cuboid, I think `textureSize()` should give what is needed to calculate the shapes of individual grid cells.

The key to adaptive sampling is to calculate the intersections for each grid cell.
