PDA

View Full Version : cg runtime + ogl



ryan
09-12-2003, 05:25 PM
I'm having the weirdest problem. I am blending 2 passes, both with a simple single texture setup (just for testing purposes). If I use the basic opengl rendering for both passes, they blend fine. However, if I combine a simple vertex program pass (activated via the Cg runtime) with a standard pass, I get something that resembles z-fighting. ( if I use glBindProgramNV or I use Cg to bind a program to BOTH passes, this doesn't happen)....hmmmmm, anyone know of any reason why this could be happening? http://www.cse.unsw.edu.au/~ryana/problem.jpg

basic code:
glDepthFunc(GL_LEQUAL);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ZERO);
.
. //tex binding
draw_surf(floor_plane); //just using immediate mode
glDepthFunc(GL_EQUAL);
glBlendFunc(GL_DST_COLOR, GL_ZERO);
.
. //tex binding
draw_surf_cg(floor_plane); //draw with cg bound vertex program

ryan
09-12-2003, 05:30 PM
i think i may have to end up pissing off the cg runtime and doin all the program stuff manually...which is kinda annoying..ah well, I'd still like to know what the problem is.

CatAtWork
09-12-2003, 08:41 PM
Position invariance needs to be enabled for your CG programs.

Mixing vertex programs with the fixed function pipeline leads to small differences in the final position unless you specifically state that the vertex program is position invariant.

ryan
09-12-2003, 10:20 PM
ahh...thank you!!...looking that up in the cg users manual revealed the problem. Thank you again, this will prevent some more hair tearing episodes.