simple 3D app strictly in J#

simple 3D app strictly in J#

Post by QXZpZCBKIy » Fri, 17 Dec 2004 05:47:11


I've been all over the net and I can't find any tutorials for DirectX in J#.

I know C# has alot of similarities, but I would greatly appreciate a URL to
a website devoted to directx graphics (2D and 3D) in J# only.

Or, if someone could quickly whip up some code on how to get a 3D
environment started in DirectX with J#, I would be very greatful
 
 
 

simple 3D app strictly in J#

Post by George Bir » Sat, 18 Dec 2004 04:53:01

> I've been all over the net and I can't find any tutorials for DirectX in
J#.
to

don't have something for DirectX and J# at the moment, but you might be
interested on idx3d III engine port to J# at
http://www.yqcomputer.com/ ~robgroup/3D/idx3d

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
George Birbilis < XXXX@XXXXX.COM > [Microsoft MVP J#]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ QuickTime VCL and ActiveX controls (for PowerPoint/VB/Delphi etc.)
+ Plugs VCL and ActiveX controls (InterProcess/Internet communication)
+ TransFormations, VB6 forms to ASP.net WebForms convertion
http://www.yqcomputer.com/
+ Robotics
http://www.yqcomputer.com/ ~robgroup
........................................................................

 
 
 

simple 3D app strictly in J#

Post by QXZpZCBKIy » Sat, 18 Dec 2004 06:15:03

The site is fantastic, and i love the link, but somthing with hardware
acceleration would be better for me, since i'm trying to build a fullscreen
3D game in J#. Yes, C++ would be better to use, but i am more familiar with
java, so J# is the language i'd like to use.

Or even OpenGL might work. DirectX or OpenGL in J#, I'd love to be shown
(source code?) how it would be done.
 
 
 

simple 3D app strictly in J#

Post by Lars-Inge » Sun, 19 Dec 2004 06:20:21

gt; I'd love to be shown


Here is something I just wrote for you:
Add a reference to "Microsoft.DirectX" and "Microsoft.DirextX.Direct3D"

( I would recomend C# or VB.net for managed DirectX. )


A J# example to get you started:

import System.Drawing.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
import System.Data.*;

public class Form1 extends System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private Microsoft.DirectX.Direct3D.Device dev = null;
private System.Windows.Forms.Panel panel1;

private System.ComponentModel.Container components = null;

public Form1()
{
InitializeComponent();
this.SetUp();
}


/**
* Setup the DirectX environment.
*/
private void SetUp()
{
Microsoft.DirectX.Direct3D.PresentParameters[] pParams = new
Microsoft.DirectX.Direct3D.PresentParameters[1];
pParams[0] = new Microsoft.DirectX.Direct3D.PresentParameters();

// The DirectX frame will be shown in a window.
pParams[0].set_Windowed( true );
pParams[0].set_SwapEffect(
Microsoft.DirectX.Direct3D.SwapEffect.Discard );

// Setup the display device. We are using software for processing Vertexes
since
// I don't know what your gfx card supports.
dev = new Microsoft.DirectX.Direct3D.Device( 0,
Microsoft.DirectX.Direct3D.DeviceType.Hardware,
this.panel1.get_Handle(),
Microsoft.DirectX.Direct3D.CreateFlags.SoftwareVertexProcessing,
pParams);
}


protected void Dispose(boolean disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
super.Dispose(disposing);
}

#region Windows Form Designer generated code
/**
* Required method for Designer support - do not modify
* the contents of this method with the code editor.
*/
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// button1
//
this.button1.set_Location(new System.Drawing.Point(96, 352));
this.button1.set_Name("button1");
this.button1.set_TabIndex(1);
this.button1.set_Text("button1");
this.button1.add_Click( new System.EventHandler(this.button1_Click) );
//
// panel1
//
this.panel1.set_Location(new System.Drawing.Point(8, 32));
this.panel1.set_Name("panel1");
this.panel1.set_Size(new System.Drawing.Size(328, 280));
this.panel1.set_TabIndex(2);
//
// Form1
//
this.set_AutoScaleBaseSize(new System.Drawing.Size(5, 13));
this.set_ClientSize(new System.Drawing.Size(352, 430));
this.get_Controls().Add(this.panel1);
this.get_Controls().Add(this.button1);
this.set_Name("Form1");
this.set_Text("Form1");
this.ResumeLayout(false);

}
#endregion

/**
* The main entry point for the application.
*/
/** @attribute System.STAThread() */
public static void main(String[] args)
{
Application.Run(new Form1());
}

private void button1_Click (Object sender, System.EventArgs e)
{
// Clear the directX surface with the Aqua color.
this.dev.Clear( Microsoft.DirectX.Direct3D.ClearFlags.Target,
System.Drawing.Color.get_Aqua(), 1.0f, 0);

// Presents the buffer.
dev.Present();

}

}


And here is a J# DirextX sound article I have written.

http://www.codeproject.com/dotnet/DirectSoundJsharp.asp


Regards,
Lars-Inge Tnessen