Contents User Forum Source Index APIs by Task APIs by Level Data


Upgrade Guide

Notes for upgrading from G3D 6.xx to 7.xx:


New Widget/GEvent delivery

The event system now maintains a ranking of all GModules. The module at the top of the ranking may optionally have "focus", which is a useful concept for 2D gui elements. Modules are rendered in the opposite of the event delivery order, so that for 2D rendering the highest priority module appears on top. The 6.xx priority system for event delivery has been removed entirely.


include structure changes

Most programs should now have include <G3D/G3DAll.h>. This is because the directory structure has changed for header files from 6.xx. The goal of the change was to bring G3D into line with other OS X and Linux libraries and to help with integration with 3rd party libraries like ODE. This new structure should allow easier porting of applications between operating systems. The new directory structure for headers is:

include
   G3D/
     G3D.h
     G3DAll.h
   GLG3D/
     GLG3D.h
     GL/
       gl.h
   zlib.h
   png.h
   jpeglib.h


WinMain

Win32 programs must call the macro G3D_START_AT_MAIN(); at top-level (e.g., right before defining your main function), if they do not define WinMain themselves. G3D_START_AT_MAIN() does nothing on other programs, so it is safe to always add this to the file in which you defined main.


GApp changes

A number of changes have been made to GApp. Most notable - onGraphics now takes three arguments: onGraphics(RenderDevice* rd, Array<PosedModelRef> &posed3D, Array<PosedModel2DRef> &posed2D).
Similarly important is the removal of GApplet support. Programs that were defined with a parallel structure using GApplets should be restructured. See the chopper network demo for an example of how to set up an Applet-like structure for programs where you may be having trouble making the switch.
DebugController and DebugCamera have been renamed DefaultController and DefaultCamera.
A number of fields that defined debug behavior are more easily accessible, as part of the GApp class; for example, showRenderingStats and showDebugText.
Other behaviors are definable in a similar fashion, such as escapeKeyAction, which is an enumerated type (Action) and can be set to Action::ACTION_NONE, Action::ACTION_QUIT, or Action::ACTION_SHOW_CONSOLE.


SDLK_ is gone

G3D 7.00 replaced SDL event types with G3D event types. The change affecting the most users is that SDLK_* is now GKey::*. Other changes include KMOD_* to GKEYMOD_*.


Accessors (functions with "get" in the name)

All 6.xx functions with "get" in the name that accepted no arguments were renamed to just the part of the name after "get". Example: G3D::CoordinateFrame::getLookVector is now G3D::CoordinateFrame::lookVector You will see errors like: error C2039: 'getLookVector' : is not a member of 'CoordinateFrame'


GApp::main now returns int

You will see errors like the following, indicating that you need to upgrade your code: error C2555: 'Appmain': overriding virtual function return type differs and is not covariant from 'G3DGApp::main'


Can't find X11/Xlib.h

Delete your ~/.icompile file; the newest version of iCompile (0.5.0) is not compatible with the old files.


G3D::GCamera::project now returns the depth buffer value and not -1/z in the z-component.


ALL CAPS Vector, Color, Matrix constants

The all-caps constants have been renamed to lower-case static functions. Example: G3D::Color3::RED is now G3D::Color3::red(). You will see errors like: error C2039: 'WHITE' : is not a member of 'Color3'


G3D::NetMessage is gone

G3D::ReliableConduit::send, G3D::ReliableConduit::receive, G3D::LightweightConduit::send, and G3D::LightweightConduit::receive now accept any class that has serialize and deserialize methods. There is no need for a NetMessage base class. To replace this now unnecessary base class, you can add the following to your program:
namespace G3D { class NetMessage { public: virtual ~NetMessage(); };}


Network send with no arguments is gone

You must now send at least a message type; you cannot send a message with no content.


GApplet methods not called/compile time errors

The names of the GApplet methods changed, e.g., from "doGraphics" to "onGraphics". The old method names have been configured to create compile time errors to help you catch bugs. These will appear as:
error C2555: 'BrowsedoGraphics' : overriding virtual function differs from 'G3DGApplet::doGraphics' only by return type or calling convention


SDL event codes replaced with G3D ones

For example, SDL_QUIT is now GEventType::QUIT. This may produce errors in your code like:
error C2065: 'SDL_QUIT' : undeclared identifier


Renamings

