OpenGL in Visual C++.NET



Similar documents
How To Use An Amd Graphics Card In Greece And (Amd) With Greege (Greege) With An Amd Greeper 2.2.

Affdex SDK for Windows!

CS222: Systems Programming

QNX Software Development Platform 6.6. Screen Graphics Subsystem Developer's Guide

Android Architecture. Alexandra Harrison & Jake Saxton

Simple Image File Formats

Computer Graphics Hardware An Overview

Image Synthesis. Transparency. computer graphics & visualization

Application Power Management for Mobility

Input and Interaction. Project Sketchpad. Graphical Input. Physical Devices. Objectives

Low power GPUs a view from the industry. Edvard Sørgård

Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg

Lecture 1 Introduction to Android

Input and Interaction

First Steps with CoDeSys. Last update:

Optimizing AAA Games for Mobile Platforms

Practical Data Visualization and Virtual Reality. Virtual Reality VR Software and Programming. Karljohan Lundin Palmerius

INSTALL NOTES Elements Environments Windows 95 Users

OpenGL & Delphi. Max Kleiner. 1/22

How To Develop For A Powergen 2.2 (Tegra) With Nsight) And Gbd (Gbd) On A Quadriplegic (Powergen) Powergen Powergen 3

Lab 7 Keyboard Event Handling Mouse Event Handling

UniFinger Engine SDK Manual (sample) Version 3.0.0

Silverlight for Windows Embedded Graphics and Rendering Pipeline 1

MetroPro Remote Access OMP-0476F. Zygo Corporation Laurel Brook Road P.O. Box 448 Middlefield, Connecticut 06455

Eliminate Memory Errors and Improve Program Stability

The Real-Time Operating System ucos-ii

Introduction to LogixPro - Lab

Freescale Semiconductor, I

Experiences with 2-D and 3-D Mathematical Plots on the Java Platform

Version: July Windows 7

Creating a 2D Game Engine for Android OS. Introduction

OpenGL R Graphics with the X Window System R (Version 1.4)

Embedded Component Based Programming with DAVE 3

Android and OpenCV Tutorial

CLOUD GAMING WITH NVIDIA GRID TECHNOLOGIES Franck DIARD, Ph.D., SW Chief Software Architect GDC 2014

User Manual. 3-Heights PDF Producer API. Version 4.6

x64 Servers: Do you want 64 or 32 bit apps with that server?

Introduction to Computer Graphics

Input and Interaction. Objectives

An Overview of Java. overview-1

Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details

The OpenGL Framebuffer Object Extension. Simon Green. NVIDIA Corporation

Sources: On the Web: Slides will be available on:

Development of Java ME

Publishing Geoprocessing Services Tutorial

Touchstone -A Fresh Approach to Multimedia for the PC

Hetero Streams Library 1.0

Creating OpenGL applications that use GLUT

Compiler Setup and DirectX/OpenGL Setup

Scan-Line Fill. Scan-Line Algorithm. Sort by scan line Fill each span vertex order generated by vertex list

OPERATING SYSTEM SERVICES

How to resize, rotate, and crop images

Computer Graphics on Mobile Devices VL SS ECTS

NVIDIA IndeX Enabling Interactive and Scalable Visualization for Large Data Marc Nienhaus, NVIDIA IndeX Engineering Manager and Chief Architect

CSE 564: Visualization. GPU Programming (First Steps) GPU Generations. Klaus Mueller. Computer Science Department Stony Brook University

LittleCMS: A free color management engine in 100K.

SIMATIC. WinCC V7.0. Getting started. Getting started. Welcome 2. Icons 3. Creating a project 4. Configure communication 5

MS Active Sync: Sync with External Memory Files

Using NSM for Event Notification. Abstract. with DM3, R4, and Win32 Devices

Using C# for Graphics and GUIs Handout #2

EDIUS 7 EDIT ANYTHING

AMD s 10-bit Video Output Technology

Using the Game Boy Advance to Teach Computer Systems and Architecture

GPU Profiling with AMD CodeXL

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

ANDROID INTRODUCTION TO ANDROID

Image Acquisition Toolbox Adaptor Kit User's Guide

Visualizing Data: Scalable Interactivity

Creating a More Secure Device with Windows Embedded Compact 7. Douglas Boling Boling Consulting Inc.

Intel Extreme Graphics 2 User s Guide for Version 14.x Driver Releases

Mocean Android SDK Developer Guide

Chapter 7 Event Log Overview

WinCC. Configuration Manual. Manual Volume 2

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

ACE: After Effects CS6

Software documentation systems

Stress Testing Technologies for Citrix MetaFrame. Michael G. Norman, CEO December 5, 2001

Communities. Best Practices Implementing Salesforce.com Communities. ForceBrain.com

NVPRO-PIPELINE A RESEARCH RENDERING PIPELINE MARKUS TAVENRATH MATAVENRATH@NVIDIA.COM SENIOR DEVELOPER TECHNOLOGY ENGINEER, NVIDIA

Geomagic Design. Release Notes. Get to Market Faster with Better Products at a Lower Cost V17

