🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Display lists and Vertexshader: do i have to set the Matrix for each object in list?

Started by
0 comments, last by lc_overlord 18 years, 3 months ago
Hi, i have a displaylist with some objects in it, but if i use this vertexshader on them they all objects are moved to(0,0,0). this is the code for static void Display() { CGparameter mvp = cgGetEffectParameterBySemantic(effect, "ModelViewProjection"); assert(mvp); cgGLSetStateMatrixParameter(mvp, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY); [...] CGpass pass = cgGetFirstPass(technique); while (pass) { cgSetPassState(pass); drawGeom(); cgResetPassState(pass); pass = cgGetNextPass(pass); } the Problem is, the ModelView Projection is changed in draw() where i have a display list with some translated/rotated objects. Do i have to change the CGparameter for each Object in my list? the shader: float4x4 mvp : ModelViewProjection; float4x4 mv : ModelView; float4x4 mvit : ModelViewIT; float3 Color = float3(0,1,0); float4 vertex(uniform float4x4 modelViewProj, uniform float4x4 modelView, uniform float4x4 modelViewIT, float4 P : POSITION, float4 N : NORMAL, float2 uvIn : TEXCOORD0, out float4 CC : COLOR0, out float3 Pcam : TEXCOORD1, out float3 Ncam : TEXCOORD2, out float2 uv : TEXCOORD0) : POSITION { CC.xyz = P;//.5 * Color.xyz + .5 * normalize(N.xyz); Pcam = mul(modelView, P); Ncam = mul(modelViewIT, N); uv = uvIn; return mul(modelViewProj, P); } technique VertexProgram { pass { VertexProgram = compile arbvp1 vertex(mvp, mv, mvit); DepthFunc = lequal; } } thx for your help.
Advertisement
Never ever use displaylists unless you can't help it, they are just bad.
Without them it will become much easier to get the correct matrix.

This topic is closed to new replies.

Advertisement