c# - XNA weird terrain tearing -


let me post images first...

solid shot tearing occurs enter image description here

and wireframe shot of place enter image description here

i using using riemers tutorial while render code is..

main render

    public void render()     {         device.clear(color.cornflowerblue);         rasterizerstate rs = new rasterizerstate();         rs.cullmode = cullmode;         rs.fillmode = fillmode;         device.rasterizerstate = rs;          effect.parameters["xview"].setvalue(camera.viewmatrix);         effect.parameters["xprojection"].setvalue(camera.projectionmatrix);         effect.parameters["xworld"].setvalue(matrix.identity);         effect.parameters["xenablelighting"].setvalue(true);         effect.parameters["xlightdirection"].setvalue(lightdirection);         effect.parameters["xambient"].setvalue(0.5f);          globals.game.terrain.render();          globals.game.spritebatch.begin();         globals.console.render();         globals.game.spritebatch.end();     } 

terrain.render()

    public void render()     {         globals.game.graphics.effect.currenttechnique = globals.game.graphics.effect.techniques["colored"];          globals.game.graphics.effect.parameters["xworld"].setvalue(worldmatrix);         foreach (effectpass pass in  globals.game.graphics.effect.currenttechnique.passes)         {             pass.apply();              globals.game.graphics.device.indices = indexbuffer;             globals.game.graphics.device.setvertexbuffer(vertexbuffer);             globals.game.graphics.device.drawindexedprimitives(primitivetype.trianglelist, 0, 0, vertices.length, 0, indices.length / 3);                    }     } 

i stuck problem pretty long (not knowing if caused coding skills, xna or g-card configuration...) wonder if have ideas might cause it?

temporarily comment out spritebatch begin, draw, & end code , see if makes difference. may or may not depending on vertex order in buffer.

if help, solution can found here: http://blogs.msdn.com/b/shawnhar/archive/2010/06/18/spritebatch-and-renderstates-in-xna-game-studio-4-0.aspx


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -