Sign in to follow this  
marc0815

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

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this