473,587 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to construct a surface in VC# with the help of DirectX?

look up your timezome settings... you have future posted.
Nov 16 '05 #1
4 2181
I have not understood your answer. Explain, please, your answer more in
detail.

Dr. Zharkov V.A., Moscow, Russia.
Nov 16 '05 #2

Hello. I have installed on my computer Visual Studio 2005 Beta and DirectX
9.0 SDK Update - (Summer 2004). I have developed projects Visual C#, Visual
Basic and Visual C++ for construction of 3-Dimensional geometrical bodies,
surfaces and lines of a level of these surfaces without use of DirectX, and
now I want to make the same with use of DirectX.

Inform, please, where it is possible to find an example of construction of a
geometrical body or a surface z = f(x, y), for example, part of sphere on
Form1 in project Visual C# or Visual Basic, or Visual C++, Windows
Application

from Visual Studio of version (.NET) 2002 or (.NET) 2003, or 2004, or 2005

with the help of DirectX 9.0?

Beforehand many thanks for your answer.

Dr. Zharkov V.A., Moscow, Russia.

"Dr. Zharkov" <va************ @mtu-net.ru> wrote in message
news:ut******** ******@TK2MSFTN GP15.phx.gbl...
I have not understood your answer. Explain, please, your answer more in
detail.

Dr. Zharkov V.A., Moscow, Russia.

Nov 16 '05 #3
You need to
1. Set up a device

internal void initGraphics()
{
// Set our presentation parameters, set up the Direct3D device
presentParams = new PresentParamete rs();
presentParams.W indowed = true;
presentParams.S wapEffect = SwapEffect.Disc ard;
presentParams.D eviceWindow = this.portalPane l; //the subclass of Form you
are drawing on .

//set up z buffer so that near objects obscure far objects.
//If graphics card does not support we are in trouble here.
presentParams.E nableAutoDepthS tencil = true;
presentParams.A utoDepthStencil Format = DepthFormat.D16 ;
// Store the default adapter
int adapterOrdinal = Manager.Adapter s.Default.Adapt er;
CreateFlags flags = CreateFlags.Sof twareVertexProc essing;
Caps caps = Manager.GetDevi ceCaps(adapterO rdinal, DeviceType.Hard ware);
// Do we support hardware vertex processing?
if (caps.DeviceCap s.SupportsHardw areTransformAnd Light)
// Replace the software vertex processing
flags = CreateFlags.Har dwareVertexProc essing;
// Do we support a pure device?
if (caps.DeviceCap s.SupportsPureD evice)
flags |= CreateFlags.Pur eDevice;
flags = CreateFlags.Har dwareVertexProc essing; //better be there...

try
{
// Create our device
device = new Device(adapterO rdinal, DeviceType.Hard ware,
this.portalPane l, flags, presentParams);
}
catch
{
if (device != null)
device.Dispose( );
MessageBox.Show ("unable to create device");
clearFlags = ClearFlags.Targ et;
presentParams.E nableAutoDepthS tencil = false;
presentParams.A utoDepthStencil Format = DepthFormat.D16 ;
}
}

2. Set up a buffer that contains triangles whose vertices are on the
surface. If the triangles are small enough you get a reasonable
approximation to the surface. Alternatively, you can just render points on
the surface (but this will not give you lighting effects). You can render a
list of lines as well.
device.BetginSc ene();
device.DrawUser Primitives(Prim itiveType.Trian gleList, triangleCount,
renderBuffer);
device.EndScene ();
device.Present( );

where renderBuffer contains your list of triangles.

You also need code to set the position of the camera, the position of the
lights, and to set up matrices for transforming from object space to model
space to world coordinates. All in all in might be 30-40 lines of code.
Something like:

device.RenderSt ate.Ambient = Color.DarkBlue; device.RenderSt ate.CullMode =
Cull.CounterClo ckwise;

device.RenderSt ate.Lighting = true;

device.Lights[0].Type = LightType.Direc tional;

device.Lights[0].Diffuse = Color.LightBlue ;

device.Lights[0].Direction = new Vector3(0, 0, -1);

device.Lights[0].Commit();

device.Lights[0].Enabled = true;

device.Transfor m.World = worldTransform;

device.Transfor m.Projection =

Matrix.Perspect iveFovLH(camera .fieldOfView, camera.aspectRa tio,

camera.nearPlan e, camera.farPlane );

device.Transfor m.View =

Matrix.LookAtLH (camera.positio nV, camera.targetPo sition,

camera.up);
I recommend the book "Managed DirectX 9", byTom Miller which has many
examples. Reading the documentation for the above mentioned functions (in
the DirectX 9 SDK) will help as well.




"Dr. Zharkov" <va************ @mtu-net.ru> wrote in message
news:eV******** ******@TK2MSFTN GP10.phx.gbl...

