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.

Drawing on NinevehGL AR context with OpenGL commands
Vote this thread:


@SuperMario_77

Posts: 4

NGLNewbie

Wed, Oct 17 2012


Hello,

I started using your excellent 3D engine with Qualcomm AR since 2 weeks and it works perfectly.

Now it is important for me to show model animations at my Qualcomm marker. I know you plan to implement model animations in the next releases, but I can't wait. So I wanted to try to implement a MD2 (Quake2 format) model reader to show some animations. MD2 format seems easy to read. It is only a vertex animation and no bones animation, but this is okay for me.

My problem is, I don't know how to draw my vertices/triangles on the EAGL context of NinevehGL with standard OpenGL ES 2.0 commands. Furthermore, I like to use GLKit from Apple which should make some OpenGL handling easier. I tried a lot, but there will be nothing drawn on the context.

For the beginning I wanted to draw a simple colored rectangle from the tutorial here:
http://38leinad.wordpress.com/2011/10/19/practical-blender-with-glkit-part-1-introducing-glkit/

Should I have to initialize the EAGL context by myself and how can I use GLKView in connection with NGLView?

I tried to put these code lines into the drawView method of NinevehGL:
[effect prepareToDraw]; // GLKBaseEffect is initialized in loadView()

static const GLfloat squareVertices[] = {
-0.5f, -0.5f, 1,
0.5f, -0.5f, 1,
-0.5f, 0.5f, 1,
0.5f, 0.5f, 1
};

static const GLubyte squareColors[] = {
255, 255, 0, 255,
0, 255, 255, 255,
0, 0, 0, 0,
255, 0, 255, 255,
};

glClear(GL_COLOR_BUFFER_BIT);

glEnableVertexAttribArray(GLKVertexAttribPosition);
glEnableVertexAttribArray(GLKVertexAttribColor);

glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 0, squareVertices);
glVertexAttribPointer(GLKVertexAttribColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, squareColors);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

glDisableVertexAttribArray(GLKVertexAttribPosition);
glDisableVertexAttribArray(GLKVertexAttribColor);


Doesn't work.

I initialize a GLKView with the context from nglContextEAGL() and added the GLKView as subview of the NGLView. => doesn't work, black screen.

Could you please give me some hints or guidance to draw something with OpenGL commands on NinevehGL view?

Best regards,
Mario
0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Wed, Oct 17 2012


In response to: @SuperMario_77

Hello buddy,

Well, seems you're on a "Mission:Impossible". You're trying to integrate many things that will certainly conflict one with other.

The first decision to make:
- Forget about GLKit or forget about NinevehGL. Both frameworks can't live together in the same project.

The second one:
- With NinevehGL you can make custom shaders. In the end, even importing MD2, COLLADA, MAX, 3DS or any other format you'll end in the same thing: a shader. So, do your stuff and create a custom shader making your animation on vertices. You don't need to worry about EAGL or contexts at all!

You can mix NinevehGL OpenGL stuff, however you can't do that using AR. Qualcomm AR is a critical tool that is very restrictive in the usage of OpenGL, specially about color format and orientation.
0% like this - 0/0

@SuperMario_77

Posts: 4

NGLNewbie

Thu, Oct 18 2012


In response to: @dineybomfim

Thanks for your answer. It's sad to hear that my task is so difficult to implement or even impossible. :-(

So, I forget the GLKit stuff. But you also said that it is even hard to do the mixed NinevehGL and OpenGL stuff together with Qualcomm AR. Then I have to search another AR framework. I already looked at metaio SDK, which has a built-in 3d render engine, but it is ugly C code and also very expensive when using in commercial project for customers ($23,900 for a pro license)!
But other AR frameworks must be first connected to NinevehGL by myself, because I really want to use your cool OpenGL framework. *sigh*

I always thought shaders are similar to materials, so how a surface should look like. I can do animation with custom shaders? Then, I have to learn more about shaders. Thanks.


0% like this - 0/0

@dineybomfim

Posts: 571

NGLAdmin

Thu, Oct 18 2012


In response to: @SuperMario_77

Hello buddy,

Well, Qualcomm AR is today the most compatible AR engine with NinevehGL. The point is that it is very limited in relation to using OpenGL. Alpha channel and some global OpenGL settings.

About the shaders, in fact they are much more than materials. In fact, the shaders are the entire render processing made in GPU side. To the CPU the entire 3D world is just a lot of static objects without any movement, rotation, no lights, no colors, nothing... Everything gains life in the shaders. The static objects assumes it's final position, the image gains the camera projection and the aspect ratio, colors comes in... in short, the 3D world happens inside the shaders.

Remember that you have two kind of shaders: Vertex Shaders (to deal with individual vertices) and the Fragment Shaders (to deal with fragments).

Hope this helps to start your journey!
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.