• Create Account

# Irlan Robson

Member Since 08 May 2012
Offline Last Active Oct 19 2016 09:53 AM

### In Topic: Unroll

12 October 2016 - 04:10 PM

You can try running the code below just after the suspecious OpenGL call was made for visualizing the error code.

```void CheckGLError()
{
GLenum code = glGetError();
if (code != GL_NO_ERROR)
{
fprintf(stderr, "OpenGL error = %d\n", code );
assert(false);
}
}
```

### In Topic: Question about Jacobian in Joint Constraint formula

24 September 2016 - 07:26 AM

Code for solving the velocity constraint as a 3D block using sequential impulses.

HTH

### In Topic: Distinct quadtrees for static and moving objects

18 August 2016 - 01:36 PM

It depends on several implementation details that involves memory management, data structures, and heuristics.

You can achieve O(1) insertion with a Quadtree if you implement the optimizations described by L. Spiro in this post (originally described in GPG 4 IIRC):

http://lspiroengine.com/?p=530

As for AABB trees, one detail is the way the nodes are  stored in the memory. For both static and dynamic tree is possible to store their nodes in an array in an attempt to decrease memory access time when traversing the tree. For an array-based static tree the insertion is simple. But for an array-based dynamic tree the operations are not so trivial. A free list of nodes needs to be maintained in the tree for quick node allocation when inserting a new leaf. It is also recommended to inflate the node's AABB by some units such that becomes possible not re-inserting the node into the tree in a future time, when updating the AABB. For example, that could be done by checking if the new AABB is still contained in the old AABB. Another optimization is to predictively extend the new AABB by some units in the direction of motion of the object associated with the node.

Here is an example implementation if you need help implementing the dynamic tree with the optmizations/heuristics I've mentioned above:

https://github.com/erincatto/Box2D/blob/master/Box2D/Box2D/Collision/b2DynamicTree.cpp

Here are some nice slides by Erwin

### In Topic: Distinct quadtrees for static and moving objects

18 August 2016 - 11:11 AM

You can use a static AABB tree if you need fast ray or AABB queries. It is possible to store the nodes in an array to improve cache performance when traversing it. I use this for generating mesh contacts in my physics engine, but I'm pretty sure it is suitable for graphics (e.g. culling) as well.

### In Topic: Engine design v0.3, classes and systems. thoughts?

16 August 2016 - 06:37 PM

I'm not going to point out the problems in your design but I encourage you to search here on the forums about "game engine architecture". It is also recommended that you read Jason Gregory's Game Engine Architecture book to understand the details of each game engine system.

Roughly speaking, for your first game engine I recommend a source tree that looks like this:

External (Dependencies)
imgui
PhysX
...
Tools
ModelConverter
ModelEditor
...
Engine
Core
Allocation
File
Math
Platform
Win32
Linux
iOS
Standard
Template
...
Rendering
GpuDevice.h
GpuContext.h
OpenGL
OpenGL_Device.cpp
OpenGL_Context.cpp
D3D11
D3D11_Device.cpp
D3D11_Context.cpp
...
Animation
...
Physics
...
Audio
...
Game Object
...
Game_1
Game_2
Game_3
...

Each module (e.g. Core, Rendering, etc.) being a static library that gets linked into the game. If you're really organized then you might consider using UML's Class Diagrams instead of paint sketches to model the relationship between each system.

PARTNERS