PDA

View Full Version : Texture3D deprecated?



NeXEkho
08-06-2010, 03:40 PM
I try and use a sampler3D in a GLSL 1.4 and I get a warning:

global function texture3D is deprecated after version 120

I'm wondering; why, and what exactly can I use after version 120 to replace it? I couldn't find any mention of it being deprecated in my Google searches, can anyone please elaborate? I was going to use it for volume rendering but its absence complicates things.

NOTE:
If I roll back to #130, it renders but I still get the warning. Driver bug? nVidia 9500GT with latest drivers.



uint8_t ui8Shader_Voxel_Vertex[] =

"#version 140\n"

"in vec3 v3Vertex;"
"out vec3 v3Coord;"

"uniform mat4 m4Transform;"

"void main()"
"{"

" v3Coord = v3Vertex;"
" gl_Position = m4Transform * vec4( v3Vertex, 1.0 );"

"}";

uint8_t ui8Shader_Voxel_Fragment[] =

"#version 140\n"

"in vec3 v3Coord;"

"out vec4 v4Composited;"
"uniform sampler3D s3dField;"

"void main(void)"
"{"

" v4Composited = texture3D( s3dField, v3Coord );"

"}";

Sunray
08-06-2010, 04:04 PM
texture(), the actual texture type is already known from the input sampler type.

NeXEkho
08-06-2010, 04:08 PM
I see. Thanks. Oddly I get no such warning when using texture2D?

NeXEkho
08-06-2010, 05:26 PM
A secondary question along the same lines; is it possible to get both a linear interpolated and nearest neighbor sample of the same texture in the same fragment? (i.e. without duplicating my 64mb sample)

Also, a tertiary question. How is a vec3 comparison handled? Do all the elements of a have to be greater than b for a > b to return true or just at least one?

Sunray
08-07-2010, 01:48 AM
Since texture filtering is a part of the texture state I'm sure you would have to do the filtering yourself.

I'm pretty sure that GLSL doesn't define any > operator for vec3, so if the NVIDIA implementation does than god knows what that does. Presumably the same thing as in Cg.

skynet
08-07-2010, 02:27 AM
A secondary question along the same lines; is it possible to get both a linear interpolated and nearest neighbor sample of the same texture in the same fragment? (i.e. without duplicating my 64mb sample)

ARB_sampler_objects allows you to sample the same texture with different filters.

NeXEkho
08-07-2010, 02:34 AM
Hmm, I see, many thanks all round.

hound
08-07-2010, 03:30 AM
Also, a tertiary question. How is a vec3 comparison handled? Do all the elements of a have to be greater than b for a > b to return true or just at least one?

If you want component wise comparison, you can use greaterThan(vec, vec) or lessThan(vec, vec) (et al.) which return a bvec, and any(bvec) or all(bvec) on that.

NeXEkho
08-07-2010, 04:14 AM
ANOTHER additional question (sorry, going offline for two days, don't want to be isolated)

" v2BackfaceCoord = ( ( m4Transform * vec4( v3Vertex, 1.0 ) ).xy * 0.5 + 0.5 ) * v2RenderWindow;"

The idea here is that this should produce the 0...1 screen space coordinates for use with a texture overlay. I'm taking the vertex position, transforming it, extracting the X/Y position, compressing it from -1 to 1 into 0 to 1 and then multiplying it by a uniform that defines how much of the texture is empty space (texture is PO2, screens rarely are)

It doesn't work as expected; the end result is still being influenced by the shape, causing distortions, and also off scale. Any quick suggestions before I go?