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.

Dynamically adding different Textures to each faces of cube
Vote this thread:


@RijoPayyappilly

Posts: 7

NGLNewbie

Thu, Sep 20 2012


Hi,

First of all, thanks for this great engine, it looks really easy and I'm having a lot of fun!

I have integrated a cube into my app which have touch gestures.
All i want to do now is add different images to each faces of the cube dynamically ..
I tried accessing cube.mtl file dynamically. but didn't got what i wanted
thanks in advance
0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Thu, Sep 20 2012


In response to: @RijoPayyappilly

Hello buddy,

The NGLMesh has a property called "material". It can be any kind of materials, you can set it dynamically. Take a look at our lessons "Customizing Meshes" you'll see examples of how to do that.
100% like this - 1/1

@RijoPayyappilly

Posts: 7

NGLNewbie

Fri, Sep 21 2012


In response to: @dineybomfim

thanks for the response . i checked the tutorial but what i needed is add different images on each face of the cube . i tried the tutorial but same texture appear on every face of the cube . please help me ... i am a newbie
0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Fri, Sep 21 2012


In response to: @RijoPayyappilly

OK,

You have tow choices:

  • Your 3D object must be divided in 6 faces;
  • You 3D object must have 6 different material, one on each surface.


NinevehGL is a 3D render engine, not a modeling tool, so any kind of change that involves modeling, should be made on your original 3D mesh.

Hope this helps.
100% like this - 2/2

@RijoPayyappilly

Posts: 7

NGLNewbie

Sat, Sep 22 2012


In response to: @dineybomfim

That worked . I created six different meshes and grouped it. thank you so much for the guidance
0% like this - 0/1

@pdsingh9

Posts: 6

NGLNewbie

Fri, May 10 2013


Hi Sir,
I am just a beginner in gaming. I have query related to 3D cube.
How can i add different images on different textures to each faces dynamically ?
Can u provide me some code related to above query.
Please help me.

0% like this - 0/0

@pdsingh9

Posts: 6

NGLNewbie

Fri, May 10 2013


NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
kNGLMeshOriginalYes, kNGLTweenKeyRepeat,
kNGLMeshCentralizeYes, kNGLMeshKeyCentralize,
@"0.3", kNGLMeshKeyNormalize,
nil];



_mesh = [[NGLMesh alloc] initWithFile:@"cube.obj" settings:settings delegate:self];
material = [NGLMaterial material];
material.ambientMap = [NGLTexture texture2DWithImage:[UIImage imageNamed: @"1.png"]];
_mesh.material = material;
[_mesh compileCoreMesh];


_mesh1 = [[NGLMesh alloc] initWithFile:@"cube.obj" settings:settings delegate:self];
material1 = [NGLMaterial material];
material1.diffuseMap = [NGLTexture texture2DWithImage:[UIImage imageNamed: @"2.png"]];
_mesh1.material = material1;
[_mesh1 compileCoreMesh];


_mesh2 = [[NGLMesh alloc] initWithFile:@"cube.obj" settings:settings delegate:self];
material2 = [NGLMaterial material];
material2.diffuseMap = [NGLTexture texture2DWithImage:[UIImage imageNamed: @"3.png"]];
_mesh2.material = material2;
[_mesh2 compileCoreMesh];


_mesh3= [[NGLMesh alloc] initWithFile:@"cube.obj" settings:settings delegate:self];
material3 = [NGLMaterial material];
material3.diffuseMap = [NGLTexture texture2DWithImage:[UIImage imageNamed: @"4.png"]];
_mesh3.material = material3;
[_mesh3 compileCoreMesh];


_mesh4 = [[NGLMesh alloc] initWithFile:@"cube.obj" settings:settings delegate:self];
material4 = [NGLMaterial material];
material4.diffuseMap = [NGLTexture texture2DWithImage:[UIImage imageNamed: @"5.png"]];
_mesh4.material = material4;
[_mesh4 compileCoreMesh];


_mesh5 = [[NGLMesh alloc] initWithFile:@"cube.obj" settings:settings delegate:self];
material5 = [NGLMaterial material];
material5.diffuseMap = [NGLTexture texture2DWithImage:[UIImage imageNamed: @"6.png"]];
_mesh5.material = material5;
[_mesh5 compileCoreMesh];



_camera = [[NGLCamera alloc] initWithMeshes:_mesh,_mesh1,_mesh2,_mesh3,_mesh4,_mesh5, nil];

group3d = [[NGLGroup3D alloc] init];
[group3d addObject:_mesh];
[group3d addObject:_mesh1];
[group3d addObject:_mesh2];
[group3d addObject:_mesh3];
[group3d addObject:_mesh4];
[group3d addObject:_mesh5];

