Adding an OpenGL ES for your project with NinevehGL

Posted by Unknown Kamis, 21 Februari 2013 0 komentar

Recently I came across an OpenGL ES 2.0 engine that made the installation, display and animate 3D objects a breeze, called NinevehGL. The 3D engine has many features including a full multithreading environment, to keep the main execution loop is free to object rendering, motion tweening, grouping items, lighting, materials and textures, custom shader support and native support for reality increased, just to name a few. Another great advantage is the possibility to import both wavefront (. Obj) and Collada (. DAE). This structure is very easy to use, robust, and can be used in many different ways.

iOS openGL rotating earth with NinevehGL Erick Bennett on Vimeo.

In this tutorial I will show how easy and effective way to add an OpenGL ES 2.0 3D view of the project, and show a fully rendered, 3D rotating Earth. The active model can be found here, and includes object and texture. These assets are also in the ZIP file of the project, available through the link at the end of this guide.

Download and install the framework NinevehGL.

Since we want to add this view to an existing project and understand how the engine works, you can create a new project unique view to start. Even NinevehGL could very well be using Interface Builder, let’s put this view programming. For this exercise, no matter if you choose Storyboard or XIB for the new project.

For starters, there are some tables that we need to add. Do this by first choosing your header file in the project browser pane design. Ensure project goals is highlighted, and build phases click “Link Binary with Libraries of.” Use the + at the bottom of the screen and add this Core Quart and open Pringles frames.

Then use the “Add Others” button, navigate to the folder and downloaded NinevehGL NinevehGL.framework import .

Now in code ……. NinevehGL import the header (h). file

@ Controller Interface View: UIViewController NGLViewDelegate >

# import # import @ interface View Controller: UIViewController NGLViewDelegate > NGLCamera * _camera, NGLMesh * _mesh;}

your source file (. m), which you should start NGLView puts his delgate that can define a glossary of some basic definitions and start networking and cameras. I do this in my viewDidLoad method, but depending on your needs, this can be done elsewhere

- (void) viewDidLoad {[super viewDidLoad]. Style # = / / Do any additional settings after loading the view, typically from a point / / set our NGLView * TheView = [[ NGLView Alloc] initWithFrame: CGRectMake (40, 40, 240, 360)], / / Set the delegate thus call display method used = theView.delegate himself. / / Add new view on top of our existing view [self.view addSubview: TheView]. / content / is used to increase the resolution to use

of monitors the retina and the values ​​range from 1.0 to 2.0. This sets the scale factor content

best to scale screen of the device. theView.contentScaleFactor = [[UIScreen main screen] scale], / / Set some initial states to implement our environmental mesh NSDictionary * settings = [NSDictionary dictionary object with keys sand: kNGLMeshCentralizeYes. , kNGLMeshKeyCentralize , @ "0.3" kNGLMeshKeyNormalize ], nil. / / initialize the network, which includes the template file to be imported (or DAE .. obj) _mesh = [[ NGLMesh alloc] initWithFile: delegate settings :: @" earth.obj "] nil; / / Initialize the camera used to make the scene _camera = [[ NGLCamera Alloc] initWithMeshes:. _mesh, nil], "cor: # 008000 / / If a transparent background necessary NGLView / / theView.backgroundColor = [color UIColor course] / / nglGlobalColorFormat (NGLColorFormatRGBA) / / nglGlobalFlush () / / The following command displays a 3D view Status Monitor, which displays your current frame rate and the number of polygons rendered in sight. [[ debugMonitor] starting order: ( NGLView *) self.view ];}

-. (Void) { / / Rotate on Y axis _mesh.rotateY + = 0.5, / / Draw for our camera to show our point of view [_camera tie camera];}

Now, build and run the project and you should see a slowly rotating planet Earth. The NGLView was deliberately designed smaller than the bottom view to show how you can override this on all normal NGLView another to add 3D content. If you want the background to be transparent NGLView, set the background color to clear and add the following additional commands. There is also a status monitor that can be executed to display the frame rates and the number of polygons performed for optimization.

"> / / If a transparent background necessary NGLView theView.backgroundColor = [color UIColor course], nglGlobalColorFormat ( ), nglGlobalFlush (), / / The following command shows a 3D view Status Monitor, which displays your current frame rate and the number of polygons rendered in the view [[ NGLDebug debugMonitor ] starting order:. ( NGLView *) itself. View]

/ / rotation _mesh.rotateX, rotateY, rotateZ sizing / / _mesh.scaleX, scaleY, scaleZ / / stage _mesh.x, y, z / center / offset rotation of the object _mesh.pivot nglVec3Make = (x, y, z)

project file

pc Canadian Pharmacy brahmi

:::::: http://www.icodeblog.com/2012/09/07/3856/

TERIMA KASIH ATAS KUNJUNGAN SAUDARA
Judul: Adding an OpenGL ES for your project with NinevehGL
Ditulis oleh Unknown
Rating Blog 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke http://apk-zippy.blogspot.com/2013/02/adding-opengl-es-for-your-project-with.html. Terima kasih sudah singgah membaca artikel ini.

0 komentar:

Posting Komentar

Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of apk zippy.