small simple problem

Started by
7 comments, last by matthughson 18 years, 11 months ago
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
Advertisement
Sounds all really vague. Maybe an image would clear up a lot?

Greetz,

Illco
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.
Visit galaxyroad.com which soon will have english contents too
well here are some more explanations.

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

withoutmodel8hc.th.jpg

with model, lines are rendered as following:

wrong2kr.th.jpg

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?

I can't really see what's in the pictures because they are so small. Are you setting the texture back to NULL before you render the lines?
Chris ByersMicrosoft DirectX MVP - 2005
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?
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.
Thx, setting the texture to NULL solved the problem, but i dont get why settign the texture to NULL solved it :S

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
__________________________________[ Website ] [ Résumé ] [ [email=contact[at]matthughson[dot]com]Contact[/email] ][ Have I been Helpful? Hook me up! ]

This topic is closed to new replies.

Advertisement