Login Action Required

The NinevehGL Forum uses a new concept of "socialized forum" or as we like to say "Tweet Forum".

Here is the deal:
  1. No new registration is required. Just sign in with your Twitter account and authorize the NinevehGL Forum.
  2. Once you’re in, you'll be able to "Follow a Thread", that means every time that thread receive a new post or update you'll receive a mention on your twitter.
  3. Besides, you can enable "Auto Share", then every new post and/or thread you make will be tweeted on your timeline. (By default, auto-share is enabled only for your threads)

Forum Rules:

1. We understand human comunication can become "hot" sometimes. So some insults and bad words ARE allowed. Just don't push too much being an asshole all the time.

2. SPAMMERS are not allowed. There are penalties for this kind of user and they can be banned forever.

3. You can report other users, if you judge necessary. An user reported many times by many people can also be banned forever. However you can also receive penalties for report deliberately for no apparent reason.

If there is a similar thread title, make sure the other one doesn't already have the answer you're looking for.

This forum uses the BBCode (Bulletin Board Code), here are some instructions:

Bold: [b]text[/b]
Italic: [i]text[/i]
Underline: [u]text[/u]

Code: [code]text[/code]

[ul] [*]item [/ul]
[ol] [*]item [/ol]



Embed (videos, code, 3D):

Welcome to the NinevehGL's world!
NinevehGL is a 3D engine forged with pure Obj-C.
Welcome to the
Hello, Guest.

Your current vote:

You can change your vote many times. But it's still one single vote.

Best way to set 3d object orientation matrix?
Vote this thread:


Posts: 9


Wed, Jan 16 2013

Hi there,

I would like to set the rotation and scale directly from a 3x3 orientation matrix. What is the best way to accomplish this?

It seems there is some magic going on under the hood that enforces a sequence of rotations, scaling, and translation parameters. However, I'm trying manipulate the scene by utilizing a 3x3 orthogonal matrix myself. Unfortunately applying this via -rotateWithQuaternion: doesn't seem to work, and the properties for these matrices are readonly.

// Handy GLKit to NGL vector bridge
typedef struct UnifiedVector4_t {
union {
GLKVector4 glkvec4;
GLKQuaternion glkquat;
NGLvec4 nglvec4;
} UnifiedVector4;

// Camera setup code

UnifiedVector4 rotation;
rotation.glkquat = GLKQuaternionMakeWithMatrix3(_cameraData.orientation);
NGLQuaternion *nglRotate = [[NGLQuaternion alloc] init];
[nglRotate rotateByQuaternionVector:rotation.nglvec4 mode:NGLAddModeSet];

_camera.rotationSpace = NGLRotationSpaceWorld;
[_camera rotateWithQuaternion:nglRotate];

GLKVector3 pos = _cameraData.position;
[_camera translateToX:pos.x toY:pos.y toZ:pos.z];

0% like this - 0/0


Posts: 9


Wed, Jan 16 2013

In response to: @otri

It appears this is a fundamental restriction of how NinevehGL engine works under the hood. All rotations appear to be handled in euler format, which have various order of operations applied. This unfortunately doesn't work nicely with custom LookAt code, where the UP vector may be allowed to drift or roll upside down.

I wanted to implement arcball rotation roll over the top, then animate the rotation back to upward facing. This is really painful in euler, so for the time being I'm restricting user movement to lat/long with top and bottom limits.

Euler keeps it simple for a beginner, but very limiting when you get more advanced. It would be most excellent if we can could write orientation handling code ourselves and set the orientation matrix on the camera and models, bypassing the Scale -> Rotate -> Translate scene computations.
0% like this - 0/0


Posts: 571


Tue, Jan 22 2013

In response to: @otri

It's completely the opposite my friend.

NinevehGL never do even a single Euler rotation.

Everything is about quaternions. Just forget about everything your learned before about the 3D equations. What we doing here inside is absolutely new and cutting edge. EXTREMELLY faster than the old fashion ways.

Everything you must do is to open your mind:
There is a concept called "Rebase" in NinevehGL. This concept is what gives you the power to make things like AR, changing the base of all the scene of objects individually and even there working with your transformations without affecting each others.

So, maybe what you're looking for is the rebase concept, every NGLObject3D can be rebased. Just keep in mind that the NinevehGL matrix is in column-major format. There is a lot of NinevehGL functions to work with matrices, all they start with "nglMatrix..."

BTW, if you accept an advice, don't mix GLKit and NinevehGL. Both are wrappers for OpenGL and mixing them could led you into conflicts. Besides, remember that GLKit is made in the "old fashion way"... that has nothing to do with the new NGL way.
100% like this - 1/1


Posts: 9


Mon, Feb 4 2013

In response to: @dineybomfim

Thank you! I'll have to look into the rebase method for the custom camera code.
0% like this - 0/0

NinevehGL is a 3D engine built right on top of OpenGL ES and it uses all the programmable pipeline power, making it easy for you to create great application with shaders.

Share on

Follow NinevehGL
Fastest way to contact us:

Copyright © 2011 db-in. All rights reserved.