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]
Quote:
[quote=@username]text[/quote]
[quote]text[/quote]

List:
[ul] [*]item [/ul]
[ol] [*]item [/ol]

URL:
[url]http://url.com[/url]
[url=http://url.com]text[/url]

Image:
[img]http://imageurl.com[/img]

Embed (videos, code, 3D):
[embed]http://url.com[/embed]

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

Your current vote:

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

Don't get transformation when doing x axis
Vote this thread:


@RaulCatena

Posts: 2

NGLNewbie

Wed, Mar 6 2013


Hi, I have a group with two meshes.

the first is located at 0,0,0
the second at 0.2, 0.2, 0

When I rotate in z, or y, and I retrieve the matrix (with the model view transformations) using the matrix property of NGLMesh, I can see the transformations occurring in the matrix cos(angle) -sin(angle) etc. As it is expected for OpenGL.

However, when I retrieve the matrix after doing x rotation. Nothing changes. I guess it is doing the calculation since on screen it actually works. But the property doesn't change in the mesh object.

How can this be fixed?

Thank you very much.

-(void)loadMeshes{//I call this in viewDidAppear
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
//kNGLMeshOriginalYes, kNGLMeshKeyOriginal,
kNGLMeshCentralizeYes, kNGLMeshKeyCentralize,
@"0.3", kNGLMeshKeyNormalize,
nil];

_group = [[NGLGroup3D alloc]init];

_meshA = [[NGLMesh alloc] initWithFile:@"untitled.obj" settings:settings delegate:nil];
NGLMaterial *material = [[[NGLMaterial alloc]init]autorelease];
material.diffuseColor = nglColorMake(0.8, 0.8, 0.2, 1);
_meshA.material = material;
_meshA.scaleX = 0.2;
_meshA.scaleY = 0.2;
_meshA.scaleZ = 0.2;
_meshA.x = 0;
_meshA.y = 0;
_meshA.z = 0;
[_group addObject:_meshA];

_camera = [[NGLCamera alloc] initWithMeshes:_meshA, nil];

_meshB = [[NGLMesh alloc] initWithFile:@"untitled.obj" settings:settings delegate:nil];

_meshB.material = material;
_meshB.scaleX = 0.2;
_meshB.scaleY = 0.2;
_meshB.scaleZ = 0.2;
_meshB.x = 0;
_meshB.y = 0;
_meshB.z = 0;
[_group addObject:_meshA];

UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
[self.view addGestureRecognizer:tapRecognizer];
[_group removeObject:_mesh];
_group.rotationSpace = NGLRotationSpaceWorld;
[_camera translateToX:0 toY:0 toZ:1];
_camera.lookAtTarget = _group;
}
-(void)handleTap:(UITapGestureRecognizer*)recognizer{
//I do either of the following, only one of them, the other 2 I comment them out
_group.rotateX = 45;//
_group.rotateY = 45;//
_group.rotateZ = 45;//

//Now I analyze how the matrix is changed
for (int y = 0 ; y<4 ; y ) {
NSLog(@"MV [%f][%f][%f][%f]", _group.matrix[y][0], _group.matrix[y][1], _group.matrix[y][2], mesh.matrix[y][3]);
}
//As I say above, I can see the predicted changes when I rotate over Y or Z, but not X. The rotation occurs in the screen, so the OpenGL engine is definetively doing the work.
}
0% like this - 0/0

@RaulCatena

Posts: 2

NGLNewbie

Wed, Mar 6 2013


In response to: @RaulCatena

Apologies, for _meshB

_meshB.scaleX = 0.2;
_meshB.scaleY = 0.2;
_meshB.scaleZ = 0.2;
_meshB.x = 0.2;
_meshB.y = 0.2;
_meshB.z = 0;
0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Sun, Nov 24 2013


In response to: @RaulCatena

Hello buddy,

There are many concepts involved in this simple snippet of code.
But your initial thought is completely right. If you make a change in the X rotation using the absolute mode (not relatively), then you should see your change by retrieving the matrix property (which is the model view only).

This is happening, but if in your project you don't see it, please send us your project for investigation via email. We'll check it.
0% like this - 0/0
Technology

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.