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.

GLSL structures equivalent in ninevehGL
Vote this thread:


@luiso_ps

Posts: 6

NGLNewbie

Fri, Apr 5 2013


Hello,

Due to a discussion started in a previous thread about Reflection Maps, I'm trying to implement a custom shader to deal myself with the reflections.

Studying GLSL I have found some sources that uses:


struct gl_LightSourceParameters {
vec4 ambient;
vec4 diffuse;
vec4 specular;
vec4 position;
vec4 halfVector;
vec3 spotDirection;
float spotExponent;
float spotCutoff; // (range: [0.0,90.0], 180.0)
float spotCosCutoff; // (range: [1.0,0.0],-1.0)
float constantAttenuation;
float linearAttenuation;
float quadraticAttenuation;
};

uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights];
struct gl_LightModelParameters {
vec4 ambient;
};
uniform gl_LightModelParameters gl_LightModel;


and


struct gl_MaterialParameters {
vec4 emission;
vec4 ambient;
vec4 diffuse;
vec4 specular;
float shininess;
};

uniform gl_MaterialParameters gl_FrontMaterial;
uniform gl_MaterialParameters gl_BackMaterial;


When I try to use these structures and uniforms inside ninevehGL (in a shader), its compilation fails because it says it does not find them.

Can you tell me if the previuos structures and uniforms correspond to internal ninevehGL shader variables (like the ones specified in the documentations).

It is there any list of GLSL primitives that can be used in ninevehGL (shaders).

By the way, what is the version of GLSL supported by ninevehGL (it is the one released with openGL ES 2.0: GLSL ES 1.0) ?

Sorry for the too many questions,

Saludos

Luis
0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Fri, Apr 5 2013


In response to: @luiso_ps

Hello buddy,

You're doing two little basic mistakes with GLSL ES.


  1. You can't use the prefix "gl_" this is reserved only to internal OpenGL variables. Just change it to "my", <projectPrefix>, "gl" or anything else you want. As you may know, I advise you to don't use the prefix "ngl_" either, it's reserved to NinevehGL stuff.
  2. You can't use GLSL ES variables without a precision qualifier. You must specify each precision or at least set a global precision, using lines such as: "precision mediump float;" and "precision mediump int;". Remember that those lines must come BEFORE any other thing in your custom shader.


Adjusting your shaders as I said it'll work fine.
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.