Hello. I have installed on my computer Visual Studio 2005 Beta and DirectX
9.0 SDK Update - (Summer 2004). I have developed projects Visual C#,
Visual
Basic and Visual C++ for construction of 3-Dimensional geometrical
bodies,
surfaces and lines of a level of these surfaces without use of DirectX,
and
now I want to make the same with use of DirectX.

Inform, please, where it is possible to find an example of construction of
a
geometrical body or a surface z = f(x, y), for example, part of sphere on
Form1 in project Visual C# or Visual Basic, or Visual C++, Windows
Application

from Visual Studio of version (.NET) 2002 or (.NET) 2003, or 2004, or 2005

with the help of DirectX 9.0?

Beforehand many thanks for your answer.

Dr. Zharkov V.A., Moscow, Russia.

"Dr. Zharkov" <va************ @mtu-net.ru> wrote in message
news:ut******** ******@TK2MSFTN GP15.phx.gbl...
I have not understood your answer. Explain, please, your answer more in
detail.

Dr. Zharkov V.A., Moscow, Russia.


Nov 16 '05 #4
Dear Mr. Fred Mellender.

Many thanks for your answer.

In projects Visual C#, Windows Application (from Visual Studio 2005) on the
Form1 I have constructed all six examples from Tutorial 1-6 (DirectX 9.0 SDK
Update - Summer 2004, Direct3D). On the Form1 with the help of Tutorial 4 I
have constructed the rotating cylinder.

Inform, please, as it is necessary to change the program in Tutorial 4, that
instead of the cylinder the sphere rotated?

Beforehand many thanks for your answer.

Dr. Zharkov V.A., Moscow, Russia.
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1626
by: Dr. Zharkov | last post by:
Hello. I have installed on my computer Visual Studio 2005 Beta and DirectX 9.0 SDK Update - (Summer 2004). I have developed projects Visual Basic, Visual C# and Visual C++ for construction of 3-Dimensional geometrical bodies, surfaces and lines of a level of these surfaces without use of DirectX, and now I want to make the same with use of...
7
36798
by: kastillo | last post by:
Im trying to install directx 9.0 c , but i simply cant . When i run the installer it just says " The installed components are ready to use". This is the report on directx.log : 09/10/05 23:24:44: dsetup32: === SetupForDirectX() start === 09/10/05 23:24:44: dsetup32: DXSetupCommand = 0. 09/10/05 23:24:44: DXSetup: DSetupCallback(): Phase =...
0
242
by: Dr. Zharkov | last post by:
Hello. I have installed on my computer Visual Studio 2005 Beta and DirectX 9.0 SDK Update - (Summer 2004). I have developed projects Visual C# for construction of 3-Dimensional geometrical bodies, surfaces and lines of a level of these surfaces without use of DirectX, and now I want to make the same with use of DirectX. Inform, please,...
9
7477
by: Mike P | last post by:
Problems, problems... Im trying to create DirectX Projects within C# and to also look at the latest DirectX C# Samples. I have just installed MS Visual C# .net Standard Edition on my Windows XP Pro PC and I then installed the full DirectX 9.0 SDK (Summer 2004) & then the latest DirectX 9.0 SDK (Feb 2005) Spent several hours doing all...
0
2933
by: Harvey Cohen | last post by:
Hello all, I have some C# code that implements calls to DirectX.DirectSound. It compiles under both VS .NET 2003 and VS 2005 and runs under VS .NET 2003 and VS 2005 on a Compaq laptop (Windows XP Home), a Dell Xeon workstation (Windows XP Pro) and a Gateway GM 825 (Windows XP Media Center). It also runs on the Dell and the Compaq under VS...
14
2640
by: Jessica Weiner | last post by:
I am writing an application in C# which need to plot graphs and simple shapes (polygons, circles, squares etc). Which library is better for this purpose and why? Thanks.
1
1979
Nasenbaer
by: Nasenbaer | last post by:
Hi I read some articles about my problem. But in most cases no code is attached. My question is how to put my Bitmap into a DirectX Surface using Vb.Net. I want to put it in DirectX and stretch it there into double size. Thanks for examples. http://www.thescripts.com/forum/thread362107.html
0
1756
by: Jameson | last post by:
ok... This isn't working, and I dont know why, when I pass the resulting surface to StretchRectangle I get the awsome "error in application" haha... anyway. Is this not the right way (using .Net 3.5 runtime and the latest DirectX Dev Kit form March) to turn a bitmap into a surface? Public Function img2surface(ByVal img As Bitmap) As...
7
2099
by: Jameson | last post by:
ok... This isn't working, and I dont know why, when I pass the resulting surface to StretchRectangle I get the awsome "error in application" haha... anyway. Is this not the right way (using .Net 3.5 runtime and the latest DirectX Dev Kit form March) to turn a bitmap into a surface? Public Function img2surface(ByVal img As Bitmap) As...
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5713
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.