Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group computer graphics & visualization Practical Course SS07 Global Illumination Effects / C# Introduction
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Organizational… everybody here, who is supposed to be here? who else is here? Schedule: - - Tue. 11:30 – Question time (Thursday 10:30-12:00 )? If you have a question: - - forum - - question time appear in person
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group.NET Framework: Objectives To provide: To ensure : Consistent object-oriented programming environment no matter how the locally stored object code is executed: (locally, locally but Internet-distributed, or remotely). Code-execution environment that: − − minimizes software deployment and versioning conflicts, − − promotes safe execution of code, − − eliminates the performance problems of scripted/interpreted environments. Integrability of the.NET Framework code with any other code according to industry standards.
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group.NET Framework in context
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group DotNet, CLR, MSIL, C# … etc. See VB.NET Quellcode C# Quellcode Andere.NET-fächige Sprache C++ Quellcode Andere nicht.NET-fächige Sprache Unmanaged code Managed code MSIL-code VB.NET Compiler C# Compiler VC++ Compiler 7.0 Microsoft Intermediate Language (MSIL) [DATEI] Just-In-Time-Compiler (JIT) (Teil der Common Language Runtime) Native Code [RAM] Managed code Managed code Managed code Native Code (NativeImage) [Datei] Native Code [Datei] Betriebssystem Compiler
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Java (J2EE) vs..NET: Performance
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Java (J2EE) vs..NET: Portability Java – – Multi platform (available for every OS) – – „Not really“ multi language.NET – – „Not really“ multi platform ( ROTOR, MONO) – – Multi Language (C++, C#, J#, Basic, Delphi …)
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Java (J2EE) vs..NET: Future Java – – well established – – a lot of applications already exist (including Applets).NET – – Microsoft's choice for Windows Longhorn (XP) – – a lot of applications are ported to.NET
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Native Code vs..NET: Performance Native Code, the compiler – – usually compiles everything only once – – has much time to optimize code – – has no idea of the target machine – – can’t do runtime optimization on it’s own.NET, the JIT … – – compiles every USED method ONCE per program execution – – needs to be fast – – knows the target machine well – – knows the program’s behavior See:
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Let‘s get started … you need: – – Windows XP/2003 (Windows ME/98/2000 not supported) – –.NET Framework 1.1 (SDK not needed) – – Visual Studio 2003, 2005 Use the systems in our lab!!!
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group C#... C# is a type-safe object-oriented language. Curly-brace syntax is very similar to C, C++ or Java. C# syntax simplifies many of the complexities of C++. C# provides powerful features: - - nullable value types, enumerations, delegates, anonymous methods and direct memory access. - - supports generic methods and types, and iterators. C# supports encapsulation, inheritance and polymorphism. A class may inherit directly from one parent class, but it may implement any number of interfaces. In C#, a struct is a „lightweight class“, which can implement interfaces but does not support inheritance.
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group C#... Use process "Interop." to interact with other Windows software (e.g. COM objects, native Win32 DLLs). „Interop.“ enables C# programs to do just about anything that a native C++ application can do. C# supports pointers and the concept of "unsafe" code (for those cases in which direct memory access is absolutely critical). C# build process is simple (vs. C, C++), flexible (vs. Java). There are no separate header files, and no strict order for methods and types. A C# source file may define any number of classes, structs, interfaces, and events.
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group C#: new constructs Encapsulated method signatures called delegates, which enable type-safe event notifications. Properties, which serve as accessors for private member variables (set/get). Attributes, which provide declarative metadata about types at run time. Inline XML documentation comments.
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Hello World using System; namespace HelloWorldApplication { /// /// This class is really boring since it only prints „Hello World“ /// class HelloWorld { /// /// The Main Method is the entry point for the app /// [STAThread] static void Main(string[] args) { Console.WriteLine("Hello World"); }
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Hello World Form using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace HelloWorldForm { public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Label label1; private System.ComponentModel.Container components = null; public Form1() { InitializeComponent(); label1.Text = "Hello World"; } protected override void Dispose( bool disposing ) { if( disposing ) if (components != null) components.Dispose(); base.Dispose( disposing ); }
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Hello World Form (cont.) private void InitializeComponent() { label1 = new System.Windows.Forms.Label(); SuspendLayout(); label1.Location = new System.Drawing.Point(164, 68); label1.Name = "label1"; label1.TabIndex = 0; label1.Text = "label1"; AutoScaleBaseSize = new System.Drawing.Size(5, 13); ClientSize = new System.Drawing.Size(420, 158); Controls.Add(label1); Name = "Form1"; Text = "Hello Application"; ResumeLayout(false); } [STAThread] static void Main() { Application.Run(new Form1()); }
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Java (J2EE) vs..NET: Code words ms-help://MS.VSCC.2003/MS.MSDNQTR.2004JAN.1033/dncenet/html/tchCJavaComparingProgrammingLanguages.htm#tchCJavaKeywordComparison C# KeywordJava Keyword Basesuper Boolboolean Isinstanceof locksynchronized namespacepackage readonlyconst sealedfinal usingimport internalprivate :extends :implements Not Supported by C# native transient
computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group References — — mework.de/dotnet/DOTNET_Framework_Einfuehrung.asp — —E. Schanzer, Performance Considerations for Run-Time Technologies in the.NET Framework, Microsoft Corporation, August — —S. T. Kachru, On the Relative Advantages of Teaching Web Services in.NET vs. J2EE, Master Thesis, North Carolina State University, Aug — —J2EE and.NET Application Server and Web Services Benchmark, Middleware company, Oct — —J2EE and.NET (Reloaded) Yet Another Performance Case Study, Middleware company, Jun — —H. Mössenböck, Introduction to C#, University of Linz, Austria. — —H. Mössenböck, Advanced C#, University of Linz, Austria. — —D. Marshall, Visual C# 2005: The Language, Microsoft Press, — —Microsoft Visual Studio 2005 Documentation — —...