[_camera autoAdjustAspectRatio:YES animated:YES];


Problem is that only one images load all texture , Why ?
0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Fri, May 10 2013


In response to: @pdsingh9

Instead of allocating and initialize the meshes all the time, use the copy methods to recreate your cube instances.
0% like this - 0/0

@pdsingh9

Posts: 6

NGLNewbie

Sat, May 11 2013


In response to: @dineybomfim

Thanks for quick response.

As you told earlier ..
i used copy method to create multiple instance of mesh .
first of, i did allocation and initialization of mesh in viewDidLoad method


- (void) viewDidLoad
{
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
kNGLMeshOriginalYes, kNGLTweenKeyRepeat,
kNGLMeshCentralizeYes, kNGLMeshKeyCentralize,
@"0.3", kNGLMeshKeyNormalize,
nil];



_mesh = [[NGLMesh alloc] initWithFile:@"cube.obj" settings:settings delegate:self];
[super viewDidLoad];
}

And this is complete code to set different image on different faces of 3D Cube.

- (IBAction)rotated3DCube:(id)sender
{
material = [NGLMaterial material];
material.ambientMap = [NGLTexture texture2DWithFile:@"11.png"];
_mesh.material = material;


_mesh1=[_mesh copy];
material1 = [NGLMaterial material];
material1.ambientMap = [NGLTexture texture2DWithFile:@"12.png"];
_mesh1.material = material1;

_mesh2=[_mesh copy];
material2 = [NGLMaterial material];
material2.diffuseMap = [NGLTexture texture2DWithFile:@"13.png"];
_mesh2.material = material2;


_mesh3=[_mesh copy];
material3 = [NGLMaterial material];
material3.diffuseMap = [NGLTexture texture2DWithFile:@"14.png"];
_mesh3.material = material3;

_mesh4=[_mesh copy];
material4 = [NGLMaterial material];
material4.diffuseMap = [NGLTexture texture2DWithFile:@"15.png"];
_mesh4.material = material4;


_mesh5=[_mesh copy];
material5 = [NGLMaterial material];
material5.diffuseMap = [NGLTexture texture2DWithFile:@"16.png"];
_mesh5.material = material5;


group3d = [[NGLGroup3D alloc] init];
[group3d addObject:_mesh];
[group3d addObject:_mesh1];
[group3d addObject:_mesh2];
[group3d addObject:_mesh3];
[group3d addObject:_mesh4];
[group3d addObject:_mesh5];

_camera = [[NGLCamera alloc]init];
[_camera addMeshesFromGroup3D:group3d];
[_camera autoAdjustAspectRatio:YES animated:YES];

}


- (void) drawView
{
_mesh.rotateY = 2.0f;
_mesh.rotateX -= 0.5f;
//_mesh.rotateZ=0.1f ;

_mesh1.rotateY = 2.0f;
_mesh1.rotateX -= 0.5f;
//_mesh1.rotateZ=0.1f ;

_mesh2.rotateY = 2.0f;
_mesh2.rotateX -= 0.5f;
//_mesh2.rotateZ=0.1f ;

_mesh3.rotateY = 2.0f;
_mesh3.rotateX -= 0.5f;
//_mesh3.rotateZ=0.1f ;

_mesh4.rotateY = 2.0f;
_mesh4.rotateX -= 0.5f;
// _mesh4.rotateZ=0.1f ;

_mesh5.rotateY = 2.0f;
_mesh5.rotateX -= 0.5f;
//_mesh5.rotateZ=0.1f ;


[_camera drawCamera];

}

- (void) meshLoadingDidFinish:(NGLParsing)parsing
{
NSLog(@"meshLoadingProgress: %@ ",parsing.mesh);
}

By this code , 3D cube show according cube.mtl set images, not according to rotated3DCube method code.
help me .
0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Sat, May 11 2013


In response to: @pdsingh9

now you're not calling the recompileCoreMesh. It will not work without that.
0% like this - 0/0

@pdsingh9

Posts: 6

NGLNewbie

Thu, May 16 2013


In response to: @dineybomfim
Thanks lot Sir to guide me .
And code is properly working.


0% like this - 0/0

@pdsingh9

Posts: 6

NGLNewbie

Fri, May 17 2013


In response to: @pdsingh9
Hi ,
As i was working on 3D cube .
My query is that i want to touch on 3d faces and also change image on that faces , delete images etc.
have NinevehGL's any Touch API ?


0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Fri, May 17 2013


In response to: @pdsingh9

Nope,

NinevehGL is only responsible for rendering 3D content, everything else is up to you.
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.