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.

shader not working
Vote this thread:


@inuyashazaq

Posts: 12

NGLNewbie

Sun, Jul 15 2012


I'm following the tutorial (lesson 10) on Youtube, but the shader does not have any effect on display.
There may be some version difference.
fsh and vsh files are the same as that on youtube.


code:

nglGlobalColorFormat(NGLColorFormatRGBA);
nglGlobalLightEffects(NGLLightEffectsOFF);
nglGlobalFlush();

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

mesh = [[NGLMesh alloc] initWithFile:@"cube.obj" settings:settings delegate:nil];

NGLShaders *shader = [NGLShaders shadersWithFilesVertex:@"s.vsh" andFragment:@"s.fsh"];
mesh.shaders = shader;
[mesh compileCoreMesh];

camera = [[NGLCamera alloc] initWithMeshes:mesh, nil];
[camera setAspectRatio:1.0 / camera.aspectRatio];

Thanks.
0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Mon, Jul 16 2012


In response to: @inuyashazaq

Hello,

You don't need to call "[mesh compileCoreMesh];" when the mesh is loading.

Make sure your custom shaders is working, for example:
In "s.fsh" make something like:


void main(void)
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}


If the mesh appear "red" so your shader file is working, you can proceed.
0% like this - 0/0

@inuyashazaq

Posts: 12

NGLNewbie

Mon, Jul 16 2012


In response to: @dineybomfim

I deleted compileCoreMesh, and this is the shader files:
fragment:

precision lowp float;
precision lowp int;
varying vec4 v_color;
void main()
{
gl_FragColor = v_color;
}

vertex:

precision lowp float;
precision lowp int;
varying vec4 v_color;
void main()
{
v_color = a_nglPosition;
}


As the youtube example shows, but it is still not working.
Is there any example using shader files so that I can find where my problem is?
0% like this - 0/0

@inuyashazaq

Posts: 12

NGLNewbie

Mon, Jul 16 2012


In response to: @dineybomfim

I also tried
void main(void)
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
in fragment (replace the full fragment file with the code as well as just change the line gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);), but both method did not work.
0% like this - 0/0

@inuyashazaq

Posts: 12

NGLNewbie

Mon, Jul 16 2012


In response to: @dineybomfim

Could it be my iPhone's problem? It's 4s under 5.0.1.

By the way , when running under iPhone Simulator, mesh cannot be loaded, and the banner shows Polys:0 Verts:0, the simulator is loaded with at least ios 5.0.

I tried this with the latest release (downloaded within this week), and with the template program (the cube) without any modifications.
0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Mon, Jul 16 2012


In response to: @inuyashazaq

well buddy,

If the debug shows 0 vertx, so your mesh is not being loaded properly. Take a look at the console output.

If you still having troubles, please enter in contact via the Contact area for code investigation.
0% like this - 0/0

@inuyashazaq

Posts: 12

NGLNewbie

Tue, Jul 17 2012


In response to: @dineybomfim

Thanks for your reply.

After several reboots of my macbook, the problem seems solved. It might be linking problems of Xcode.
Then the debug windows of xcode shows the following:

Error while processing NGLSLSource.
Shader file "s.vsh" was not found in the specified path.
The path to a file must reflect its real location, if only the file's name was specified, the search will happen in the Global Path.
For more information check the nglGlobalFilePath() function.

Could you tell me where / which folder should I place my shader files?
0% like this - 0/0

@inuyashazaq

Posts: 12

NGLNewbie

Tue, Jul 17 2012


In response to: @inuyashazaq

Oh..again it should be a linking problem....
simulator and my 4s gives me different response..

Sorry for annoying you...
0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Tue, Jul 17 2012


In response to: @inuyashazaq

Hello buddy,

No problem. This seems a common problem with Xcode.
When you import the "fsh" or "vsh" it doesn't know what to do with those files, so Xcode think it's code file and insert it in your "Compile Sources" instead of placing the files in "Copy Bundle Resources", as it should be.

So, take a look at the "Build Phases > Compile Sources" and make sure your shader files are not there. The right place for them is "Build Phases > Copy Bundle Resources"
100% like this - 1/1
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.