Original Post
Howdy all. I''ve found examples of doing reflection/ refraction via cube maps and vertex programs, all implimeted in D3D.
I''ve been trying to do the same process in Opengl, but have been coming up short, as the object''s texture is just coming up blank.
Here''s my vertex program. Can anyone see a problem?
also, for rendering, i''m simply enabling NV_VERTEX_PROGRAM, and then passing 0,0,0 into glVertex3f (because it gets overwritten)
Any ideas?
~Main
==
Colt "MainRoach" McAnlis
Programmer
www.badheat.com/sinewave
/* c[0]-c[3] Modelview Projection Matrix c[16]-c[19] ModelView Matrix c[5] Camera Position 5 c[20] Refract_Amt */ //# Transform position DP4 o[HPOS].x, v[0], c[0]; DP4 o[HPOS].y, v[0], c[1]; DP4 o[HPOS].z, v[0], c[2]; DP4 o[HPOS].w, v[0], c[3]; //# Get world space vertex position DP4 R0.x, v[0], c[16]; DP4 R0.y, v[0], c[17]; DP4 R0.z, v[0], c[18]; DP4 R0.w, v[0], c[19]; //# Transform normal to world space DP3 R9.x, v[NRML], c[16]; DP3 R9.y, v[NRML], c[17]; DP3 R9.z, v[NRML], c[18]; //# Need to re-normalize normal DP3 R9.w, R9, R9; RSQ R9.w, R9.w; MUL R9, R9, R9.w; //# Get vector from eye to vertex ADD R1, R0, -c[5]; DP3 R3.w, R1, R1; RSQ R3.w, R3.w; MUL R3, R1, R3.w; //# Calculate E - 2*(E dot N)*N DP3 R5, R3, R9; ADD R4, R5, R5; MAD o[TEX0].xyz, R9, -R4, R3; MOV o[TEX0].w, c[0].x;