AMD GPU Architecture. OpenCL Tutorial, PPAM Dominik Behr September 13th, 2009

UML - Getting Started EA v4.0

Game Programming with Groovy. James Sr. Software Engineer, BT/Ribbit

How to Develop Accessible Linux Applications

AMD RenderMonkey IDE Version 1.71

Understanding Operating System Configurations

COMMANDtrack. Service Bulletin 2.7 Release Date: September 13, New Functionality. Application CR Description

An Introduction to Android

Logging. Working with the POCO logging framework.

ITG Software Engineering

Wireless Device Low-Level API Specification

Analytics Configuration Reference

Programming with the Dev C++ IDE

Portal Connector Fields and Widgets Technical Documentation

Transcription:

OpenGL in Visual C++.NET Chang-Chieh Cheng Medical Image Processing Lab, Dept. of Computer Science, NCTU

Win32 API What is Win32 API: It is designed for use by C/C++ programs and is the most direct way to interact with a Windows system for software applications. Lower level access to a Windows system, mostly required for device drivers, is provided by the Native API in current versions of Windows. Categories Base Services Graphics Device Interface User Interface Common Dialog Box Library Common Control Library Windows Shell Network Services 2

Handle What is Handle? A four-byte integer used to identify a wide variety of objects. Handles refer to an internal data structure not accessible to Windows applications which contain information about an object. Common Handles HWND Handle to a window. HDC Handle to a device context (DC). HBITMAP Handle to a bitmap. HFILE Handle to a file. H??? Handle to???. 3

Procedures: Create a window Get HWND. Get HDC. Choose a Pixel Format Set the Pixel Format. Create a OpenGL rendering context (HGLRC). Makes a specified OpenGL rendering context(hglrc) the calling thread's current rendering context(hdc). HGLRC HDC Rendering 4

Environment configuration Create a new Windows Form Application Project. 5

In VC++.NET 2005 Common Language Runtime Support(/clr) 6

Environment configuration Library link opengl32.lib glut32.lib glu32.lib 7

Header include #include <GL/glut.h> #include <GL/gl.h> #include <GL/glu.h> 8

Create a window Form: form1 PictureBox: picturebox1 All init procedures in Constructor of Fom1 or Form1_load() event 9

Get HWND of picturebox1 HWND hwnd = (HWND)pictureBox1->Handle.ToInt32(); Get HDC of picturebox1 HDC hdc = GetDC( hwnd ); 10

Choose a Pixel Format for picturebox1 API: ChoosePixelFormat The ChoosePixelFormat function attempts to match an appropriate pixel format supported by a device context to a given pixel format specification. int ChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR * ppfd // pixel format for which a best match is sought ); 11

Choose a Pixel Format for picturebox PIXELFORMATDESCRIPTOR pfd = { sizeof(pixelformatdescriptor), // size of this pfd 1, // version number PFD_DRAW_TO_WINDOW PFD_SUPPORT_OPENGL PFD_DOUBLEBUFFER, // double buffered PFD_TYPE_RGBA, // RGBA type 32, // 32-bit color depth 0, 0, 0, 0, 0, 0, // color bits ignored 0, // no alpha buffer 0, // shift bit ignored 0, // no accumulation buffer 0, 0, 0, 0, // accum bits ignored 32, // 32-bit z-buffer 0, // no stencil buffer 0, // no auxiliary buffer PFD_MAIN_PLANE, // main layer 0, // reserved 0, 0, 0 // masks ignored }; int nformat = ChoosePixelFormat( hdc, &pfd ); 12

Set the Pixel Format API:SetPixelFormat The SetPixelFormat function sets the pixel format of the specified device context to the format specified by the ipixelformat index. BOOL SetPixelFormat( HDC hdc, int ipixelformat, // pixel format index (one-based) CONST PIXELFORMATDESCRIPTOR * ppfd // pointer to logical pixel format specification ); if(!setpixelformat( hdc, nformat, &pfd )) MessageBox::Show("Set Pixel Format Error", "Error"); 13

Create a OpenGL rendering context API: wglcreatecontext The wglcreatecontext function creates a new OpenGL rendering context, which is suitable for drawing on the device referenced by hdc. The rendering context has the same pixel format as the device context. HGLRC wglcreatecontext( HDC hdc); HGLRC hrc = wglcreatecontext( hdc ); 14

HGLRC HDC API: wglmakecurrent The wglmakecurrent function makes a specified OpenGL rendering context the calling thread's current rendering context. All subsequent OpenGL calls made by the thread are drawn on the device identified by hdc. You can also use wglmakecurrent to change the calling thread's current rendering context so it's no longer current. BOOL wglmakecurrent( HDC hdc, HGLRC hglrc); if (wglmakecurrent( hdc, hrc ) == false) MessageBox::Show("wglMakeCurrent Error", "Error"); 15

Rendering Render function is called when Timer expires, Mouse moved, Keyboard Pressed.or other event is triggered. If app has more than one render target(picture box), the wglmakecurrent(hdc, hglrc) must be called before render function. 16