View Full Version : full screen textured quad
If I want to draw a quad in a pbuffer that fills the entire pbuffer that is textured w/ a slice of a 3d texture, how do I set up the viewport/perspective and texture coords(specifically in the z direction) so that there isn't any distortion? :confused: I thought initially I could do something simple like in the FAQ's(How do I draw a full-screen quad), but I found this to cause some distortion in my final rendering.
Thanks in advance.
I always do this by using glOrtho and I never experienced real problems.
I must say however sometimes it blurs a bit too much. It's probably driver-related.
I would suggest to estabilish a "familar" screen space mapping like the "texture space", but I know most people don't like this idea.
10-25-2004, 02:31 AM
The method described in the FAQ is a good one.
Can you describe more precisely what you mean by "some distortion" ?
I'm using the pbuffer to update a 3d texture(not the same one that I'm reading from). I basically draw a quad textured w/ textureA and use a frag program to modify the output, here is the basic CG frag:
float4 color : COLOR;
frag2app fp_advectPropertyTexture(float3 texCoord0: TEXCOORD,
uniform sampler3D property,
uniform sampler3D velocity,
uniform float3 deltaT)
//look up velocity
float4 v = tex3D(velocity,texCoord);
//calculate modified texcoord
float3 oldCoord = texCoord.xyz -deltaT*v.xyz;
//look up in property w/ dependent look up
float4 oldColorProp = tex3D(property,oldCoord);
//calculate injection value
. . .
//calculate return value by blending injection
//and old value
retColor.color = percentOld*oldColorProp
Anyway, if my velocity is hardcoded to be (0,0,0), and if percentOld = 0, I get expected results, but if percentOld is non zero(positive of course) I get distortion in my updated texture the further I am away from z = .5(texture space). :confused: Ok, basically in the final rendering, w/ the above conditions, my texture is "warped" toward z = .5. So at z = 1, my texture is pulled in the negative direction toward z = .5 and if z = 0 my texture is pulled in the positive direction toward z = .5.
I've been looking at this a while and have basically gutted my code and narrowed the problem down to my pbuffer advection. I think somehow I don't have the viewport or perspective set up correctly or my texcoords in the z direction are specified in correctly.
Sorry for the looooong (probably clear as mud)post, but any help w/ this or insight would be greatly appreciated!
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.