Public Group

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

Recommended Posts

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;

namespace DXChpOne
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

private Device device = null;

//page 9 and 10,  DX Kick Start
public void InitializeGraphics()
{
//Set our presentation parameters
PresentParameters presentParams = new PresentParameters();

presentParams.Windowed = true;

//Create our device
device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams);
}
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "Form1";
this.Text = "Form1";

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
//page 11 DX Kick Start
using (Form1 frm = new Form1())
{
//Show our form and initialize our graphics engine
frm.Show();
frm.InitializeGraphics();
Application.Run(new Form1());
}

}

private void Form1_Load(object sender, System.EventArgs e)
{

}
}
}



Share on other sites
Is there some place online I can lookup these kinds of errors, by the way? :

-2005530516 (D3DERR_INVALIDCALL)

Share on other sites
By the way, I am using the Managed DirectX 9 April 2005 update.

Share on other sites
I'm guessing it's failing because you didn't pass what format you want to use to PresentParameters so try adding this line

presentParams.BackBufferFormat = Format.Unknown;

And to look up what the errors mean you can always take a look at msdn

EDIT: gah! typo

Share on other sites
Quote:
 Original post by setaglibI'm guessing it's failing because you didn't pass what format you want to use to PresentParameters so try adding this linepresentParams.Format = BackBufferFormat = Format.Unknown;And to look up what the errors mean you can always take a look at msdn

One thing that helped (I tried this before realizing you had posted) was to compile in RELEASE mode vs DEBUG. This cleaned-up the problem.

Duh, I should have remembered that DirectX is quirky in DEBUG mode.

Share on other sites
Quote:
 Original post by Tom KnowltonOne thing that helped (I tried this before realizing you had posted) was to compile in RELEASE mode vs DEBUG. This cleaned-up the problem.Duh, I should have remembered that DirectX is quirky in DEBUG mode.

Cool didn't know that it would work without that line.

Anyway, I never had problems in debug mode maybe because I have an older version? [smile]

Share on other sites
The debug mode is trying to warn you that you have done something that is considered unsafe/unwise. It may work in relase mode on your machine, and not work on another. It is always best to eliminate those debug warnings/errors so you know you won't run into problems later.

Share on other sites
Quote:
 Original post by Dave HuntThe debug mode is trying to warn you that you have done something that is considered unsafe/unwise. It may work in relase mode on your machine, and not work on another. It is always best to eliminate those debug warnings/errors so you know you won't run into problems later.

The problem is back. Now, even Release MODE is not making a difference.

The Format line of code would not compile, btw.

What do I do now?

Share on other sites
Why doesn't that line compile what error does it give you?

Did you notice I edited the post? Because I had a little copy/paste trouble there earlier [embarrass]

Share on other sites
Quote:
 Original post by setaglibWhy doesn't that line compile what error does it give you? Did you notice I edited the post? Because I had a little copy/paste trouble there earlier [embarrass]

Ahhhh...yes...I see that you changed the line.

Let me give that a try.

1. 1
2. 2
frob
16
3. 3
4. 4
5. 5

• 13
• 13
• 61
• 14
• 15
• Forum Statistics

• Total Topics
632125
• Total Posts
3004252

×