Skip to main content
gamedev.net
🔒 Locked

Render error

Started by xpload Jan 21, 2007 at 3:54 PM 1 replies 450+ views
Original Post
xpload
xpload
Hello everyone, I have the following problem: as I rend a line, the color I specify (blue, but all other colors share the same faith) does not appear, and the line is red instead. I suspect the problem comes either from the D3DXRenderToSurface interface I use, or I do not set the render states correctly. Here is the exact procedure, that is used in the program, so you don't need to read 1000 pages code: -first set the render state and texture parameters: Device->SetTextureStageState( 0, D3DTSS_COLOROP , D3DTOP_SELECTARG1 ); Device->SetTextureStageState( 0, D3DTSS_COLORARG1 , D3DTA_TEXTURE ); Device->SetTextureStageState( 0, D3DTSS_ALPHAOP , D3DTOP_SELECTARG1 ); Device->SetTextureStageState( 0, D3DTSS_ALPHAARG1 , D3DTA_TEXTURE ); Device->SetRenderState( D3DRS_ALPHABLENDENABLE, true ); Device->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA ); Device->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA ); -then rend some textures on the screen -create D3DXRenderToSurface object and begin scene -create vertex buffer and load vertex data -call SetStreamSource and SetVertexShader( D3DFVF_XYZRHW | D3DFVF_DIFFUSE ) -call to DrawPrimitive -release vertex buffer -end scene and present It would be really great if someone could help as the book I read about DirectX really sucks :( Should I somehow un-set the texture or render state? P.S. I mentioned, that if I comment the call to Device->SetTexture() while rendering textures, the problem disappears. Strange...
Namethatnobodyelsetook
Namethatnobodyelsetook
I'm assuming you're passing the blue in the color in your vertices, but you've setup the rasterizer to ignore that color, and to use texture, and nothing but texture... however your vertices have no UVs, so D3D won't know what to do with the texture. It will likely just fetch the top left corner for the entire line.

Change the colorarg1 (and alphaarg1) to D3DTA_DIFFUSE and it will draw in the vertex color.
xpload
xpload
Thank you for helping me for the second time :) This must have been exactly the problem...

Topic Locked

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

Sign in to reply to this topic.