Jump to content
  • Advertisement
Sign in to follow this  

SlimDx, Directx9 tearing, Nvidia, windowed mode, small form size

This topic is 2987 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

Hello all!

I'd like to start by apologizing if this is off-topic and out of context, in that case please close the topic and ignore :)

Today I've moved to SlimDX to (re)create a simple DX9 application that I had made in the past using Managed DX, a text-scroller.

I found it very easy to get this up and running in SlimDX:

using System;
using System.Drawing;
using System.Windows.Forms;
using SlimDX;
using SlimDX.Direct3D9;
using SlimDX.Windows;

namespace SlimScroller
static class Program
static void Main()
var form = new RenderForm("SlimScroller");
form.ClientSize = new Size(800, 70);

var d3dpp = new PresentParameters();
d3dpp.BackBufferWidth = form.ClientSize.Width;
d3dpp.BackBufferHeight = form.ClientSize.Height;
d3dpp.PresentationInterval = PresentInterval.One;

var device = new Device(new Direct3D(), 0, DeviceType.Hardware, form.Handle, CreateFlags.HardwareVertexProcessing, d3dpp);

var fontSprite = new Sprite(device);
var font = new SlimDX.Direct3D9.Font(device, 100, 0, FontWeight.Bold, 0, false, CharacterSet.Default, Precision.Default, FontQuality.ClearTypeNatural, PitchAndFamily.DontCare, "tahoma");
var intXPos = new int();

MessagePump.Run(form, () =>
device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Blue, 1.0f, 0);

intXPos = intXPos - 3; //move the text across the screen to the left
if (intXPos < -500) { intXPos = 800; }; //reset to restart text

font.DrawString(fontSprite, "Hello there Hello there Hello there Hello there Hello there Hello there", new Rectangle(0, -17, 1200, 200), DrawTextFormat.Left, Color.Yellow);
fontSprite.Transform = Matrix.Translation(intXPos, 0, 0.5f);


foreach (var item in ObjectTable.Objects)


I have ran this application on Windows 7 with ATI graphics-hardware, runs fine. On Intel-graphics hardware, fine also. But on Nvidia hardware, terrible tearing occurs in the text, more or less like in this picture (it's not an actual screenshot though):


Tried multiple Nvidia PC's, running different Nvidia cards, all have this issue, while ATI Radeon cards do not. I tried reinstalling a clean Windows 7 with nothing installed besides graphic cards drivers (over Windows Update) + latest DX9 redistributable (June 2010) + latest SlimDX redistributable (June 2010) but even then the tearing occurs.

Increasing the form size (vertically) seems to help. It just does not like the small vertical form/backbuffer size of only 70px.

Does anyone of you have any ideas regarding this or how to fix it?

Thanks for reading!

[Edited by - AplDrm on October 13, 2010 5:45:11 PM]

Share this post

Link to post
Share on other sites
I tried enforcing vSync on in the nvidia control panel, didn't help.

What I do not understand is why this tearing happens in a small form only - extending the form size to a height of, say, 200px, and the tearing is gone. That is not an option for me though.

Maybe someone that is on W7 + Nvidia is willing to copy/paste the code into Visual Studio (I used 2010, add a reference to SlimDX and it should run) to see if I am just very unlucky with my Nvidia tests so far?

Share this post

Link to post
Share on other sites
I'm on a NVIDIA QuadroFX, and I don't see any of the tearing. It might be an issue with your drivers or card.

Since you're on Windows 7, try using DeviceEx and Direct3DEx to get D3D9Ex support, which works better on Windows Vista and up. This might solve your problem.

Share this post

Link to post
Share on other sites
This also happens to be a Quadro FX 370 I am testing on now (though had this on other Nvidia cards as well such as a few from the Geforce 8000 series)

Tried switching to DeviceEx and Direct3DEx, didn't solve it.

I did do a discovery though. The tearing only occurs when running the (clean install of) W7 in the Classic mode (Aero turned off). When Aero is running tearing does not occur.

(edit: to be more precise, basic Aero still does not cut it, the transparency effects have to be enabled, as soon as that's on, tearing is gone)

Not sure how running in Aero or not would affect DirectX 9 in this way though.

[Edited by - AplDrm on October 13, 2010 5:07:30 PM]

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!