6.xx7.xx
G3D::crc32G3D::Crypto::crc32
G3D::CFontG3D::GFont
G3D::CImageG3D::GImage
G3D::CImageG3D::GImage
G3D::System::getTickG3D::System::time
G3D::System::getLocalTimeG3D::System::getLocalTime
G3D::Color3::WHITEG3D::Color3::white
G3D::Vector3::ZEROG3D::Vector3::zero
G3D::Vector3::UNIT_YG3D::Vector3::unitY
G3D::randomG3D::uniformRandom()
G3D_PIG3D::pi()
G3D_HALF_PIG3D::halfPi()
G3D_TWO_PIG3D::twoPi()
G3D::RenderDevice::supportsTextureFormatGLCaps::supports
G3D::FirstPersonManipulator::doSimulationG3D::FirstPersonManipulator::onSimulation
G3D::GApplet::doGraphicsG3D::GApplet::onGraphics
G3D::GApplet::doNetworkG3D::GApplet::onNetwork
G3D::GApplet::doLogicG3D::GApplet::onLogic
G3D::GApplet::cleanupG3D::GApplet::onCleanup
G3D::computeNormalMapG3D::GImage::computeNormalMap
G3D::Box::getCornerG3D::Box::corner
G3D::Sky::createG3D::Sky::fromFile
G3D::UserInput::appHasFocusG3D::GWindow::hasFocus
G3D::PosedModelWrappercontrib/PosedModelWrapper
G3D::TextureManagercontrib/TextureManager
G3D::GAppSettingsG3D::GApp::Settings
G3D::Texture::ParametersG3D::Texture::Settings
G3D::Texture::maxAnisotropyG3D::Texture::settings().maxAnisotropy
G3D::Texture::getInterpolateModeG3D::Texture::settings().interpolateMode
G3D::Texture::getWrapModeG3D::Texture::settings().wrapMode
G3D::Texture::wrapModeG3D::Texture::settings().wrapMode
G3D::Texture::parametersG3D::Texture::settings
G3D::GWindowSettingsG3D::GWindow::Settings
G3D::Texture::NO_INTERPOLATIONG3D::Texture::NEAREST_NO_MIPMAP
G3D::MD2Model::createG3D::MD2Model::fromFile
G3D::MeshAlg::Edge::brokenG3D::MeshAlg::Edge::boundary
G3D::readFileAsStringG3D::readWholeFile
G3D::writeStringToFileG3D::writeWholeFile (note: argument order changed!)
G3D::RenderDevice::setCaptionG3D::GWindow::setCaption
SDLK_*G3D::GKey::*
G3D::UserInput::keyCodeToStringG3D::GKey::toString
G3D::UserInput::stringToKeyCodeG3D::GKey::fromString
G3D::SkyParametersG3D::SkyParameters
G3D::Texture::texelWidthG3D::Texture::width
G3D::Texture::texelHeightG3D::Texture::height
G3D::Texture::WrapModeG3D::WrapMode
G3D::Texture::TRANSPARENT_BORDERG3D::WrapMode::ZERO
SDL_eventnameG3D::GEventType::eventname
GApp::debugCameraGApp::defaultCamera
GApp::debugControllerGApp::defaultController
GWindow::pollEventGWindow::pollOSEvent
G3D::WidgetG3D::Widget
G3D::GModuleManagerG3D::WidgetManager
G3D::GApp::addWidgetG3D::GApp::addWidget
G3D::GApp::removeWidgetG3D::GApp::removeWidget
G3D::GFont::get2DStringBoundsG3D::GFont::bounds
G3D::GModule::getPosedModelG3D::Widget::onPose
G3D::GApp::getPosedModelG3D::GApp::onPose
G3D::NetworkDevice::createListenerG3D::NetListener::create
G3D::NetworkDevice::createLightweightConduitG3D::LightweightConduit::create
G3D::NetworkDevice::createReliableConduitG3D::ReliableConduit::create
G3D::GApp::debugPrintfG3D::screenPrintf
G3D::debugPrintfG3D::consolePrintf
G3D::MD2Model::Pose::doSimulationG3D::MD2Model::Pose::onSimulation


Switched from MBCS to UNICODE on Win32

The default wide character set for Visual Studio 2005 is Unicode (instead of multi-byte, which is what previous versions used.)

The G3D source code now compiles under either character set, however the precompiled binaries distributed for Windows are now Unicode binaries. This eliminates the project configuration step when users are creating new projects on Windows since G3D matches the default.

However, this means that pre-existing visual studio projects will likely encounter string errors at link time. If they do, in the Visual Studio IDE go to Projects...Property Pages and on the Configuration Properties... General tab, change Character Set to be "Use Unicode Character Set."


GApp::debugController is now a reference

This means that app->debugController.setActive etc. calls are now app->debugController->setActive.


c: files visual studio\vc98\include\winsock2.h(99) : error C2011: 'fd_set' : 'struct' type redefinition

G3D (since 6.09) uses WinSock 2.0 on Windows. Unfortunately, this is incompatible with WinSock 1.1, which is included by windows.h. So you have to EITHER:

  • always include graphics3d.h before windows.h (note that graphics3d.h includes windows.h, so you don't need your own include for windows.h) OR
  • edit g3d/NetAddress.h define G3D_WINSOCK_MAJOR_VERSION 2 / define G3D_WINSOCK_MINOR_VERSION 0 to choose version 1.1 OR
  • Change your Windows include to
       define _WINSOCKAPI_
       include <windows.h>
       undef _WINSOCKAPI_
      


PhysicsFrame::integrate is gone

These functions have been removed to avoid ambiguity. The old implementations were:

PhysicsFrame PhysicsFrame::integrate(
    float                   t,
    const PhysicsFrame&     dx) {

    PhysicsFrame result;

    result.translation = translation + t * dx.translation;
    result.rotation    = rotation * dx.rotation.pow(t);

    return result;
}

PhysicsFrame PhysicsFrame::integrate(
    float                   t,
    const PhysicsFrame&     dx,
    const PhysicsFrame&     ddx) {

    PhysicsFrame result;
    result.translation = translation + t * dx.translation + t * t * ddx.translation;
    result.rotation    = rotation * dx.rotation.pow(t) * ddx.rotation.pow(t * t);

    return result;
}

Generated on Thu Aug 2 11:40:43 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo