日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

OpenGL ES 2.0 for iPhone Tutorial

發布時間:2023/12/10 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 OpenGL ES 2.0 for iPhone Tutorial 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

來源:http://www.raywenderlich.com/3664/opengl-es-2-0-for-iphone-tutorial

If you're new here, you may want to subscribe to my?RSS feed?or follow me on?Twitter. Thanks for visiting!

Learn how to use OpenGL ES 2.0 from the ground up!

OpenGL ES is the lowest-level API that you use to program 2D and 3D graphics on the iPhone.

If you’ve used other framework such as Cocos2D, Sparrow, Corona, or Unity, these are all built on top of OpenGL!

One of the reasons why programmers like to use the above frameworks rather than using OpenGL directly is because OpenGL is notoriously difficult to learn.

And that’s what this tutorial is for – to make the learning curve a little less steep for beginner OpenGL developers!

In this series, you’ll get hands-on experience with OpenGL ES 2.0 and will create a simple “Hello, World” app that displays some simple geometry.

In the process, you’ll learn the following:

  • How to get a basic OpenGL app working from scratch
  • How to compile and run vertex & fragment shaders
  • How to render a simple square to the screen with vertex buffer objects
  • How to apply projection and model-view transforms
  • How to render a 3D object with depth testing

Caveat: I am not an Open GL expert! I am learning this myself, and am writing tutorials as I go. If I make any boneheaded mistakes, feel free to chime in with corrections or insights! :]

Without further ado, let’s start learning OpenGL ES!

?

Open GL ES 1.0 vs OpenGL ES 2.0

First things first – you should know that there are two different versions of OpenGL ES (1.0 and 2.0), and they are very different.

OpenGL ES 1.0 uses a?fixed pipeline, which is a fancy way of saying you use built-in functions to set lights, vertexes, colors, cameras, and more.

OpenGL ES 2.0 uses a?programmable pipeline, which is a fancy way of saying all those built-in functions go away, and you have to write everything yourself.

“OMG!” you may think, “well why would I ever want to use OpenGL ES 2.0 then, if it’s just extra work?!” Although it does add some extra work, with OpenGL ES 2.0 you make some really cool effects that wouldn’t be possible in OpenGL ES 1.0, such as this toon shader (via?Imagination Technologies):

Or even these amazing lighting and shadow effects (via?Fabien Sanglard):

Pretty cool eh?

OpenGL ES 2.0 is only available on the iPhone 3GS+, iPod Touch 3G+, and all iPads. But the percentage of people with these devices is?in the majority now, so that’s what we’re going to focus on in this tutorial!

Getting Started

Although Xcode comes with an OpenGL ES project template, I think that’s confusing for beginners because you have to go through a lot of code you didn’t write yourself and try to understand how it works.

I think it’s easier if you write all the code from scratch, so you can understand how everything fits together – so that’s what we’re going to do here!

Start up Xcode, and go to File\New\New Project. Select iOS\Application\Window-based Application, and click Next. Name your project HelloOpenGL, click Next, choose a folder to save it in, and click Create.

Compile and run the app, and you should see a blank white screen:

The Window-based Application template is about as “from scratch” as you can get with project templates in Xcode. All it does is create a UIWindow and present it to the screen – no views, view controllers, or anything!

Let’s add a new view that we’ll use to contain the OpenGL content. Go to File\New\New File, choose iOS\Cocoa Touch\Objective-C class, and click Next. Enter UIView for Subclass of, click Next, name the new class OpenGLView.m, and click Save.

Next, you’ll add a bunch of code to OpenGLView.m inside the @implementation to just color the screen green for now.

Add each step here bit by bit, and I’ll explain what each part does as we go.

1) Add required frameworks

The first step is to add the two frameworks you need to use OpenGL – OpenGLES.frameworks and QuartzCore.framework.

To add these frameworks in Xcode 4, click on your HelloOpenGL project in the Groups & Files tree, and select the HelloOpenGL target. Expand the?Link Binary with Libraries?section, click the + button, and select OpenGLES.framework. Repeat for QuartzCore.framework as well.

2) Modify OpenGLView.h

Modify OpenGLView.h to look like the following:

#import <UIKit/UIKit.h> #import <QuartzCore/QuartzCore.h> #include <OpenGLES/ES2/gl.h> #include <OpenGLES/ES2/glext.h>@interface OpenGLView : UIView {CAEAGLLayer* _eaglLayer;EAGLContext* _context;GLuint _colorRenderBuffer; }@end

This imports the headers you need for OpenGL, and creates the instance variables that the methods you wrote earlier were using.

3) Set layer class to CAEAGLLayer

+ (Class)layerClass {return [CAEAGLLayer class]; }

To set up a view to display OpenGL content, you need to set it’s default layer to a special kind of layer called a CAEAGLLayer. The way you set the default layer is to simply overwrite the layerClass method, like you just did above.

4) Set layer to opaque

- (void)setupLayer {_eaglLayer = (CAEAGLLayer*) self.layer;_eaglLayer.opaque = YES; }

By default, CALayers are set to non-opaque (i.e. transparent). However, this is bad for performance reasons (especially with OpenGL), so it’s best to set this as opaque when possible.

5) Create OpenGL context

- (void)setupContext { EAGLRenderingAPI api = kEAGLRenderingAPIOpenGLES2;_context = [[EAGLContext alloc] initWithAPI:api];if (!_context) {NSLog(@"Failed to initialize OpenGLES 2.0 context");exit(1);}if (![EAGLContext setCurrentContext:_context]) {NSLog(@"Failed to set current OpenGL context");exit(1);} }

To do anything with OpenGL, you need to create an?EAGLContext, and set the current context to the newly created context.

An EAGLContext manages all of the information iOS needs to draw with OpenGL. It’s similar to how you need a Core Graphics context to do anything with Core Graphics.

When you create a context, you specify what version of the API you want to use. Here, you specify that you want to use OpenGL ES 2.0. If it is not available (such as if the program was run on an iPhone 3G), the app would terminate.

6) Create a render buffer

- (void)setupRenderBuffer {glGenRenderbuffers(1, &_colorRenderBuffer);glBindRenderbuffer(GL_RENDERBUFFER, _colorRenderBuffer); [_context renderbufferStorage:GL_RENDERBUFFER fromDrawable:_eaglLayer]; }

The next step to use OpenGL is to create a render buffer, which is an OpenGL object that stores the rendered image to present to the screen.

Sometimes you’ll see a render buffer also referred to as a color buffer, because in essence it’s storing colors to display!

