Jump to content
  • Advertisement
Sign in to follow this  
FMDGames

Coloured Quad Problem

This topic is 4486 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to display a quad which is white, and i have a background which is black (or textured if skybox is drawn). I can see everything else in game. The problem is i cannot see my quad. I know my vertex layout should work since i tested it manually on a seperate project before i touched this. Im using FVF: D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1 and my triangles:
//locked the buffer etc
top = 0.0f;
left = 0.0f;
width = 400.0f;
height = 100.0f;

TLVERTEX V[6] =
	{
		{left, top, 1.5f, 1.0f, D3DCOLOR_XRGB(128, 128, 128),},	//Vertex 1 - Red	(250, 100)
		{(left+width), 0.0f, 1.5f, 1.0f, D3DCOLOR_XRGB(128, 128, 128),},	//Vertex 2 - Green	(400, 350)
		{(left+width), (top+height), 1.5f, 1.0f, D3DCOLOR_XRGB(128, 128, 128),},	//Vertex 3 - Blue	(100, 350)
		{(left+width), (top+height), 1.5f, 1.0f, D3DCOLOR_XRGB(128, 128, 128),},
		{left, (top+height), 1.5f, 1.0f, D3DCOLOR_XRGB(128, 128, 128),},
		{left, top, 1.5f, 1.0f, D3DCOLOR_XRGB(128, 128, 128),},
	};

Ive disabled lighting and can't think what else to do. I've tried commenting out camera control lines but no avail. If you need any more details let me know.
//Rendering code for quad
Gfx.pD3DDevice9->SetRenderState(D3DRS_LIGHTING, false);
Gfx.pD3DDevice9->SetMaterial(Mtrls);
Gfx.pD3DDevice9->SetStreamSource(0, Quad,0, sizeof(TLVERTEX));
Gfx.pD3DDevice9->SetFVF(D3DFVF_TLVERTEX);
Gfx.pD3DDevice9->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);

Thanks for any hints :)

Share this post


Link to post
Share on other sites
Advertisement
you could try disabling the z-buffer before drawing the quad.
or maybe reverse the winding order of the verts, coz it might be facing away from camera.

Share this post


Link to post
Share on other sites
i've tried disabling the zbuffer, and occusion culling is disabled also, so i dont understand why it is not visible. I dont think the order is a problem, at least it wasnt in my test application :|

Share this post


Link to post
Share on other sites
Nope, that didn't seem to make any difference either. I tried it with 1.5f as a test but it was originally set to 1.0f and i replaced them to 1.0f again.

Share this post


Link to post
Share on other sites
Quote:
Original post by FMDGames
i've tried disabling the zbuffer, and occusion culling is disabled also, so i dont understand why it is not visible. I dont think the order is a problem, at least it wasnt in my test application :|


I think greenwire didn't mean occlusion culling, but simple culling! (set D3DRS_CULLMODE to D3DCULL_NONE)

kp

Share this post


Link to post
Share on other sites
Sorry, thats what i meant, not good with descriptions sometimes. I relatively new to this sort of stuff :)

Share this post


Link to post
Share on other sites
Hi,

you should try these then:
cullmode: none
zenable, zwriteenable: false
lighting: false
alphablendenable: false

also, have a good look at the transformations you use! (world, view, proj) make sure your quad is really on the screen!

I use the following transforms when doing a billboard with RHW:
int width, height;
p_rView->GetSizeInPixels(width, height);
D3DXMatrixOrthoLH(&matOrtho, (float)width, (float)height, 0.0f, 1.0f);
D3DXMatrixIdentity(&matIdentity);

guard.SetTransform(D3DTS_PROJECTION, &matOrtho);
guard.SetTransform(D3DTS_WORLD, &matIdentity);
guard.SetTransform(D3DTS_VIEW, &matIdentity);



kp

Share this post


Link to post
Share on other sites
I didnt have any success with that. I do think its something to do with the transformations, since im setting them for my space objects. I tried the code which you used but that didn't seem to work either. I did note that the projection transformation code was only in the initialization and not in the render loop, so it caused the whole screen to go dull?

So im still very confused at the moment :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!