Direct3D vs. OpenGL: A Comparison
来源:互联网 发布:淘宝卖家数据采集器 编辑:程序博客网 时间:2024/05/02 21:37
Summary
This page is an informal attempt to summarize the main differences between SGI's OpenGL and Microsoft's Direct3D. First, each API is summarized in an attempt to bring a balanced presentation of the two APIs. Then a feature comparison is made between the capabilities of OpenGL and Direct3D.
Unless otherwise noted, "OpenGL" refers to the OpenGL 1.2 core with no extensions and "Direct3D" refers to Direct3D8, the Direct3D interface in DirectX 8. When a difference between Direct3D7 and Direct3D8 is noteworthy, version numbers are given.
Intended Audience
This document assumes that the reader is familiar with the architecture of a traditional 3D graphics pipeline as commonly used with scanline rendering techniques. For more information on such architectures, the reader is encouraged to consult a 3D graphics text such as "3D Computer Graphics" by Alan Watt and Mark Watt. This is only one book of many 3D graphics books, the interested reader is encouraged to browse a good technical bookstore and find one that speaks to them most effectively.
SGI's OpenGL
SGI's OpenGL is a procedural 3D graphics API, the successor to Iris GL which originated in the unix workstation market. Iris GL is the graphics API used on a succession of 3D graphics workstations designed and built by Silicon Graphics, Inc.
"OpenGL" is a trademark of the OpenGL Architectural Review Board (ARB). The ARB controls the definition of OpenGL through control of the specification by which an implementation may call itself "OpenGL". The specification is an English prose document with associated mathematics that define the semantics of the API. The ARB also governs a suite of conformance tests that serve as a validation suite for an implementation.
The ARB was formed in 1992 and functions under a set ofbylaws to revise and oversee the specification of the API.
OpenGL defines a state machine that controls the rendering pipeline. State machine attributes are modified through procedure calls and vertices defining graphic primitives are specified to the pipeline through procedure calls.
Only the OpenGL 1.2 core is considered in this document, not extensions.
Microsoft's Direct3D
Microsoft's Direct3D is aCOM based 3D graphics API originating in a third-party 3D graphics API for x86 architectures. Microsoft acquired the technology in 1996 and has been offering the API as a component of its DirectX technology. Direct3D contains an immediate-mode interface and a strctured hierarchical scene graph interface called retained mode. Only the immediate-mode interface is considered in this document.
Microsoft defines the Direct3D API through its COM interfaces, and the semantics are defined by the the help files and sample code accompanying the software development kit provided by Microsoft.
Direct3D first appeared in DirectX 3 with execute buffers as its display paradigm. All subsequent releases, beginning with DirectX 5 (there was no DirectX 4), replaced execute buffers with a more traditional graphics primitive display paradigm.
Feature Comparison
OpenGL and Direct3D both expose a traditional graphics rendering pipeline. This basic pipeline design has been present since the earliest days of computer graphics and has been enhanced and extended over the years as hardware has become more capable, but the fundamental paradigm has not changed.
Vertices are described to the pipeline as a bundle of data consisting of coordinates in space defining the vertex's location and associated per-vertex data. A graphics primitive is described to the pipeline as an ordered set of vertices. How vertices are combined into various primitives -- generally points, lines and triangles -- is defined by the particular API.
Rather than provide an exhaustive list of features where both OpenGL and Direct3D provide the same feature, I will list the differences.
Notes:
- Two-sided lighting can be emulated by an application that desires two-sided polygon surfaces. First, the application sets the pipeline to cull back facing polygons and draws the front side of all two-sided polygons. Next, the pipeline is set to cull front facing polygons and the application draws the back side of all two-sided polygons.
- Access to the Z buffer is provided, but the values stored in the Z buffer are hardware dependent.
- Picking can be done entirely in the application by traversing its own data structures.
- OpenGL provides software emulation when hardware cannot accomodate the requested feature to guarantee that a rendering feature will exist. Direct3D exposes extensive information about hardware capabilities and lets the application determine how to obtain the requested feature.
- OpenGL provides an extension mechanism for an implementation to expose additional features not yet adopted by the ARB. Direct3D7 has one implementation with no extension mechanism. Direct3D8 has one implementation and provides support for pluggable software devices.
- An open source sample implementation of OpenGL is available. Microsoft's Windows 2000 DDK (driver development kit) contains the reference rasterizer for Direct3D 7.
- Multisampling is provided Direct3D8, but not as an accumulation buffer. This allows Direct3D8 to perform full-screen antialiasing, depth of field and motion blur effects without providing an accumulation buffer.
- Hierarchical display lists are not provided by Direct3D, but Direct3D does provide storage for polygon vertices and vertex indices to avoid data copying. These are flat array-like storages consisting only of geometry data and no state changes. State changes may be aggregated into state blocks for efficient transmission to the device. Neither state blocks, nor index buffers nor vertex buffers are hierarchical.
- Point and line width attributes can be emulated by drawing textured triangles (for points) or quadrilaterals (for lines) when the size of the point or line is significant. This also provides the application with more control over the exact rendering of these large points and thick lines. This additional control over rendering may be important for OpenGL applications even though OpenGL provides point and line rendering attributes.
- OpenGL's specification, while still being an English prose specification, is more rigorously defined than Direct3D.
- Direct3D8 provides software emulation for vertex processing (blending, vertex shaders, fixed-function vertex processing, etc.), but not for pixel processing (pixel shaders, multitexturing, etc.).
- Windows NT 4 only supports DirectX 3.
- Multitexture cascade is provided in OpenGL 1.2 through an ARB extension. While still an extension and not part of the official 1.2 core, it is expected to be widely implemented as it is a "standard" extension and not a vendor extension.
- Programmable pixel shading is provided by some vendors in OGL through the register combiner vendor extension.
In several aspects, a comparison between OpenGL and Direct3D is similar to a comparison betweenOpenGL and PEX. Many of the same differences exist for Direct3D.
- Direct3D vs. OpenGL: A Comparison
- Direct3D vs. OpenGL: A Comparison
- Direct3D vs OpenGL的尾声
- A Comparison of Push vs Pull Ajax
- Performance Comparison: Disk Images vs LVM in a Xen Environment
- SQLite vs MySQL vs PostgreSQL: A Comparison Of Relational Database Management Systems
- Direct3D和OpenGL
- Direct3D与OpenGL
- OpenGL Direct3D(DirectX)区别
- A Comparison of Push vs Pull Ajax:Ajax推送与拉取方式的比较
- MySQL Engines: InnoDB vs. MyISAM – A Comparison of Pros and Cons
- 增量备份与差异备份的区别(Incremental vs. differential backup: A comparison)
- Java vs .Net security comparison
- SVN vs CVS quick comparison
- C vs Java Complete Comparison
- Singleton //OGRE: A 3D library for OpenGL and/or Direct3D
- OpenGL、Direct3D资源链接[转]
- Direct3D与OpenGL的博弈
- 青春划过指尖
- OpenCV在Ubuntu上的安装及《Learning OpenCV》书例编译
- Mesa 3D概述
- PHP 'header()' HTTP Header Injection Vulnerability
- cascade与fetch
- Direct3D vs. OpenGL: A Comparison
- java十大调试技巧
- 借我一生
- ZABBIX 'itemid' Parameter SQL Injection Vulnerability
- [struts2] struts 中页面访问出错怎样定位到错误页面
- 图片加载的几种模式
- 黑马程序员-对eclipse代码补全功能原理的猜想及实验(对反射技术的一些使用)
- 七夕夜、离别,涵情经河岸
- SVN 常用的命令