There are three steps to create a render buffer:

  • Call?glGenRenderbuffers?to create a new render buffer object. This returns a unique integer for the the render buffer (we store it here in _colorRenderBuffer). Sometimes you’ll see this unique integer referred to as an “OpenGL name.”
  • Call?glBindRenderbuffer?to tell OpenGL “whenever I refer to GL_RENDERBUFFER, I really mean _colorRenderBuffer.”
  • Finally, allocate some storage for the render buffer. The?EAGLContext?you created earlier has a method you can use for this called renderbufferStorage.
  • 7) Create a frame buffer

    - (void)setupFrameBuffer { GLuint framebuffer;glGenFramebuffers(1, &framebuffer);glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, _colorRenderBuffer);}

    A frame buffer is an OpenGL object that contains a render buffer, and some other buffers you’ll learn about later such as a depth buffer, stencil buffer, and accumulation buffer.

    The first two steps for creating a frame buffer is very similar to creating a render buffer – it uses the glGen and glBind like you’ve seen before, just ending with “Framebuffer/s” instead of “Renderbuffer/s”.

    The last function call (glFramebufferRenderbuffer) is new however. It lets you attach the render buffer you created earlier to the frame buffer’s GL_COLOR_ATTACHMENT0 slot.

    8) Clear the screen

    - (void)render {glClearColor(0, 104.0/255.0, 55.0/255.0, 1.0);glClear(GL_COLOR_BUFFER_BIT);[_context presentRenderbuffer:GL_RENDERBUFFER]; }

    We’re trying to get something displaying on the screen as quickly as possible, so before dealing with vertexes, shaders, and the like, let’s just clear the entire screen to a particular color!

    Let’s set it to the main color of this website, which is RGB 0, 104, 55. Notice you have to divide the color values by 255 (the max color value), because the color range for each component is from 0 to 1.

    To accomplish this we have to take three steps here:

    • Call?glClearColor?to specify the RGB and alpha (transparency) values to use when clearing the screen.
    • Call?glClear?to actually perform the clearing. Remember that there can be different types of buffers, such as the render/color buffer we’re displaying, and others we’re not using yet such as depth or stencil buffers. Here we use the GL_COLOR_BUFFER_BIT to specify what exactly to clear – in this case, the current render/color buffer.
    • Call a method on the OpenGL context to present the render/color buffer to the UIView’s layer!

    9) Wrapup code in OpenGLView.m

    // Replace initWithFrame with this - (id)initWithFrame:(CGRect)frame {self = [super initWithFrame:frame];if (self) { [self setupLayer]; [self setupContext]; [self setupRenderBuffer]; [self setupFrameBuffer]; [self render]; }return self; }// Replace dealloc method with this - (void)dealloc {[_context release];_context = nil;[super dealloc]; }

    This is just some helper code to call all of the above methods, and clean up in dealloc.

    10) Hook up OpenGLView to the App Delegate

    Make the following changes to HelloOpenGLAppDelegate.h:

    // At top of file #import "OpenGLView.h"// Inside @interface OpenGLView* _glView;// After @interface @property (nonatomic, retain) IBOutlet OpenGLView *glView;

    And the following changes to HelloOpenGLAppDelegate.m:

    // At top of file @synthesize glView=_glView;// At top of application:didFinishLaunchingWithOptions CGRect screenBounds = [[UIScreen mainScreen] bounds]; self.glView = [[[OpenGLView alloc] initWithFrame:screenBounds] autorelease]; [self.window addSubview:_glView];// In dealloc [_glView release];

    This simply creates a new instance of the OpenGLView at startup, and attaches it to the window.

    And that’s it! Compile and run your project, and you should see a green screen drawn by OpenGL ES 2.0!

    Adding Vertex and Fragment Shaders

    In OpenGL ES 2.0, to render any geometry to the scene, you have to create two tiny little programs called shaders.

    Shaders are written in a C-like language called?GLSL. Don’t worry too much about studying up on the reference at this point – you can get just by looking at the examples in this tutorial for now.

    There are two types of shaders:

    • Vertex shaders?are programs that get called once per vertex in your scene. So if you are rendering a simple scene with a single square, with one vertex at each corner, this would be called four times. Its job is to perform some calculations such as lighting, geometry transforms, etc., figure out the final position of the vertex, and also pass on some data to the fragment shader.
    • Fragment shaders?are programs that get called once per pixel (sort of) in your scene. So if you’re rendering that same simple scene with a single square, it will be called once for each pixel that the square covers. Fragment shaders can also perform lighting calculations, etc, but their most important job is to set the final color for the pixel.

    Like I said, the easiest way to understand these is to look at some examples. Let’s keep things nice and simple and write the simplest possible vertex and fragment shaders we can!

    In Xcode, go to File\New\New File…, choose iOS\Other\Empty, and click Next. Name the new file SimpleVertex.glsl, and click Save.

    Open up SimpleVertex.glsl and add the following code:

    attribute vec4 Position; // 1 attribute vec4 SourceColor; // 2varying vec4 DestinationColor; // 3void main(void) { // 4DestinationColor = SourceColor; // 5gl_Position = Position; // 6 }

    Everything is new here, so let’s go over it line by line!

  • The?attribute?keyword declares that this shader is going to be passed in an input variable called Position. Later on, you’ll write some code to pass some data into this input variable. It will be used to indicate the position of the Vertex. Note that the type of the variable is a vec4, which means a vector with 4 components.
  • This declares a second input variable, for the color of the vertex.
  • This declares another variable, but it doesn’t have the attribute keyword, so is an output variable that will be passed to the fragment shader. It also has the?varying?keyword, which is a fancy way of saying “I’m going to tell you the value for a particular vertex, but when you need to figure out the value for a given pixel, figure it out by smoothing out the values between nearby vertexes.”
  • Huh? That last bit sounds confusing, but is actually pretty easy to understand if you see a picture:

    So basically, you can specify a different color for each vertex, and it will make all the values in-between a neat gradient! You’ll see an example of that for yourself soon.

  • Every shader begins with a main – just like C!
  • Sets the destination color for this vertex equal to the source color, and lets OpenGL interpolate the values as explained above.
  • There’s a built in output variable you have to set in the vertex shader called?gl_Position?equal to the final position of the vertex. Here was just set it to the original position without changing it at all.
  • OK, that’s it for our simple vertex shader! Let’s add a simple fragment shader next.

    Go to File\New\New File…, choose iOS\Other\Empty, and click Next. Name the new file SimpleFragment.glsl, and click Save.

    Open up SimpleFragment.glsl and add the following code:

    varying lowp vec4 DestinationColor; // 1void main(void) { // 2gl_FragColor = DestinationColor; // 3 }

    This is pretty short and sweet but let’s explain it line by line anyways:

  • This is the input variable from the vertex shader. It’s the exact same definition as the vetex shader had, except it has an additional keyword: lowp. Turns out when you specify variables in a fragment shader, you need to give it a precision. A good rule of thumb is try to use the lowest precision you can get away with, for a performance bonus. We set it to the lowest precision here, but there’s also medp and highp if you need it.
  • Just like in a vertex shader, a fragment shader also begins with main.
  • Just like you need to set gl_Position in the vertex shader, you have to set gl_FragColor in the fragment shader. This simply sets it to the destination color passed in (interpolated by OpenGL).
  • Not so bad, eh? Now let’s add some code to get start using these in our app.

    Compiling Vertex and Fragment Shaders

    We’ve added the two shaders to our Xcode project as glsl files, but guess what – Xcode doesn’t do anything with them except copy them into our application bundle.

    It’s the job our our app to compile and run these shaders – at runtime!

    You might be surprised by this (it’s kinda weird to have an app compiling code on the fly!), but it’s set up this way so that the shader code isn’t dependent on any particular graphics chip, etc.

    So let’s write a method we can use to compile these shaders. Open up OpenGLView.m and add the following method above initWithFrame:

    - (GLuint)compileShader:(NSString*)shaderName withType:(GLenum)shaderType {// 1NSString* shaderPath = [[NSBundle mainBundle] pathForResource:shaderName ofType:@"glsl"];NSError* error;NSString* shaderString = [NSString stringWithContentsOfFile:shaderPath encoding:NSUTF8StringEncoding error:&error];if (!shaderString) {NSLog(@"Error loading shader: %@", error.localizedDescription);exit(1);}// 2GLuint shaderHandle = glCreateShader(shaderType); // 3const char * shaderStringUTF8 = [shaderString UTF8String]; int shaderStringLength = [shaderString length];glShaderSource(shaderHandle, 1, &shaderStringUTF8, &shaderStringLength);// 4glCompileShader(shaderHandle);// 5GLint compileSuccess;glGetShaderiv(shaderHandle, GL_COMPILE_STATUS, &compileSuccess);if (compileSuccess == GL_FALSE) {GLchar messages[256];glGetShaderInfoLog(shaderHandle, sizeof(messages), 0, &messages[0]);NSString *messageString = [NSString stringWithUTF8String:messages];NSLog(@"%@", messageString);exit(1);}return shaderHandle;}

    OK, let’s go over how this works:

  • Gets an NSString with the contents of the file. This is regular old UIKit programming, many of you should be used to this kind of stuff already.
  • Calls?glCreateShader?to create a OpenGL object to represent the shader. When you call this function you need to pass in a shaderType to indicate whether it’s a fragment or vertex shader. We take ethis as a parameter to this method.
  • Calls?glShaderSource?to give OpenGL the source code for this shader. We do some conversion here to convert the source code from an NSString to a C-string.
  • Finally, calls?glCompileShader?to compile the shader at runtime!
  • This can fail – and it will in practice if your GLSL code has errors in it. When it does fail, it’s useful to get some output messages in terms of what went wrong. This code uses?glGetShaderiv?andglGetShaderInfoLog?to output any error messages to the screen (and quit so you can fix the bug!)
  • You can use this method to compile the vertex and fragmetn shaders, but there’s a few more steps – linking them together, telling OpenGL to actually use the program, and getting some pointers to the attribute slots where you’ll be passing in the input values to the shaders.

    Add a new method to do this right below compileShader:

    - (void)compileShaders {// 1GLuint vertexShader = [self compileShader:@"SimpleVertex" withType:GL_VERTEX_SHADER];GLuint fragmentShader = [self compileShader:@"SimpleFragment" withType:GL_FRAGMENT_SHADER];// 2GLuint programHandle = glCreateProgram();glAttachShader(programHandle, vertexShader);glAttachShader(programHandle, fragmentShader);glLinkProgram(programHandle);// 3GLint linkSuccess;glGetProgramiv(programHandle, GL_LINK_STATUS, &linkSuccess);if (linkSuccess == GL_FALSE) {GLchar messages[256];glGetProgramInfoLog(programHandle, sizeof(messages), 0, &messages[0]);NSString *messageString = [NSString stringWithUTF8String:messages];NSLog(@"%@", messageString);exit(1);}// 4glUseProgram(programHandle);// 5_positionSlot = glGetAttribLocation(programHandle, "Position");_colorSlot = glGetAttribLocation(programHandle, "SourceColor");glEnableVertexAttribArray(_positionSlot);glEnableVertexAttribArray(_colorSlot); }

    Here’s how each section works:

  • Uses the method you just wrote to compile the vertex and fragment shaders.
  • Calls?glCreateProgram,?glAttachShader, and?glLinkProgram?to link the vertex and fragment shaders into a complete program.
  • Calls?glGetProgramiv?and?glGetProgramInfoLog?to check and see if there were any link errors, and display the output and quit if so.
  • Calls?glUseProgram?to tell OpenGL to actually use this program when given vertex info.
  • Finally, calls?glGetAttribLocation?to get a pointer to the input values for the vertex shader, so we can set them in code. Also calls?glEnableVertexAttribArray?to enable use of these arrays (they are disabled by default).
  • Two last steps. Add the following method call to initWithFrame right before calling render:

    [self compileShaders];

    And declare the instance variables for _colorSlot and _positionSlot inside the @interface in OpenGLView.h as follows:

    GLuint _positionSlot; GLuint _colorSlot;

    You can compile and run now, and if it displays a green screen (and does not quit with an error), it means that your vertex and fragment shaders compiled OK at runtime!

    Of course, nothing looks differnet because we haven’t given the shaders any vertex geometry to render. So let’s take care of that next.

    Creating Vertex Data for a Simple Square

    Let’s start things nice and simple by rendering a square to the screen. The square will be set up like the following:

    When you render geometry with OpenGL, keep in mind that it can’t render squares – it can only render triangles. However we can create a square with two triangles as you can see in the picture above: one triangle with vertices (0, 1, 2), and one triangle with vertices (2, 3, 0).

    One of the nice things about OpenGL ES 2.0 is you can keep your vertex data organized in whatever manner you like. Open up OpenGLView.m and create a plain old C-structure and a few arrays to keep track of our square information, as shown below:

    typedef struct {float Position[3];float Color[4]; } Vertex;const Vertex Vertices[] = {{{1, -1, 0}, {1, 0, 0, 1}},{{1, 1, 0}, {0, 1, 0, 1}},{{-1, 1, 0}, {0, 0, 1, 1}},{{-1, -1, 0}, {0, 0, 0, 1}} };const GLubyte Indices[] = {0, 1, 2,2, 3, 0 };

    So basically we create:

    • a structure to keep track of all our per-vertex information (currently just color and position)
    • an array with all the info for each vertex
    • an array that gives a list of triangles to create, by specifying the 3 vertices that make up each triangle

    We now have all the information we need, we just need to pass it to OpenGL!

    Creating Vertex Buffer Objects

    The best way to send data to OpenGL is through something called Vertex Buffer Objects.

    Basically these are OpenGL objects that store buffers of vertex data for you. You use a few function calls to send your data over to OpenGL-land.

    There are two types of vertex buffer objects – one to keep track of the per-vertex data (like we have in the Vertices array), and one to keep track of the indices that make up triangles (like we have in the Indices array).

    So add a method above initWithFrame to create these:

    - (void)setupVBOs {GLuint vertexBuffer;glGenBuffers(1, &vertexBuffer);glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);GLuint indexBuffer;glGenBuffers(1, &indexBuffer);glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices), Indices, GL_STATIC_DRAW);}

    You can see that it’s pretty simple. It uses a similar pattern that you’ve seen before – calls?glGenBuffers?to create a new Vertex Buffer object,?glBindBuffer?to tell OpenGL “hey when I say GL_ARRAY_BUFFER, I really mean vertexBuffer”, and?glBufferData?to send the data over to OpenGL-land.

    And before we forget, add this to initWithFrame right before calling render:

    [self setupVBOs];

    Updated Render Code

    We have all of the pieces in place, finally we can update the render method to draw our new vertex data to the screen, using our new shaders!

    Replace render with the following:

    - (void)render {glClearColor(0, 104.0/255.0, 55.0/255.0, 1.0);glClear(GL_COLOR_BUFFER_BIT);// 1glViewport(0, 0, self.frame.size.width, self.frame.size.height);// 2glVertexAttribPointer(_positionSlot, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);glVertexAttribPointer(_colorSlot, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*) (sizeof(float) * 3));// 3glDrawElements(GL_TRIANGLES, sizeof(Indices)/sizeof(Indices[0]), GL_UNSIGNED_BYTE, 0);[_context presentRenderbuffer:GL_RENDERBUFFER]; }

    This works as follows:

  • Calls?glViewport?to set the portion of the UIView to use for rendering. This sets it to the entire window, but if you wanted a smallar part you could change these values.
  • Calls?glVertexAttribPointer?to feed the correct values to the two input variables for the vertex shader – the Position and SourceColor attributes.
  • This is a particularly important function so let’s go over how it works carefully.

    • The first parameter specifies the attribute name to set. We got these earlier when we called glGetAttribLocation.
    • The second parameter specifies how many values are present for each vertex. If you look back up at the Vertex struct, you’ll see that for the position there are three floats (x,y,z) and for the color there are four floats (r,g,b,a).
    • The third parameter specifies the type of each value – which is float for both Position and Color.
    • The fourth parameter is always set to false.
    • The fifth parameter is the size of the?stride, which is a fancy way of saying “the size of the data structure containing the per-vertex data”. So we can simply pass in sizeof(Vertex) here to get the compiler to compute it for us.
    • The final parameter is the offset within the structure to find this data. The position data is at the beginning of the structure so we can pass 0 here, the color data is after the Position data (which was 3 floats, so we pass 3 * sizeof(float)).

    Ok back to the final part of the code listing!

  • Calls?glDrawElements to make the magic happen! This actually ends up calling your vertex shader for every vertex you pass in, and then the fragment shader on each pixel to display on the screen.
  • This is also an important function so let’s discuss each parameter here as well.

    • The first parameter specifies the manner of drawing the vertices. There are different options you may come across in other tutorials like GL_LINE_STRIP or GL_TRIANGLE_FAN, but GL_TRIANGLES is the most generically useful (especially when combined with VBOs) so it’s what we cover here.
    • The second parameter is the count of vertices to render. We use a C trick to compute the number of elements in an array here by dividing the sizeof(Indices) (which gives us the size of the array in bytes) by sizeof(Indices[0]) (which gives us the size of the first element in the arary).
    • The third parameter is the data type of each individual index in the Indices array. We’re using an unsigned byte for that so we specify that here.
    • From the documentation, it appears that the final parameter should be a pointer to the indices. But since we’re using VBOs it’s a special case – it will use the indices array we already passed to OpenGL-land in the GL_ELEMENT_ARRAY_BUFFER.

    Guess what – you’re done! Compile and run the app and you should see a pretty rectangle on the screen:

    You may be wondering why this rectangle happens to fit perfectly on the screen. Well by default, OpenGL has the “camera” at (0,0,0), looking down the z-axis. The bottom left of the screen is mapped to (-1,-1), and the upper right of the screen is mapped to (1,1), so it “stretches” our square to fit the entire screen.

    Obviously, in a real app you’ll want to have more control over how the “camera” behaves. So let’s talk about how you can do that with a projection transform!

    Adding a Projection

    To make objects appear 3D on a 2D screen, we need to apply a projection transform on the objects. Here’s a diagram that shows how this works:

    Basically we have a “near” plane and a “far plane”, and the objects we want to display are in-between. The closer an object is to the “near” plane we scale it so it looks smaller, and the closer and object is to the “far” plane we scale it so it appears bigger. This mimics the way a human eye works.

    Let’s see how we can modify our app to use a projection. Start by opening SimpleVertex.glsl, and make the following changes:

    // Add right before the main uniform mat4 Projection;// Modify gl_Position line as follows gl_Position = Projection * Position;

    Here we add a new input variable called Projection. Notice that instead of marking it as an attribute, we mark it as a uniform. This means that we just pass in a constant value for all vertices, rather than a per-vertex value.

    Also note that the Projection is marked as a mat4 type. Mat4 stands for a 4×4 matrix. Matrix math is a big subject that we won’t really cover here, but for now just think of them as things you can use to scale, rotate, or translate vertices. We’ll pass in a matrix that moves our vertices around according to the Projection diagram above.

    Next, we set the final position of the vertex to be the Projection multiplied by the Position. The way you apply a matrix transform on something is to multiply like we did here! Order does matter by the way.

    Now you need to pass in the Projection matrix to your vertex shader. However, this involves some complicated linear algebra and sadly I have forgotten too much of that since my college days :[ But luckly you don’t need to understand it to use it, since this is well known stuff that many smart people have already solved!

    Smart people like Bill Hollings, the author of?Cocos3D. He’s written a full-featured 3D graphics framework that integrates nicely with Cocos2D (and maybe I’ll write a tutorial about it sometime!) But anyway, Cocos3D contains a nice Objective-C vector and matrix library that we can pull into this project quite easily.

    I’ve put the?Cocos3D Math Library files?you need into a zip (and removed a few unnecessary dependencies from them), so go ahead and download them and drag the files into your project. Make sure “Copy items into destination group’s folder (if needed)” is checked, and click Finish.

    Then add a new instance variable to OpenGLView.h inside the @interface:

    GLuint _projectionUniform;

    And make the following changes to OpenGLView.m:

    // Add to top of file #import "CC3GLMatrix.h"// Add to bottom of compileShaders _projectionUniform = glGetUniformLocation(programHandle, "Projection");// Add to render, right before the call to glViewport CC3GLMatrix *projection = [CC3GLMatrix matrix]; float h = 4.0f * self.frame.size.height / self.frame.size.width; [projection populateFromFrustumLeft:-2 andRight:2 andBottom:-h/2 andTop:h/2 andNear:4 andFar:10]; glUniformMatrix4fv(_projectionUniform, 1, 0, projection.glMatrix);// Modify vertices so they are within projection near/far planes const Vertex Vertices[] = {{{1, -1, -7}, {1, 0, 0, 1}},{{1, 1, -7}, {0, 1, 0, 1}},{{-1, 1, -7}, {0, 0, 1, 1}},{{-1, -1, -7}, {0, 0, 0, 1}} };

    Here we import the header for the math library, and call?glGetUniformLocation?to get the handle we need to set the Projection input variable in the vertex shader.

    Then, we use the math library to create a projection matrix. It comes with a nice and easy to use function that lets you specify the coordinates to use for the left/right and top/bottom for the planes, and the near and far z-coordinates.

    The way you pass that data to the vertex shader is through?glUniformMatrix4fv, and the CC3GLMatrix class has a handy glMatrix method that converts them matrix into the array format OpenGL uses.

    The last step is to tweak our vertices a bit so they fit within the near/far planes. This just sets the z-coordinate for each vertex to -7.

    Compile and run the app, and now you should see the square looking like it’s in the distance a bit!

    Adding Translation and Rotation

    It was kind of annoying to have to manually go through our vertex array and move everything backwards by manually changing the z-values to -7.

    That kind of thing is what matrix transforms are for! They allow you to move vertices around in space really easily.

    So far our vertex shader modifies the positions of our vertices by applying the projection matrix to each vertex, so why not apply a transform/scale/rotation matrix as well? We’ll call this a “model-view” transform.

    Let’s see how this works. Make the following changes to SimpleVertex.glsl:

    // Add right after the Projection uniform uniform mat4 Modelview;// Modify the gl_Position line gl_Position = Projection * Modelview * Position;

    You should understand this perfectly by now! We’re just adding another uniform input matrix to pass in, and applying the modelview matrix to the position.

    Then add a new instance variable to OpenGLView.h:

    GLuint _modelViewUniform;

    And make the following changes to OpenGLView.m:

    // Add to end of compileShaders _modelViewUniform = glGetUniformLocation(programHandle, "Modelview");// Add to render, right before call to glViewport CC3GLMatrix *modelView = [CC3GLMatrix matrix]; [modelView populateFromTranslation:CC3VectorMake(sin(CACurrentMediaTime()), 0, -7)]; glUniformMatrix4fv(_modelViewUniform, 1, 0, modelView.glMatrix);// Revert vertices back to z-value 0 const Vertex Vertices[] = {{{1, -1, 0}, {1, 0, 0, 1}},{{1, 1, 0}, {0, 1, 0, 1}},{{-1, 1, 0}, {0, 0, 1, 1}},{{-1, -1, 0}, {0, 0, 0, 1}} };

    Here we get the reference to the model view uniform input variable, and use the Cocos3D math library to create a new matrix, and populate it with a translation.

    The translation is -7 along the z-axis, so it fits within the near/far planes, and then something weird – the sin() of the current time?

    If you think back to trig in high school, you might remember that sin() is a function that returns values from -1 to 1, and cycles every PI iterations (3.14). So if we pass the current time in, this will cycle between -1 and 1 every 3.14 seconds.

    Compile and run the code, and you’ll see the square appear in the center properly (even though we set the z back to 0):

    However, nothing moves! Well if you think about it, that makes sense because we’re only calling render one time (upon init)!

    Let’s fix this by calling the render method every frame.

    Rendering and CADisplayLink

    Ideally we would like to synchronize the time we render with OpenGL to the rate at which the screen refreshes.

    Luckily, Apple provides an easy way for us to do this with CADisplayLink! It’s really easy to use so let’s just dive in. Make the following changes to OpenGLView.m:

    // Add new method before init - (void)setupDisplayLink {CADisplayLink* displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(render:)];[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; }// Modify render method to take a parameter - (void)render:(CADisplayLink*)displayLink {// Remove call to render in initWithFrame and replace it with the following [self setupDisplayLink];

    That’s it! With this CADisplayLink will call your render method every frame, and it will update the transformation based on the sin() of the current time, so the box will move back and forth!

    Gratuitous Rotation

    I don’t think this is quite cool enough. It would be even cooler if it rotated, then we’d feel like we’re really 3D!

    Add another instance variable to OpenGLView.h:

    float _currentRotation;

    Then add the following to OpenGLView.m, inside the render method, right after the call to populateFromTranslation:

    _currentRotation += displayLink.duration * 90; [modelView rotateBy:CC3VectorMake(_currentRotation, _currentRotation, 0)];

    Here we add a variable called _currentRotation, that will increment by 90 degrees every second.

    Next, we modify the model view matrix (which is currently a translation) to add a rotation as well. The rotation is along both the x and y axis, and 0 along the z axis.

    Compile and run your code, and now you’ll see the square flip with a cool 3D effect!

    Gratuitous 3D Cube

    And yet it’s still not cool enough! I’m sick of squares, time to move onto cubes.

    It’s really easy, simply comment out the Vertices and Indices arrays and add new ones in their place:

    const Vertex Vertices[] = {{{1, -1, 0}, {1, 0, 0, 1}},{{1, 1, 0}, {1, 0, 0, 1}},{{-1, 1, 0}, {0, 1, 0, 1}},{{-1, -1, 0}, {0, 1, 0, 1}},{{1, -1, -1}, {1, 0, 0, 1}},{{1, 1, -1}, {1, 0, 0, 1}},{{-1, 1, -1}, {0, 1, 0, 1}},{{-1, -1, -1}, {0, 1, 0, 1}} };const GLubyte Indices[] = {// Front0, 1, 2,2, 3, 0,// Back4, 6, 5,4, 7, 6,// Left2, 7, 3,7, 6, 2,// Right0, 4, 1,4, 1, 5,// Top6, 2, 1, 1, 6, 5,// Bottom0, 3, 7,0, 7, 4 };

    I got these vertices just by sketching out a cube on paper and figuring it out. I encourage you to try the same, it’s a good exercise!

    Compile and run, and w00t we have a 3D cube… or do we?

    It acts kinda like a cube, but doesn’t look quite right. Sometimes it seems like you can see the inside of the cube!

    Luckily we can solve this pretty easily by enabling depth testing in OpenGL. With depth testing, OpenGL can keep track of the z-coordinate for each pixel it wants to draw, and only draw the vertex if there isn’t someting in front of it already.

    Let’s add this in real quick. Add a new instance variable to OpenGLView.h:

    GLuint _depthRenderBuffer;

    Then make the following modifications to OpenGLView.m:

    // Add new method right after setupRenderBuffer - (void)setupDepthBuffer {glGenRenderbuffers(1, &_depthRenderBuffer);glBindRenderbuffer(GL_RENDERBUFFER, _depthRenderBuffer);glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, self.frame.size.width, self.frame.size.height); }// Add to end of setupFrameBuffer glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _depthRenderBuffer);// In the render method, replace the call to glClear with the following glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST);// Add to initWithFrame, right before call to setupRenderBuffer [self setupDepthBuffer];

    The setupDepthBuffer method creates a depth buffer, in a similar manner to creating a render/color buffer. However, note that it alloacates the storage using the?glRenderbufferStorage?method rather than the context’s renderBufferStorage method (which is a special case for the color render buffer used for the OpenGL view).

    Then we call?glFramebufferRenderbuffer?to associate the new depth buffer with the render buffer. Remember how I said that the frame buffer stores lots of different kinds of buffers? Well here’s our first new one to add other than the color buffer.

    In the render method, we clear the depth buffer on each update, and enable depth testing.

    Compile and run your project, and now you have an app with a rotating cube, using OpenGL ES 2.0, and made completely from scratch! :D

    Where To Go From Here?

    Here is the?sample project?with all of the code from the above tutorial.

    We’ve barely scratched the surface of OpenGL, but hopefully this helps give you guys a good grounding of the basics. Check out the?Part 2?in the series, where we take things to the next level by adding some textures to our cube!

    By the way, the reason I wrote this tutorial in the first place was because it was the winner of the tutorial poll on the sidebar from a few weeks back! Thank you to everyone who voted, and please be sure to keep voting in the sidebar and?suggesting tutorials?– we have a new tutorial vote every week!

    If you have any questions, comments, or advice for a n00b OpenGL programmer like me, please join the forum discussion below!

    轉載于:https://www.cnblogs.com/dabaopku/archive/2012/03/19/2406501.html

    總結

    以上是生活随笔為你收集整理的OpenGL ES 2.0 for iPhone Tutorial的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

    久久久久久久综合色一本 | 精品国产伦一区二区三区观看方式 | 深爱五月激情网 | 欧美一区二区三区四区夜夜大片 | 88av网站 | 日韩欧美有码在线 | 在线观看免费视频你懂的 | 69国产成人综合久久精品欧美 | 四虎在线观看精品视频 | 日韩三区在线 | 91麻豆国产福利在线观看 | 综合激情av | 亚洲精品国偷自产在线99热 | 天天射综合网视频 | 91精品久久久久久久91蜜桃 | 日韩视频一区二区三区在线播放免费观看 | 91精品1区2区 | 在线免费看片 | 久久99精品久久久久久清纯直播 | 香蕉在线视频播放网站 | 91手机在线看片 | 亚洲精品乱码久久久久v最新版 | 曰本三级在线 | 色婷婷在线视频 | 国内成人精品2018免费看 | 国产成人综合在线观看 | 亚洲国产中文字幕在线视频综合 | 四虎亚洲精品 | 国产在线一区二区三区播放 | 久久人人爽爽人人爽人人片av | 成人理论电影 | 四虎在线免费观看视频 | 日韩免 | 成人一级片在线观看 | 欧美久久久久久久久久久久久 | 欧美激情综合色综合啪啪五月 | 五月婷婷免费 | 国产一级不卡视频 | 亚洲精品成人 | 日韩va在线观看 | 欧美一区二区三区在线视频观看 | 久久欧美在线电影 | 久久精品视频5 | 亚洲精品视频在线观看网站 | 伊人五月天综合 | 99精品国产福利在线观看免费 | 男女拍拍免费视频 | 91尤物国产尤物福利在线播放 | 免费又黄又爽的视频 | 久久99久久99 | 日韩精品久久久久久中文字幕8 | 黄色录像av | 亚洲精品国偷拍自产在线观看蜜桃 | 黄色成年网站 | 日韩毛片久久久 | 欧美在线观看视频 | 综合天天网 | 中文字幕韩在线第一页 | 日日爱夜夜爱 | 亚洲国产欧美一区二区三区丁香婷 | bbbbb女女女女女bbbbb国产 | 日韩黄色在线电影 | 国产免费一区二区三区最新6 | 天天天天色射综合 | 天堂av在线中文在线 | 2022久久国产露脸精品国产 | 亚洲欧美日韩一级 | 婷婷久久五月天 | 97在线看片| 国内久久久| 热久久影视 | 一个色综合网站 | 天天干夜夜夜操天 | 婷婷九月丁香 | 欧美va电影| 91国内在线| 亚洲精品午夜国产va久久成人 | 韩国视频一区二区三区 | 欧洲视频一区 | 天天干天天天天 | 五月天婷婷丁香花 | 激情偷乱人伦小说视频在线观看 | 伊人五月天综合 | 夜夜骑日日操 | 国产日韩欧美在线观看 | 亚洲色综合 | 亚洲综合小说电影qvod | 亚洲精品乱码久久久久v最新版 | 深爱开心激情 | 一区二区三区在线不卡 | 久久久久久久久久久免费av | 日本视频久久久 | 国产毛片久久久 | 国产视频一区二区在线观看 | 玖玖精品视频 | 青春草视频在线播放 | 成人在线播放免费观看 | 91最新在线| 在线黄色观看 | 日韩中文字幕一区 | 亚洲波多野结衣 | 欧美精品一区二区三区一线天视频 | 国产精品999久久久 久产久精国产品 | aaa亚洲精品一二三区 | av黄色亚洲| 国产精品99久久久久久武松影视 | 亚洲高清av在线 | 亚洲2019精品 | 亚洲资源在线观看 | 亚洲一二区精品 | 伊人一级 | 天天色草 | 久久久久久中文字幕 | 久久精品人 | 成人精品国产免费网站 | 亚洲欧美经典 | 欧美资源在线观看 | 成人在线观看网址 | 精品免费一区二区三区 | 国产精品美女免费视频 | 丁香六月国产 | 91九色蝌蚪视频在线 | 中文超碰字幕 | 欧美日韩网站 | 91精品入口 | 国产又粗又猛又爽又黄的视频先 | 国产精品一区二区在线观看免费 | 在线看的av网站 | 黄色在线观看免费 | 久久在线视频精品 | 久久久黄色av | 日韩在线视频一区二区三区 | 国产精品久久久久久a | 天天干天天摸天天操 | 狠狠干夜夜爱 | 亚洲日本精品视频 | 成人一区二区三区在线观看 | 69av网| 色偷偷88888欧美精品久久久 | 久久五月婷婷综合 | 色婷婷亚洲 | 国产v欧美 | 中文字幕麻豆 | 国产精品久久久久久久久久白浆 | 天堂网一区二区三区 | 97在线视频免费 | 又粗又长又大又爽又黄少妇毛片 | 欧美 激情在线 | 亚洲国产精品电影 | 国产欧美久久久精品影院 | 九色自拍视频 | 日韩a在线观看 | 久久久精选 | 免费视频在线观看网站 | 色姑娘综合网 | 国产区欧美 | 在线免费观看黄色大片 | 久久国产成人午夜av影院潦草 | 国产亚洲高清视频 | 99免在线观看免费视频高清 | 国产精品一区二区av | 国产美女搞久久 | 日韩在线精品一区 | 蜜臀av性久久久久av蜜臀妖精 | 99国产免费网址 | 国内精品久久久久影院优 | 免费观看黄 | 欧美黄色软件 | 天天操天天爽天天干 | 国产精品久久久久久久久费观看 | 韩日精品在线 | 在线播放91 | 区一区二在线 | 狠狠狠色丁香婷婷综合久久五月 | 综合伊人久久 | 免费看成人片 | 免费福利影院 | 日韩精品一区二区三区中文字幕 | 免费久久99精品国产婷婷六月 | 天天射综合网视频 | 欧洲一区二区三区精品 | 免费看污在线观看 | 福利二区视频 | 亚洲一区二区精品3399 | 国产日韩一区在线 | 精品一区免费 | 五月婷婷综合激情 | 欧美在线视频不卡 | 久久草在线视频国产 | 91精品视频网站 | 免费在线黄 | 日本爽妇网| 黄色一级大片在线免费看国产一 | 在线亚洲人成电影网站色www | 蜜桃av人人夜夜澡人人爽 | 精品国模一区二区三区 | 91视频 - 88av| 国产精品综合在线观看 | 午夜精品一区二区三区可下载 | av网址aaa| 婷婷午夜天 | 成人午夜电影在线观看 | 黄色在线观看免费网站 | 国产精品一区久久久久 | 欧美最猛性xxxxx亚洲精品 | 欧美成人影音 | 爱爱av网站 | 成年人视频在线免费 | 国产视频资源在线观看 | 99这里有精品 | 国产综合激情 | 久草在线资源网 | 深夜成人av | 黄色亚洲精品 | 天天射天天做 | 在线观看网站黄 | 国产精品免费观看久久 | 99色在线| 日日操日日干 | 天天干,狠狠干 | 久久久综合电影 | 午夜三级理论 | 一区二区三区在线观看 | 日韩aa视频 | 色播亚洲婷婷 | 久久久免费精品国产一区二区 | 中文字幕国产精品一区二区 | 国产日韩欧美在线 | 久久久久免费观看 | 久久精品超碰 | 亚洲少妇自拍 | 久久久久女人精品毛片 | 久久精品国产v日韩v亚洲 | 天天噜天天色 | 婷婷去俺也去六月色 | 精品国产伦一区二区三区观看说明 | 久久免费成人网 | 久久99这里只有精品 | 成人av在线网址 | 激情婷婷av| 中文国产成人精品久久一 | 精品久久久久久久久亚洲 | 国产亚洲一区二区在线观看 | 成全在线视频免费观看 | 亚洲美女免费精品视频在线观看 | 久草在在线视频 | 91chinese在线 | 天天在线视频色 | 在线黄色av | 久久66热这里只有精品 | 久久久精品 | 高清av中文在线字幕观看1 | 久操视频在线观看 | 黄网站a | 久久精品一区二区国产 | 日日日日干| 三级黄色理论片 | 国产精品6 | 91亚洲精品久久久蜜桃网站 | 超碰在线公开免费 | 手机av在线免费观看 | 免费在线色视频 | 国产69久久久欧美一级 | 日韩毛片一区 | 日韩69视频| 亚av在线| 在线免费黄网站 | 国产真实精品久久二三区 | 国产成年免费视频 | 三级a毛片 | 97成人免费 | 久久久久久久久国产 | 久久久久久网站 | 免费情缘| 日韩资源视频 | 午夜影视一区 | 午夜影视剧场 | 国产精品免费看久久久8精臀av | 久久精品中文字幕一区二区三区 | 91精品国产综合久久婷婷香蕉 | av成人在线网站 | av中文在线 | 毛片99 | 激情丁香婷婷 | 粉嫩高清一区二区三区 | 成人丁香花 | 五月亚洲综合 | 性色av免费在线观看 | 欧美 另类 交 | 免费久久视频 | www.久久爱.cn | 黄色软件在线观看免费 | 美女在线免费观看视频 | 不卡国产视频 | 亚洲精品视频第一页 | 国偷自产视频一区二区久 | 亚洲最大激情中文字幕 | 亚洲精品福利在线观看 | 亚洲天天在线日亚洲洲精 | 日本精品久久久久中文字幕5 | 青春草免费视频 | 亚洲精品tv久久久久久久久久 | 国产视频亚洲 | 国产91免费在线观看 | 日韩 在线观看 | 91亚洲欧美激情 | 亚洲一区二区三区91 | 国产精品久久久久一区二区三区 | 又黄又爽的免费高潮视频 | 国产一区二区在线观看免费 | 黄色成年 | 亚洲国内精品在线 | 日韩一级电影在线 | 永久免费的啪啪网站免费观看浪潮 | 久久精品成人热国产成 | 国产精品一区二区三区在线播放 | 国产精品对白一区二区三区 | 成人一级片免费看 | 黄色一级免费 | 成人av免费播放 | 日韩视频一二三区 | 成人毛片网 | 91一区二区三区久久久久国产乱 | 99久久久国产精品免费观看 | av在线h| 久久久一本精品99久久精品 | 中文字幕 国产专区 | 久草在线视频免费资源观看 | 天天看天天干天天操 | 在线国产一区二区三区 | 久久综合中文色婷婷 | 午夜av一区 | 精品一区久久 | 国产99久久精品一区二区永久免费 | 91欧美精品 | 黄色软件网站在线观看 | 午夜精品视频一区 | 在线成人观看 | 精品欧美在线视频 | 日韩综合一区二区三区 | 日韩二区三区在线 | 精品欧美在线视频 | 欧美性生活久久 | 乱子伦av| 国产日韩精品在线观看 | 亚洲免费视频在线观看 | 国产亚洲成av人片在线观看桃 | 国产日韩精品久久 | 亚洲国产av精品毛片鲁大师 | 在线看污网站 | 国产精品手机播放 | 亚洲在线精品视频 | 国产精品手机在线播放 | 日韩精品免费专区 | 久久精品高清 | 欧美成人影音 | 一本一本久久a久久 | 国产精品视频久久久 | 草久中文字幕 | 婷婷丁香狠狠爱 | 国产精品毛片一区二区 | 在线韩国电影免费观影完整版 | 99在线免费观看 | 欧美精品久久久 | 欧美精品你懂的 | 五月婷婷亚洲 | 天堂av中文字幕 | 国产v亚洲v| 成人网444ppp | 99热播精品 | 久久久精品国产一区二区 | 欧美视频二区 | 久久成电影 | 欧美色综合天天久久综合精品 | 午夜精品久久久久久久久久久久久久 | 超碰在线个人 | 久草电影免费在线观看 | 性色在线视频 | 97超碰在| 中文字幕高清视频 | 在线导航福利 | 欧美精品久久人人躁人人爽 | 免费视频你懂的 | 久久在线观看视频 | 亚洲最新在线视频 | 久久人人爽人人爽人人 | 福利视频网站 | 中文av免费 | 国产精华国产精品 | 中文字幕中文字幕在线一区 | 男女免费av| 久久久久电影网站 | 欧美一级性 | 福利一区二区三区四区 | 日韩中文字幕免费看 | 色综合久久中文字幕综合网 | 视频在线观看一区 | 国产伦精品一区二区三区高清 | 色婷丁香| 国产精品一区二区无线 | 激情丁香久久 | 亚洲第一中文字幕 | 国产精品1区2区在线观看 | 小草av在线播放 | 国产伦理精品一区二区 | 一级黄色大片 | 免费男女羞羞的视频网站中文字幕 | 亚洲在线精品 | 狠狠干天天操 | 人人添人人澡人人澡人人人爽 | 国产va在线观看免费 | 国产成人高清 | 日韩91av| 狠狠操狠狠干天天操 | 免费在线观看的av网站 | 亚洲午夜精品一区二区三区电影院 | 久久 精品一区 | 国产精品第一 | 国产一区高清在线观看 | 91超在线 | 99热在线这里只有精品 | 草久视频在线观看 | 欧美精品被 | 天天色.com | 国产视频一 | 四虎伊人 | 视频在线在亚洲 | 成人a级网站 | 91一区啪爱嗯打偷拍欧美 | 人人看97 | 五月婷婷电影网 | 国产精品久久电影观看 | 伊在线视频 | 日韩精品中文字幕在线观看 | 久久狠狠一本精品综合网 | 午夜精品久久久久久久久久久 | 夜夜爽天天爽 | 亚洲黄色成人网 | 看片一区二区三区 | 91福利社在线观看 | 欧美人体xx | 欧美伦理一区二区三区 | 久久精品久久精品久久39 | 亚洲乱码精品 | 天天操天天曰 | 综合精品久久久 | 免费看精品久久片 | 天天天干天天天操 | 在线电影日韩 | 性色va | 久色免费视频 | 国产电影一区二区三区四区 | 日韩久久久久久久久久 | 天天综合入口 | 免费亚洲精品视频 | 欧美日韩xx | 看片网站黄色 | 五月开心婷婷网 | 国产九色视频在线观看 | 九九综合久久 | 精品一区二区三区久久久 | 亚洲影院天堂 | 久久亚洲精品国产亚洲老地址 | 国产精品免费成人 | 又黄又爽又湿又无遮挡的在线视频 | 深夜免费福利在线 | 国产字幕在线播放 | 午夜在线免费观看 | 亚洲欧美精品一区二区 | 国产福利精品一区二区 | av经典在线 | 91亚色视频在线观看 | 国产成人精品av | 狠狠色香婷婷久久亚洲精品 | 91在线观看欧美日韩 | 一区二区三区在线影院 | 亚洲国产美女精品久久久久∴ | 国产精品福利无圣光在线一区 | 天天操天天干天天玩 | 日韩精品视频久久 | 狠狠干天天 | 草久久久久 | 808电影| 韩国三级一区 | 欧美国产高清 | 中文字幕一区二区三区在线观看 | 欧美精品一区二区三区四区在线 | 天天综合网在线观看 | 国产精品精品国产婷婷这里av | 狠狠操狠狠操 | 在线观看视频黄色 | 精品理论片 | 99精品免费| 日韩黄色影院 | 91成人破解版 | 99精品热视频 | 国产一区二区免费在线观看 | 成人午夜毛片 | 日韩在线免费电影 | 午夜视频欧美 | 精品免费国产一区二区三区四区 | 久久天堂精品视频 | www免费网站在线观看 | 国产又粗又猛又黄视频 | 国产成人333kkk| 久香蕉| 色午夜 | 日本久久久久久 | 久久久久久久久久久久av | 久久久久久久久久久久久久av | 99国产一区二区三精品乱码 | 一级片免费在线 | av三级av | 欧美成人影音 | 99av国产精品欲麻豆 | 天天干天天干天天色 | 亚洲成人欧美 | 911香蕉 | 国产69精品久久久久久 | 国产一级免费观看视频 | 欧美日韩在线视频免费 | 丰满少妇麻豆av | 婷婷丁香色 | 亚洲成人一区 | 香蕉视频在线免费 | 日韩经典一区二区三区 | 国产免费专区 | 日韩电影中文字幕在线 | 波多野结衣一区二区三区中文字幕 | 一区二区三区视频 | 一级久久精品 | 色婷婷在线视频 | 欧洲亚洲国产视频 | 青青河边草免费直播 | 午夜精品久久久久久久久久久久 | 五月开心六月伊人色婷婷 | 97福利| 99热国产精品 | 欧美三人交 | 91天堂素人约啪 | 国产精品视频地址 | 在线只有精品 | 在线观看免费高清视频大全追剧 | 日韩中文字幕免费在线播放 | 欧美性色19p| 美女网站视频色 | 香蕉视频国产在线观看 | 911免费视频 | 国产精品一区二区久久久 | 精品国产人成亚洲区 | 精品久久久久久久久久久久久久久久久久 | 91av看片| 在线中文字幕av观看 | 经典三级一区 | 二区中文字幕 | 91视频免费看片 | 国产精品伦一区二区三区视频 | 国产高清不卡一区二区三区 | 国产精品国产三级国产aⅴ入口 | 久久精品亚洲精品国产欧美 | 人人爽人人爱 | 日日夜夜网 | 国产精品 999| 91亚洲欧美激情 | 97在线观看视频免费 | 免费av福利 | 日韩中文字幕免费视频 | 欧美日韩免费一区二区 | 国产视频亚洲精品 | 伊人影院在线观看 | 亚洲劲爆av | 中文字幕av在线电影 | 国产黄色片免费 | 美女网站视频一区 | 91中文字幕在线 | 国产在线精品福利 | 欧美人zozo | 91视频91色| 天天操月月操 | 日韩极品在线 | 国产精品中文久久久久久久 | 深爱激情综合网 | 二区三区毛片 | 成全免费观看视频 | 久久精品男人的天堂 | 五月香婷| 日日夜夜精品免费观看 | 91九色国产 | 午夜视频福利 | 欧美性大战 | 99热九九这里只有精品10 | 国产明星视频三级a三级点| 国产精品不卡一区 | 最近中文字幕 | 天天天天天天操 | 久草免费在线观看 | 欧美成人精品欧美一级乱黄 | 精品国产乱码久久久久久三级人 | 国产黄色特级片 | 天天爽夜夜爽人人爽一区二区 | 亚洲经典视频在线观看 | 国产亚洲欧美在线视频 | 特级黄色视频毛片 | 色91在线| 精品国产一区二区三区噜噜噜 | 99se视频在线观看 | 日韩免费在线观看 | 亚洲免费视频在线观看 | 国内精品99| 97视频在线免费播放 | 狠狠干干 | 中国一级片在线观看 | 又长又大又黑又粗欧美 | 97理论片 | 久久精品国产免费 | 日韩免费一级电影 | 精品国产亚洲日本 | 久久久一本精品99久久精品 | 色婷婷综合久久久久 | 欧美色综合天天久久综合精品 | 在线观看黄 | 国产成人av网站 | 免费在线观看污网站 | av综合在线观看 | 午夜久久精品 | 欧美乱大交 | 亚洲国产成人在线观看 | 国产成人1区 | 天天摸天天舔 | 丁香六月五月婷婷 | 久久亚洲精品电影 | 国产a视频免费观看 | 在线精品一区二区 | 亚洲精品网页 | 国产精品免费在线播放 | 深爱激情亚洲 | 国产精品精品久久久久久 | 国产永久免费 | 中文字幕一区二区三区在线视频 | 丁香六月在线 | 欧美日韩国产区 | 在线免费观看视频一区二区三区 | 成人av亚洲 | 在线观看www. | 国产91学生粉嫩喷水 | 欧美日韩视频免费看 | www黄色软件 | 91黄色影视 | 欧美日韩激情视频8区 | 欧美久久久久久久久久久久 | 久久国产色 | 天堂在线一区二区 | 91伊人久久大香线蕉蜜芽人口 | 99热这里有精品 | 精品一区二区在线免费观看 | 国产精品免费一区二区三区 | 久久久精品国产一区二区 | 日韩高清一区在线 | 在线小视频国产 | www色网站 | 性色av免费看 | 91精品小视频| 久久综合影视 | 在线观看涩涩 | 久久1电影院 | 激情深爱.com | 国产成人精品一二三区 | 亚洲免费在线视频 | 日韩在线免费小视频 | av三级av| 在线视频1卡二卡三卡 | 操操操人人人 | 亚洲黄色在线观看 | 日韩亚洲国产中文字幕 | 色伊人网 | 亚洲精品中文字幕视频 | 国产99久久九九精品免费 | a级国产片 | 欧美最爽乱淫视频播放 | 91最新国产| 免费观看成人 | 狠狠操狠狠干2017 | 91在线色 | 欧美日本啪啪无遮挡网站 | 天天插天天操天天干 | 国产高清免费在线播放 | 激情五月亚洲 | 国产精品日韩在线播放 | 欧美日韩视频一区二区三区 | 91视频在线 | 久久激情综合网 | 黄色国产高清 | 丰满少妇在线观看资源站 | 午夜精品久久久久久 | 国产高清精 | 可以免费看av | 四虎5151久久欧美毛片 | 亚洲精选视频免费看 | av在线免费观看黄 | 91麻豆精品国产91久久久无限制版 | 欧洲色综合| av免费在线观看1 | 午夜精品视频在线 | 911香蕉视频 | 色吊丝在线永久观看最新版本 | 五月天狠狠操 | 欧美一级视频免费 | 在线观看av网 | 欧美亚洲三级 | 九九有精品 | 不卡av电影在线观看 | 国产一区二区三区在线免费观看 | 99热这里只有精品久久 | 午夜精品久久久久久久久久 | 一区二区久久 | 久久99精品久久久久久清纯直播 | 国产精品久久久久影院 | 草莓视频在线观看免费观看 | 久久久国产精品麻豆 | 亚洲成a人片在线观看中文 中文字幕在线视频第一页 狠狠色丁香婷婷综合 | 日韩无在线 | 69久久99精品久久久久婷婷 | 中文字幕视频网站 | 天天操夜夜爱 | 国产区av在线 | av在线免费网站 | 国产尤物一区二区三区 | 天天爽网站 | 久久久国产在线视频 | 美女视频a美女大全免费下载蜜臀 | 久久国产精品99国产精 | 五月婷婷在线播放 | 国产成人精品在线观看 | 国产福利精品一区二区 | 亚洲精品久久激情国产片 | 亚洲国产精品久久久 | 在线观看视频亚洲 | 久草在线免 | 日韩视频一区二区三区在线播放免费观看 | 色婷婷综合成人av | 免费在线观看黄 | 欧洲精品视频一区 | 超碰在线观看av | 久草网在线观看 | 精品av网站 | 日韩免费视频在线观看 | 午夜精品一区二区三区视频免费看 | 日韩免费视频观看 | av大全在线观看 | 国产99在线免费 | 日韩在线网址 | 欧美激情视频一区 | 久久精品在线 | 国产成人99av超碰超爽 | 9999免费视频| 中文字幕在线观看你懂的 | 亚洲午夜剧场 | 日韩精品一区二区三区中文字幕 | 亚洲精品乱码久久久久久 | 久久97精品 | www99精品 | 欧美大片大全 | 精品免费视频123区 午夜久久成人 | 中文字幕亚洲不卡 | 国产高清不卡在线 | 精品久久久久久久久久 | 日本精品一区二区三区在线观看 | 色五月色开心色婷婷色丁香 | 日本久久久久 | 成人精品影视 | 狠狠色丁香久久综合网 | 久久精品国产一区二区三区 | 欧美国产日韩在线观看 | 色婷婷亚洲精品 | 亚洲无吗av | 日韩一区二区三 | 国产精品一区专区欧美日韩 | 在线之家免费在线观看电影 | 久久精品99国产精品亚洲最刺激 | 免费在线h | 欧美性色综合网 | 中文字幕一区二区三区精华液 | 免费一级毛毛片 | 欧美一二区视频 | 在线免费视频一区 | 午夜精品久久久久久久99 | 97超碰在 | 国产亚洲精品v | 白丝av免费观看 | 一本一本久久a久久 | 午夜在线免费视频 | 91色国产| 免费色网 | 亚洲春色综合另类校园电影 | 三级黄色三级 | 中文字幕丝袜美腿 | 久久99精品久久久久婷婷 | 亚洲美女免费精品视频在线观看 | 美女天天操 | 91久久国产综合精品女同国语 | 久久久国产精品成人免费 | 日日干天天爽 | 人人澡人人添人人爽一区二区 | 国产1级毛片 | 中文资源在线播放 | 超碰97人人爱 | 欧美精品一区二区三区一线天视频 | 国产精品久久久久久av | 久久精品区 | 午夜视频在线观看网站 | 91看片网址 | 欧美一级性生活视频 | 91av亚洲| 国产一区视频导航 | 亚洲国产精品成人va在线观看 | 欧美激情xxxx性bbbb | 国产一线在线 | 91九色国产视频 | 最新av网站在线观看 | 成人亚洲网 | 极品国产91在线网站 | 久久久久99精品成人片三人毛片 | 精品欧美小视频在线观看 | 中文字幕中文字幕中文字幕 | 欧美人人 | 天天干天天搞天天射 | 婷婷视频 | 特级毛片aaa | 成人午夜影视 | 不卡视频在线看 | 日韩免费在线观看网站 | 日韩在线电影一区 | 91视频在线免费下载 | 中文字幕在线视频一区二区 | 国内精品久久影院 | 在线观看不卡的av | 日韩午夜在线播放 | 美女网站视频免费都是黄 | 欧美在线久久 | 欧美日产在线观看 | 五月天色网站 | 免费国产ww | 九九亚洲视频 | 在线观看www视频 | 美女视频黄免费的久久 | 精品久久久免费 | 亚洲少妇xxxx | 欧美韩国日本在线观看 | 一二三精品视频 | 欧美小视频在线 | 在线 高清 中文字幕 | 日韩在线二区 | 亚洲午夜久久久久 | 日韩精品久久久久久中文字幕8 | 高清av免费看 | 成人99免费视频 | 日韩网站在线看片你懂的 | 亚洲精品资源在线观看 | 久久精品一区 | 欧美日韩视频在线观看一区二区 | 婷婷国产视频 | 久久久免费视频播放 | 五月天中文字幕 | 欧美日韩视频在线观看一区二区 | 免费看的视频 | 日韩高清免费观看 | 伊人婷婷| 久久av影视 | 涩涩成人在线 | 九九视频这里只有精品 | 天天操夜夜操夜夜操 | 中文字幕丝袜一区二区 | 亚洲成人资源 | 99热手机在线观看 | 伊人色综合久久天天网 | 就要色综合 | 国产午夜三级一区二区三桃花影视 | 综合久久久久久 | av黄色在线 | 色就色,综合激情 | 欧美日韩视频精品 | 日日夜操| 91日韩精品视频 | 国产资源免费在线观看 | 日本一区二区免费在线观看 | 国产亚洲精品久久久久久 | 国产原创在线 | 蜜桃视频成人在线观看 | 国产美女精品在线 | 丁香婷婷射 | 久久免费精彩视频 | 国产黄影院色大全免费 | 久久国产免费 | 91精品导航| 人人澡人 | 99久久爱| av韩国在线 | 一区二区毛片 | 亚洲最新视频在线播放 | 在线99视频| 欧美一区二区在线刺激视频 | 久久国产精品二国产精品中国洋人 | 国产亚州精品视频 | 99人成在线观看视频 | 三级黄色大片在线观看 | 免费av大片 | 日日日日干 | 国产免费又爽又刺激在线观看 | 免费看黄色91 | 亚洲综合在线发布 | 中文字幕在线观看免费高清完整版 | av高清不卡 | 午夜丁香网 | 欧美a级成人淫片免费看 | 国产精品高清一区二区三区 | 欧美色插 | www.婷婷色| 缴情综合网五月天 | 伊人久久一区 | 久久免费视频一区 | 91在线91| 日韩精品一区在线播放 | 免费三级a | 亚洲视频在线观看免费 | 精品美女久久久久 | 91精品入口| 午夜色影院| 国外调教视频网站 | 日韩欧美网站 | 国产精品久久久久aaaa九色 | 久久99精品国产麻豆宅宅 | 日韩免费在线观看视频 | 国产精品久久久久久久久久直播 | 超碰在线免费97 | 亚洲精品一区二区久 | 丁香六月婷婷开心 | 亚州激情视频 | 亚洲日本韩国一区二区 | 丁香六月国产 | 国产精品伦一区二区三区视频 | 在线观看亚洲国产 | 欧美色888 | 色婷婷狠狠18 | 456成人精品影院 | 国产精品嫩草影院99网站 | 久久免费视频播放 | av一级在线 | 伊人一级| 精品一区欧美 | av一级免费 | 久久热首页 | 91大神在线观看视频 | 伊人婷婷激情 | 欧美色图视频一区 | 国产成人精品久久二区二区 | 国产老太婆免费交性大片 | 久久五月网 | 日韩精品一区二区三区免费观看视频 | 欧美久草网 | 国产又粗又猛又爽又黄的视频免费 | 中文字幕最新精品 | 午夜久久久久久久久久久 | 日韩黄色在线 | 91香蕉视频在线 | 国产精品久久久久婷婷二区次 | 免费看片网址 | 奇米先锋| 夜夜嗨av色一区二区不卡 | 黄色福利网 | 中国一区二区视频 | 在线免费观看视频a | 99久久综合精品五月天 | 免费看搞黄视频网站 | 欧美日韩免费一区二区 | 尤物一区二区三区 | 涩涩色亚洲一区 | 久久久国产高清 | 9i看片成人免费看片 | 青草草在线 | 狠狠狠干狠狠 | 人人射人人澡 | 中文字幕免费成人 | 在线看岛国av | 在线一二区 | 97超碰在线视 | 国产在线精品观看 | 国产亚洲91 | 在线小视频你懂得 | 国产免费小视频 | 免费欧美 | 中文一区二区三区在线观看 | 国产精品中文久久久久久久 | 亚洲欧美偷拍另类 | 最近高清中文字幕 | 日韩精品最新在线观看 | 国产亚洲无 | 成年人电影免费在线观看 | 成人久久影院 |