Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 558217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:06:31+00:00 2026-05-13T12:06:31+00:00

I’ve been having difficulty identifying the correct parameters for the PresentParameters and DirectX device,

  • 0

I’ve been having difficulty identifying the correct parameters for the PresentParameters and DirectX device, so that there can be both vertex-level gouraud shading and the use of a z buffer. Some triangle meshes work fine, others have background triangles appearing in front of triangles which are closer-to-camera.

An example of this is found here: http://gallery.me.com/robert.perkins/100045/zBufferGone. The input data is a simple list of vertices in facets. The winding order of the vertices in each facet is nondeterministic (comes from various CAD software export functions) and there is no normals data.

The PresentParameters are being set up right now as follows. I realize this is C# instead of C++ but I think it’s descriptive enough, and the parameters pass through to C++ code. This produces the image in the picture; the behavior is the same on the Reference device:

             pParams = new PresentParameters()
                    {
                        BackBufferWidth = this.ClientSize.Width,
                        BackBufferHeight = this.ClientSize.Height,
                        AutoDepthStencilFormat = Format.D16,
                        EnableAutoDepthStencil = true,
                        SwapEffect = SwapEffect.Discard,
                        Windowed = true
                    };
            _engineDX9 = new EngineDX9(this, SlimDX.Direct3D9.DeviceType.Hardware, SlimDX.Direct3D9.CreateFlags.SoftwareVertexProcessing, pParams);

            _engineDX9.DefaultCamera.NearPlane = 0;
            _engineDX9.DefaultCamera.FarPlane = 10;
            _engineDX9.D3DDevice.SetRenderState(RenderState.Ambient, false);
            _engineDX9.D3DDevice.SetRenderState(RenderState.ZEnable, ZBufferType.UseZBuffer);
            _engineDX9.D3DDevice.SetRenderState(RenderState.ZWriteEnable, true);
            _engineDX9.D3DDevice.SetRenderState(RenderState.ZFunc, Compare.Always);
            _engineDX9.BackColor = Color.White;
            _engineDX9.FillMode = FillMode.Solid;
            _engineDX9.CullMode = Cull.None;

            _engineDX9.DefaultCamera.AspectRatio = (float)this.Width / this.Height;

All of my other setup attempts, even on the reference device, return a COM error code ({“D3DERR_INVALIDCALL: Invalid call (-2005530516)”}). What are the correct setup parameters?

EDIT: The C++ class which interfaces with DirectX9 sets defaults like this:

PresentParameters::PresentParameters()
{
    BackBufferWidth = 640;
    BackBufferHeight = 480;
    BackBufferFormat = Format::X8R8G8B8;
    BackBufferCount = 1;

    Multisample = MultisampleType::None;
    MultisampleQuality = 0;

    SwapEffect = SlimDX::Direct3D9::SwapEffect::Discard;
    DeviceWindowHandle = IntPtr::Zero;
    Windowed = true;
    EnableAutoDepthStencil = true;
    AutoDepthStencilFormat = Format::D24X8;
    PresentFlags = SlimDX::Direct3D9::PresentFlags::None;

    FullScreenRefreshRateInHertz = 0;
    PresentationInterval = PresentInterval::Immediate;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:06:31+00:00Added an answer on May 13, 2026 at 12:06 pm

    Where does it return an invalid call?

    Edit: I’m assuming in the new EngineDX9 call? Have you tried setting a device window handle in the present parameters?

    Edit 2: Have you turned on the debug spew in the DirectX control panel to see whether it tells you what the error is?

    Edit3: You have tried setting backbufferWidth and Height to 0? What is backbuffercount set to? Might also be worth trying “Format.D24S8” on the backbuffer? Its “possible” your graphics card doesn’t support 16-bit (unlikely though). Have you checked in the caps that the mode you are trying to create is valid? I asssume, btw, that the CLR language you are using automagically sets the parameters you don’t set to 0? I,personally, always prefer to be explicit in such cases ….

    PS I’m guessing here because im a native C++ DX9 coder not a CLR SlimDX coder …

    Edit4: I’m sure its the lack of window handle … I’m probably wrong but thats the only thing i can see REALLY wrong with your setup. A windowed DX9 device requires a window. Btw set width and height to 0 to just use the window you are setting the device too’s size …

    Edit 5: I’ve really been heading down the wrong route here. There is nothing wrong with the creation of the device that produced your “incorrect” device. Do not mess with the present parameters they are fine. The main reason you’ll have problems with your Z-Buffering is that you set the compare function to always. This means that, regardless of what the z-buffer contains, pas the pixel and write its z into the z-buffer overwriting whatever is there already. I’d wager therein lies your Z-buffering problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 308k
  • Answers 308k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Documentation says use this inside the ServiceInstall element: <util:PermissionEx User="Everyone"… May 13, 2026 at 9:48 pm
  • Editorial Team
    Editorial Team added an answer I would go with adding the XML resource inside the… May 13, 2026 at 9:48 pm
  • Editorial Team
    Editorial Team added an answer Lots of the solution here seems to be overkilled. Here… May 13, 2026 at 9:48 pm

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.