Introduction to OpenGL es:
OpenGL ES (OpenGL for Embedded Systems) is a subset of OpenGL's three-dimensional graphics APIs designed for embedded devices such as mobile phones, PDAs, and game consoles . The API is defined by Khronos Group, Khronos is a graphic hardware and software industry Association, which focuses on the open standards of graphics and multimedia.
The main new features of OpenGL ES 3.0 are:1.
rendering pipeline Multiple enhancementsFor advanced visual effects, including occlusion queries (occlusion query), slow feedback (Transform Feedback), instance rendering (instanced Rendering), four or more render target support. 2.
high quality ETC2/EAC texture compression formatAs a standard feature, different texture sets are no longer required on different platforms. 3.
new GLSL ES 3.0 coloring Language, full support for integer and 32-bit floating-point operations. 4.
greatly enhanced texture capabilities, supports floating-point textures, 3D textures, depth textures, vertex textures, npot textures, r/rg single-and dual-channel textures, immutable textures, 2D array textures, no quadratic power limit textures, shadow contrast, leveling (swizzle), Lod and MIP level clamps, seamless cube mapping, Sample object, texture MSAA anti-aliasing renderer. 5, a
wide range of precise size textures and render buffer formats, portable mobile apps are easier.
on iOS, the minimum environment that can support opengles3.0 is iphone5s ios7.0.
Environment setup under iOS:
There are several types of environments built under iOS, the simplest of which is to select the game template when creating a new project, and then as shown:
However, in this way, the creation of the project has a lot of useless code, not conducive to our one by-one learning, so we start from the simplest single view Application project, how to build the OpenGL ES environment.
First, create a single view Application project, then, Glkit and Opengles are introduced.
Shortly thereafter , the introduction of the ViewController.h file Glkit/glkit.h, change the parent class of the Viewcontroller class to Glkviewcontroller.
#import <UIKit/UIKit.h> #import <GLKit/GLKit.h> @interface viewcontroller:glkviewcontroller@end
then the custom class of the view corresponding to the Viewcontroller in storyboard is changed to Glkview.
Modify the Viewcontroller.m file with the following code:
#import "ViewController.h" #import <OpenGLES/ES3/gl.h> #import <OpenGLES/ES3/glext.h> @interface Viewcontroller () <glkviewdelegate>{eaglcontext *context;//eaglcontent is the opengles render layer that Apple implements under the iOS platform, The update used to render the result on the target surface. } @end @implementation viewcontroller-(void) viewdidload {[Super viewdidload]; context = [[Eaglcontext alloc] initwithapi:keaglrenderingapiopengles3];//here is opengles3. if (!context) {NSLog (@ "Failed to create ES context"); } Glkview *view = (Glkview *) Self.view; View.context = context; View.drawabledepthformat = GLKViewDrawableDepthFormat24; [Eaglcontext Setcurrentcontext:context]; Glenable (gl_depth_test); Turn on depth testing to allow objects close to you to block objects that are far away from you. Glclearcolor (0.1, 0.2, 0.3, 1); Sets the clear color of your surface, which is the background color rendered to the screen. }-(BOOL) Prefersstatusbarhidden {return YES;} -(void) Glkview: (Glkview *) View Drawinrect: (cgrect) rect{glclear (Gl_color_buffer_bit | Gl_depth_buffer_bit); Clears surface content and restores to its original state. } @end
Build The run again, as shown in:
At this point, a preliminary OPENGLES3 development environment has been set up, because of the specificity of the iOS platform, so we have to use the iOS Glkit Library to achieve and simplify our operation, but for most of the opengles content, I will still leave Glkit, The original way out, this, for the future cross-platform is of great benefit.
There are shortcomings in this article, but also hope that you will correct me.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Getting Started with OpenGL ES 3.0 programming in iOS (i): Building the Hello World environment