[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

C# + DirectX

Posted on 2004-03-22
4
Medium Priority
?
336 Views
Last Modified: 2008-02-01
Hey
Do u know anything in DirectX

this is my code and its generating error
localDevice.SetDisplayMode(1024, 768, 16, 0, false);
localDevice.SetCooperativeLevel(owner, CooperativeLevelFlags.Fullscreen);

and it gives me error

Values do not fall within expected range

what do u think is the prob

thanks
0
Comment
Question by:Pushkar_00
2 Comments
 
LVL 4

Expert Comment

by:Jarodtweiss
ID: 10652045
Hey !
I'm just a beginner with Managed DirectX but for info :

public void SetDisplayMode(
    int width,
    int height,
    int bitPerPixel,
    int refreshRate,
    bool standardVgaMode
);

So I bet your problem comes from your 0 --> try 60 for example, standard refresh rate !
0
 

Accepted Solution

by:
RafeWoo earned 80 total points
ID: 10656452
Hi,

I think passing in 0 as the refresh rate just uses the default refresh rate of your monitor. Anyway my program works just fine passing in zero.

It could be that your graphics card does not support 1024x768 at 16 bit.

As a quick test try 640X480 at 32 bits.

Failing that try enumerating the modes that your card does support:


DisplayModesCollection modes = new DisplayModesCollection(localDevice);
           
foreach(SurfaceDescription desc in modes)
{
  //harvest the information in some way
   //relevant fields are desc.Width , desc.Height , desc.PixelFormatStructure.RgbBitCount                
}
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question