Skip to main content
gamedev.net
🔒 Locked

Weird texture problem !

Started by Juksosah May 22, 2006 at 6:59 PM 3 replies 750+ views
Original Post
Juksosah
Juksosah
A weird thing is happening here... I loaded a texture using D3DXCreateTexFromFile.. or something like that and rendered some lines (using linestrips) on the screen. It worked fine. Then I wanted to change the texture (so basically all i've done in my code is changing the texture's filename) and the new texture showd up properly but my lines were gone ?!? I switched back to the old texture and the lines were back again... Any explanations ? the lines are rendered after the texture
jollyjeffers
jollyjeffers
A little bit more information might be useful. Your description doesn't have much in the way of details [smile]

If you're rendering 2D geometry/images then its likely to be draw-order dependent (not sure if ID3DXLine supports Z/depth values, even if thats what you're using...)

You say you're changing your textures... does that mean you're creating/loading a new IDirect3DTexture9 or are you Release()'ing and re-using the same one?

A bit more of an explanation - some pseudo code for example - might help us give you a better answer...

Cheers,
Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |
Demus79
Demus79

Your lines are actually having UV coordinates ?

If not, is your texture having alpha channel and you have alpha blending/testing enabled. This might lead to a situation where the texture alpha keeps the lines from being rendered.
Juksosah
Juksosah
Ok I was in a hurry...

//I wanted to change wMan4.jpg for another jpg.//When I changed the filename, the line then dissapeared.if (c1->initialise(d3dDevice, "wMan4.jpg") != D3D_OK){	return debug::erreur(rslt, __LINE__, __FILE__, "CreateVeffailed.");}


A little bit of initialise function...

	rslt = pDevice->CreateVertexBuffer ( NB_VERTICES * sizeof(BASEVERTEX),			D3DUSAGE_WRITEONLY, D3DFVF_BASEVERTEX, D3DPOOL_DEFAULT, &vertexBuffer, NULL);	if (imageFile){		rslt=D3DXCreateTextureFromFileEx(pDevice, imageFile, D3DX_DEFAULT, D3DX_DEFAULT,								  D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED,								  D3DX_DEFAULT, D3DX_DEFAULT, /*0*/0xFFFFFFFF, ∈, NULL, &texture);			if (FAILED(rslt)){			return D3DObject::erreur(rslt, __LINE__, __FILE__, "CreateTexture() failed.");		}		}	pDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER );	pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);


My FVF for the lines is D3DFVF_BASEVERTEXLINE (D3DFVF_XYZ | D3DFVF_DIFFUSE)

FOr the textures it's D3DFVF_BASEVERTEX (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1)
Juksosah
Juksosah
No my lines don't have UV coordinates.

Of course the lines are for debugging/visual helping purpose only, but right now I need to see them !

And no I don't create another IDirect3DTexture9 nor realising it.

All I do is changing the filename used to create the texture
So basically in my scene there is one textured quad and a bunch of lines.

I ran the program once with let's say a boat image on the quad.
Lines were showing up properly.

I changed the filename (ex : from boat.jpg to cat.jpg) in my code, compiled and ran it again.
But all I saw was a cat, and no lines :(


That's it.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.