Sign in to follow this  
ramy

small simple problem

Recommended Posts

Hello everybody i load a model via Mesh clas, and from file method. and it loads the textures and everything. and it gets drawn on screen. the problem is, i have lines arround that model that gets drawn as well. the lines are set to yellow color, and the lights in SetRenderState are false. and i have the lines as black color. and when i remove the model( i.e. not render it), the lines appear as yellow. I realize then when i dont render the textures in the model the lines appear a yellow as well. any body knows the problem, i an on managed directx april, but that wont make a difference. thx in advanced. ramy

Share this post


Link to post
Share on other sites
hi ramy
Although your problem needs a bit more explanations (like the way you're rendering lines, the FVF used), because the way you're rendering your lines can affect on the answer, but I think there should be something related to the texture stages which sometimes cause similar problems, of course it's always better to use normals in your FVF and enable the lights, it may help the problem.

visit our site on game development: galaxyroad.com which is currently in persian, but soon will have english contents too.

Share this post


Link to post
Share on other sites
well here are some more explanations.

before i render the model the lines render corrently as shown below:

[URL=http://img78.echo.cx/my.php?image=withoutmodel8hc.jpg][IMG]http://img78.echo.cx/img78/1277/withoutmodel8hc.th.jpg[/IMG][/URL]

with model, lines are rendered as following:

[URL=http://img78.echo.cx/my.php?image=wrong2kr.jpg][IMG]http://img78.echo.cx/img78/2135/wrong2kr.th.jpg[/IMG][/URL]

now... the lines i render corrently without the model, i set the VertexFormat (aka FVF) correctly, as Position and Diffuse for collor.

public Vector3 Position;
public uint Diffuse;
public const VertexFormats Format = VertexFormats.Position | VertexFormats.Diffuse;

now, i didnt do anything with textures concerning the model.

i.e. i didnt set any texture stages nor nothing.

does any of information helps?

Share this post


Link to post
Share on other sites
for lines rendered correctly :

http://img78.echo.cx/my.php?image=withoutmodel8hc.jpg


for lines rendered incorrectly with model:

http://img78.echo.cx/my.php?image=wrong2kr.jpg.


why do i have to set the textures back to NULL when i render them?

Share this post


Link to post
Share on other sites
Because the vertices used for the lines don´t have UV-coordinates? I never tried what would happen if I´d render some vertices that don´t have a UV-coordinate-set with a texture, but black polygons / lines could well be the result... So, if you set your texture back to NULL, you should get correct line color.

Share this post


Link to post
Share on other sites
Quote:
Original post by ramy
Thx, setting the texture to NULL solved the problem, but i dont get why settign the texture to NULL solved it :S


It solved the problem because it was using whatever texture was set last on your line; in this case, the texture for the model. What you did, was explicitly say, "I don't want to use a texture". It showed up black, I'm guessing, for a couple reasons: no UV's, the part of the texture that was drawn was black, the line has no normals, etc.

Matt Hughson

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