Contents

[hide]

Introduction

GFX an abstract graphics layer designed to reside above graphics APIs such as Direct3D and OpenGL. GFX related files can be found in the engine/gfx directory, which are explained more thoroughly in the GFX Engine Tour document. Unlike TGE's rendering layer, GFX features more advanced rendering tech (shaders, vertex and primitive buffers, etc).

GFX2

GFX2 is the next generation of GFX developed by Torque R&D, and integrated into the TGEA 1.8 update. GFX2 features compatibility with Mac OS X, GLSL and HLSL shader support, state blocks, shader constant buffers, and several other rendering improvements. Porting tips and a list of changes can be found in the TGEA 1.8 Porting Guide (WIP).

Platform Support

As mention above, versions TGEA 1.8 and above include Mac OS X compatibility. GFX wraps around multiple rendering systems that are handled automatically for you, the developer. When working in the engine, you will want to focus on the source code that related to your target platform:

  • Windows - GFX->D3D8 and GFX->D3D9 for rendering. For input, window management, and general Windows components, are handled by platformWin32, windowManager->win32, and a few other folders that will be detailed in the GFX Engine Tour.
  • Mac OSX - GFX->gl handles rendering. platformMac and windowManager->mac handle input, window management, and other Mac components.

Key Concepts

If you are new to TGEA or general Torque Technology, you are encouraged to read through the available documentation for TGEA and other engines. For GFX, you should be familiar with the following:

  • SDK - A Software Development Kit is typically a collection of tools and APIs that focus on developing applications for a particular framework/hardware/OS. An example would be DirectX SDK, which includes all of the APIs and debugging tools used in developing Windows games.
  • API - An Application Programming Interface is a collection of functions, classes, and systems dedicated to supporting a specific feature. An example would be DirectX's Direct3D, which is used for rendering.
  • DirectX (http://msdn.microsoft.com/en-us/directx/default.aspx) - A collection of APIs which handle rendering, input, audio, and other forms of media interaction. DirectX is commonly what drives game and video programming on Microsoft's operating systems. Example DirectX APIs are Direct3D (D3D), DirectInput, and so on. DirectX developers must use the DirectX SDK to develop a Windows game. The SDK contains all of the DirectX APIs, including the runtime libraries and source headers.
  • OpenGL(http://www.opengl.org/) - OpenGL stands for Open Graphics Library. This powerful, cross-platform API is used for low-level rendering of 2D and 3D graphics. Adding OpenGL to TGEA 1.8 is what allows the engine to run on Mac OSX
  • Shaders - Shaders are part of the DirectX and OpenGL rendering systems. A shader file contains a set of instructions that get passed to the GPU along with the 3D data it will affect. Both OpenGL and DirectX have their own shader languages, both of which are handled by TGEA's GFX. Examples of shaders include motion blur, reflection, bloom, bump mapping, and other advanced rendering effects. Shaders are typically written in a high level shading language based on C programming.
  • GLSL - OpenGL Shader Language is a high level shading language utilized by OpenGL to create and render shaders in a game.
  • HLSL (http://msdn.microsoft.com/en-us/library/bb509561(VS.85).aspx) - High Level Shader Language is used by DirectX for creating and displaying shaders in a game. Using HLSL, you can create C like programmable shaders for the Direct3D pipeline.
  • Textures and Materials - A texture is typically an image file mapped to a polygon or shape, which provides color and detail to the model. TGEA materials are used to wrap texture and shader information into a single object.
  • Vertex Buffer - A vertex buffer object contain various types of data, such as vertex arrays, which can be cached in high-performance graphics memory on the server.

Important Links

TGEA Documentation Page

OpenGL Home Page

DirectX Home Page

Conclusion

This doc is just a high level description of GFX. From here, you can proceed however you want. However, it is highly recommended you proceed to the next section (GFX Engine Tour) if you are new to TGEA, GFX, or rendering code in general.