State changes made by ID3DXLine?

I'm using Direct3D 9 to draw an layered interface with extensive alpha blending. To draw antialiased lines I use the ID3DXLine interface, which works fine to me.

Problem is that if I call ->SetAntialias(true) on my line interface, alphablending stops working for any sprites drawn with ID3DXSprite afterwards. But If I draw a line without antialiasing it starts working again. I'm no expert on 3D and D3D, but I cannot seem to detect any texture state changes or render state changes made by the interface, and I don't know what to fix

I can get around the problem by drawing the line twice, one time with antialiasing and one time without (with zero alpha) but I'd rather have a proper solution. I don't have this problem on all computers, ie it seems to work fine on my stationary but not on my laptop that uses an older graphics board.

Any ideas on how to get around this




Answer this question

State changes made by ID3DXLine?

  • Marius F

    Works on Ref and doesn't work on HW means either you're relying on a feature that is not supported by your device, or a driver bug.

  • jamesofthedead

    Ok, I managed to do the analysis with PIX. But the changes in render state don't seem to have any impact. I've tried to add some state changes within ->Begin and ->End of ID3DXSprite, and it does affect the appearance but I haven't been able to correct the problem.

    My images are in fact alphablended, but onto a black background instead of the back buffer if I've previously drawn an antialiased line with ID3DXLine. Which means that some of my images get a black frame (but not in a randomized fashion). As usual it works fine again as soon as I draw an aliased line with ID3DXLine.

    I use ID3DXSprite for drawing plain bitmaps with an alpha channel. Alpha modulation + color modulation works fine. From what I've understood, the ID3DXSprite and the ID3DXLine interfaces should be taking care of all state changes necessary (and also restore the previous state).

    I'd blame the old Radeon Mobility card in my laptop, if it wasn't for the fact that I'm able to correct the problem quite easily by always drawing a dummy aliased line before using ID3DXSprite. If I do this, everything works perfectly.

    /hee00awa

    Edit:
    I should add that I have no problems with the visibility of the antialiased lines. The lines look fine, it's just bitmaps drawn with ID3DXSprite directly afterwards that are affected.

    Edit again:
    It's bound to SINGLE WIDTH ANTIALIASED lines only. If I add 0.001 to the line width, the problem goes away. Also, It only affects the first sprite drawn afterwards. I.e. a call to ID3DXLine::Draw with an antialiased line with the exact width of 1 does something to the alphablending on the next sprite drawn through ID3DXSprite, on my ATI Radeon. The Begin/Ends of my ID3DXSprite/ID3DXLine interfaces are not nested in any way.



  • Fergal_OC

    I've compared all texture stage states and all render states before and after, and they match. It looks fine when rendered through REF. For now, I'm just going to add 0.1 to the line width of all my lines, and try the software on some other hardware too.

    Thanks
    hee00awa


  • MrJP

    Capture two frames with PIX. One that draws lines with anti-aliasing and the other one doesn't. Copy the states used for drawing your sprite in both cases and compare them against each other to see what's different.
    Also, if you suspect your card's driver, then you can always run your program in RefRast to see if it gives the same results...

  • donnie100

    Use PIX on your executable to find out what states are affecting your sprites. You can easily step into your frame and watch all the current device states at the time of a certain DrawPrimitive*() call...


  • State changes made by ID3DXLine?