All about OpenGL ES 2.x – (part 1_3)

download All about OpenGL ES 2.x – (part 1_3)

of 22

Transcript of All about OpenGL ES 2.x – (part 1_3)

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    1/22

    NinevehGL is coming Khronos EGL and Apple EAGL

    AllaboutOpenGLES2.x(part1/3)

    Hello everyone!

    Welcome again to a new serie of tutorial. This

    time lets talk about the magic of 3D world. Lets

    talk about OpenGL. I dedicated the last five

    months of my life entirely to go deep inside 3D

    world, Im finishing my new 3D engine (seems

    one of the greatest work that Ive done) and now

    is time to share with you what I know, all

    references, all books, tutorials, everything and,

    of course, learn more with your feedback.

    This serie is composed by 3 parts:

    Part 1 Basic concepts of 3D world and

    OpenGL (Beginners)

    Part 2 OpenGL ES 2.0 in-depth (Intermediate)

    Part 3 Jedi skills in OpenGL ES 2.0 and 2D graphics (Advanced)

    So if you are interested in some code, just jump to part 2/3, because in this first one Ill just talk

    about the concepts, nothing more.

    OK, lets start.

    AtaglanceWho of you never hear about OpenGL? OpenGL means Open Graphics Library and it is used a lot

    today in computer languages. OpenGL is the closest point between the CPU (which we, developers,

    run our applications based on a language) and the GPU (the graphics processor that exist in every

    Graphics Cards). So OpenGL need to be supported by the vendors of Graphics Cards (like NVidia)

    and be implemented by the OSs vendors (like Apple in his MacOS and iOS) and finally the OpenGL

    give to us, developers, an unified API to work with. This API is Language Free (or almost free). This

    is amazing, because if you use C, or C++, or Objective-C, or Perl, or C#, or JavaScript, wherever you

    use, the API always will be equivalent, will present the same behavior, the same functions, the same

    commands and is at this point that comes this tutorial serie! To deal with OpenGLs API to the

    developers.

    Before start talking about OpenGL API we need to have a good knowledge in 3D world. The history of

    3D

    world in computer language is bound to OpenGL history. So lets take a little look at a bit of history.

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    2/22

    Ashortstory

    About 20 years ago has a guy called Silicon Graphics (SGI) made a little kind of device. That device

    was able to show an illusion of reality. In a world of 2D images, that device dared to show 3D images,

    that simulate the perpective and depth of the human eye. That device was called IrisGL (probaly

    because it tries to simulate the eyes iris).

    Well, serious, that device was the first great Graphics Library. But it died fast, because to do what he

    did, he needed to control many things in computers like the graphical card, the windowing system,

    the basic language and even the front end. Its too much to just one company manages. So the SGI

    started to delegate some things like create graphics cards, manage the windowing, make the

    front end to other companies and get focus on the most important part of their Graphical Library. In

    1992 was launch the first OpenGL.

    In 1995 Microsoft released the Direct3D, the main competitor of OpenGL.

    And only in 1997 OpenGL 1.1 was released. But OpenGL becomes really interesting to me only in

    2004, which the OpenGL 2.0 was released with a great change. The Shaders, the programmable

    pipeline. I love it!

    And finally in 2007 we meet the OpenGL ES 2.0 wich bring to us the power of Shader and

    programmable pipeline to the Embedded Systems.

    Today you can the see the OpenGLs logo (or OpenGL ES) in many games, 3D applications, 2D

    applications and a lot of graphical softwares (specially in 3D softwares). OpenGL ES is used by

    PlayStation, Android, Nintendo 3DS, Nokia, Samsung, Symbian and of course by Apple with MacOS

    and iOS.

    OpenGLsGreatestRivalTalking about Microsoft Windows OS (Brugh!!)OK, do you remember I said that the first launch of OpenGL was in 1992? So at that time, Microsoft

    has their shiny Windows 3.1. Well, as Microsoft always believe that Nothing is created, everything is

    copied, Microsoft tries to copy OpenGL in what they called DirectX and introduced it in 1995 on

    Windows 95.

    One year later, in 1996, Microsoft introduced Direct3D which is a literal copy of OpenGL. The point is

    that Microsoft dominate the info market for years, and DirectX or (Direct3D) penetrated and grabbed

    like a plague in many computers (PCs) and when Microsoft started to deliver their OS to the mobiles

    and video games, DirectX goes together.

    Today DirectX is very similar in structure to OpenGL: has a Shader Language, has a programmable

    pipeline, has fixed pipeline too, even the names of the function in the API are similar. The difference is

    that OpenGL is OPEN, but DirectX is closed. OpenGL is for iOS, MacOS and Linux Systems while the

    DirectX is just for Microsoft OS.

    Great, now lets start our journey into 3D world!

    3DworldFirst Point The EyeSince I can remember, I was passionate by 3D world and 3D games. All that we, humans, know about

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    3/22

    simulate the real world in a 3D illusion comes from just one single place: our eye.

    The eye is the base of everything in 3D world. All that we do is to simulate the power, the beauty and

    the magic of the humans eye. Im not a doctor (despite being the son of two) and dont want to talk

    about the eye in this tutorial, but will be good if youre used to some concepts like: field of view,

    binocular and monocular vision, eyes lens, concave and convex lens, and this kind of things, this can

    help you to understand some concepts.

    Everything we do in 3D world is to recreate the sensations from the human eye: the perpectives, the

    vanish points, the distortions, the depth of field, the focus, the field of view, in resume, everything is

    to simulate that sensations.

    Second Point The Third DimensionThis can seems stupid, but its necessary to say: 3D world is 3D because has 3 dimensions. WTF!

    This is so obviously!, calm down, dude, Im speaking this because is important to say that an

    addition of one single dimension (compared to 2D world) led us into serious troubles. That does not

    create 1 or 3 little problems, but drive us into a pool of troubles.

    Look, in 2D world when we need to rotate a square is very simple, 45 degrees always will led our

    square to a specific rotation, but in 3D world, to rotate a simple square requires X, Y and Z rotation.

    Depending on which order we rotate first, the final result can be completely different. The things

    becomes worse when we make consecutive rotations, for example, rotate x = 25 and Y = 20 is one

    thing, but rotate x = 10, y = 20 and then x = 10 again is a completely new result.

    Well, the point here is to say that an addition of one another dimension makes our work be stupidly

    multiplied.

    Third Point Its not 3D its often 4D.WTF! Another dimension?

    Yes dude, the last point that I need to say is it. Often we dont work just in a 3D world, we have a

    fourth dimension: the time. The things in 3D world need to interact, need to move, need to accelerate,

    need to collide itself, need to change their inertias. And as I told before, make consecutive changes in

    3D world can drive us into multiple results.

    OK, until now we have a phrase to define the 3D world: Is the simulation of the human eye and

    everything moves..

    OpenGLintothe3DworldNow this tutorial starts to be a little more fun. Lets talk about the great engine OpenGL. First we need

    to thank to great mathematicians like Leonhard Euler, William Rowan Hamilton, Pythagoras and so

    many others. Thanks to them, today we have so many formulas and techniques to work with 3D

    space. OpenGL used all this knowledge to construct a 3D world right on our face. Are thousands,

    maybe millions of operations per second using a lot of formulas to simulate the beauty of the human

    eyes.

    OpenGL is a great STATE MACHINE (this means that entire OpenGL works with the State Design

    Pattern). To illustrate what OpenGL is, lets imagine a great Port Crane in some port. There are so

    many containers with a lot of crates inside. OpenGL is like the whole port, which:

    The containers are the OpenGLs objects. (Textures, Shaders, Meshes and this kind of stuff)

    The crates inside each containers is what we created in our applications using the OpenGL. Are

    our instances.The port crane is the OpenGL API, which we have access.

    So when we execute an OpenGLs function is like give an order to the Crane. The Crane takes the

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    4/22

    container in the port, raises it, hold it for a while, process what you want inside that container and

    finally brings the container down again and drop it at some place in the port.

    You dont have access directly to the port, you cant see or change the containerss contents, you

    cant reorganize it, you cant do anything directly to the containers in the port. All that you can is give

    instructions to the Crane. The Crane is the only that can manage the containers in the port.

    Remember this! Is the most important information about OpenGL until here. The Crane is the onlyone that can manage the containers in the port.

    OpenGL is a State Machine and works just like a Port Crane.

    Well, OpenGL seems a very limited API at this way, but not is. The OpenGLs Crane is a very very

    powerful one. It can repeat the process of hold and drop the containers thousand or millions of times

    per a single second. Another great advantage of OpenGL uses a State Machine pattern is we dont

    have to hold any instance, we dont need to create any object directly, we just need to hold on the ids,

    or in the illustrations words, we just need to know the containers identification.

    HowOpenGLworksDeeply into the OpenGLs core the calculations are done directly in the GPU using the hardware

    acceleration to floating points. Hugh?

    CPU (Central Processing Unit) is the Processor of a computer or device. GPU (Graphics Processing

    Unit) is the graphics card of a computer or device. The Graphics Card comes to relieve the

    Processors life because it can make a lot of computations to deal with images before present the

    content to the screen.

    So in deeply, what OpenGL does is let all the mass computations to the GPU, instead to calculate all

    in the CPU. The GPU is much much faster to deal with floating point numbers than the CPU. This is

    the fundamental reason to a 3D game run faster with better Graphics Cards. This is even the reason

    because 3D professional softwares give to you an option to work with Softwares Render (CPU

    processing) or Graphics Cards Render (CPU processing). Some softwares also give you an option

    of OpenGL, well, now you know. That option is GPU processing!

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    5/22

    So, is OpenGL working entirely in the GPU?

    Not quite.

    Just a hard image processing and few other things. OpenGL gives to us a lot of features to store

    images, datas and informations in an optimized format. These optimized data will be processed later

    directly by the GPU.

    So, is OpenGL hardware dependent?

    Unfortunately yes! If the hardware (Graphics Card) doesnt support the OpenGL, we cant use it.

    New OpenGLs version often needs new GPU features.

    This is something to know, but not to worry. As OpenGL always needs a vendors implementations,

    we (developers) will work on new OpenGLs version just when the devices was prepared to it.

    In practice, all Graphics Card Chips today has an implementation of OpenGL. So you can use OpenGL

    in many languages and devices. Even in the Microsoft Windows. (Brugh)

    OpenGLsLogicOpenGL is a Graphics Library very concise and focused.

    What you see in professional 3D softwares is a super ultra complex work above the OpenGL.

    Because in deeply, OpenGLs logic is aware about some few things:

    Primitives

    Buffers

    Rasterize

    Just it? 3 little things?

    Believe, OpenGL works around these 3 concepts. Lets see each concept independently and how the

    three can join to create the most advanced 3D Graphics Library (also you can use OpenGL to 2D

    graphics. 2D images to OpenGL is just a 3D working all in the Z depth 0, well talk about later on).

    Primitives

    OpenGLs primitives is limited to 3 little kind of objects:

    About a 3D Point in space (x,y,z)

    About a 3D Line in space (composed by two 3D Points)

    About a 3D Triangle in space (composed by three 3D Points)

    A 3D Point can be used as a particle in the space.

    A 3D Line is always a single line and can be used as a 3D vector.

    A 3D Triangle could be one face of a mesh which has thousands, maybe millions faces.

    Some OpenGLs versions also support quads (quadrangles), which is merely an offshoot of triangles.

    But as OpenGL ES was made to achieve the maximum performance, quads are not supported.

    BuffersNow lets talk about the buffers. In simple words, buffer is a temporary optimized storage. Storage for

    what? For a lot of stuffs.

    OpenGL works with 3 kind of buffers:

    FrameBuffers

    RenderBuffers

    BufferObjects

    FrameBuffers is the most abstract of the three. When you make an OpenGLs render you can send

    the final image directly to the devices screen or to a Frame Buffer. So Frame Buffer is a temporary

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    6/22

    image data, right?

    Not exactly. You can image it as an output from an OpenGLs render and this can means a set of

    images, not just one. What kind of images? Images about the 3D objects, about the depth of objects

    in space, the intersection of objects and about the visible part of objects. So the Frame Buffer is like a

    collection of images. All of these stored as a binary array of pixels information.

    RenderBuffer is a temporary storage of one single image. Now you can see more clearly that aFrame Buffer is a collection of Render Buffers. Exist few kinds of Render Buffer: Color, Depth and

    Stencil.

    Color Render Buffer stores the final colored image generated by OpenGLs render. Color Render

    Buffer is a colored (RGB) image.

    Depth Render Buffer stores the final Z depth information of the objects. If you are familiar to the

    3D softwares, you know what is a Z depth image. Its a grey scale image about the Z position of

    the objects in 3D space, in which the full white represent most near visible object and black

    represent the most far object (the full black is invisible)

    Stencil Render Buffer is aware about the visible part of the object. Like a mask of the visibleparts. Stencil Render Buffer is a black and white image.

    BufferObjects is a storage which OpenGL calls server-side (or servers address space). The Buffer

    Objects is also a temporary storage, but not so temporary like the others. A Buffer Object can persist

    throughout the application execution. Buffer Objects can hold informations about your 3D objects in

    an optimized format. These information can be of two type: Structures or Indices.

    Structures is the array which describe your 3D object, like an array of vertices, an array of texture

    coordinates or an array of whatever you want. The Indices are more specifics. The array of indices isto be used to indicate how the faces of your mesh will be constructed based on an array of

    structures.

    Seems confused?

    OK, lets see an example.

    Think about a 3D cube. This cube has 6 faces composed by 8 vertices, right?

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    7/22

    3D cube with 8 vertices and 12 faces.

    Each of these 6 faces are quads, but do you remember that OpenGL just knows about triangles? So

    we need to transform that quads into triangles to work with OpenGL. When we do this, the 6 faces

    become 12 faces!

    The above image was made with Modo, look at the down right corner. That are informations given by

    Modo about this mesh. As you can see, 8 vertices and 12 faces (GL: 12).

    Now, lets think.

    Triangles in OpenGL is a combination of three 3D vertices. So to construct the cubes front face we

    need to instruct OpenGL at this way: {vertex 1, vertex2, vertex 3}, {vertex 1, vertex 3, vertex 4}. Right?

    In other words, we need to repeat the 2 vertices at each cubes face. This could be worst if our mesh

    has pentangle we need to repeat 4 vertices informations, if was an hexangle we need to repeat 6

    vertices informations, a septangle, 8 vertices informations and so on.

    This is much much expansive.

    So OpenGL give us a way to do that more easily. Called Array of Indices!

    In the above cubes example, we could has an array of the 8 vertices: {vertex 1, vertex 2, vertex 3,

    vertex 4, } and instead to rewrite these informations at each cubes faces, we construct an array of

    indices: {0,1,2,0,2,3,2,6,3,2,5,6}. Each combination of 3 elements in this array of indices (0,1,2 0,2,3

    6,3,2) represent a triangle face. With this feature we can write vertexs information once and reuse

    it many times in the array of indices.

    Now, returning to the Buffer Objects, the first kind is an array of structures, as {vertex 1, vertex 2,

    vertex 3, vertex 4, } and the second kind is an array of indices, as {0,1,2,0,2,3,2,6,3,2,5,6}.

    The great advantages of Buffer Objects is they are optimized to work directly in the GPU processing

    and you dont need hold the array in your application any more after create a Buffer Object.

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    8/22

    RasterizeThe rasterize is the process by which OpenGL takes all informations about 3D objects (all that

    coordinates, vertices, maths, etc) to create a 2D image. This image will suffer some changes and

    then it will be presented on the devices screen (commonly).

    But this last step, the bridge between pixel informations and the devices screen, its a vendors

    responsibility. The Khronos group provide another API called EGL, but here the vendors can interfere.

    We, developers, dont work directly with Khronos EGL, but with the vendors modified version.

    So, when you make an OpenGL render you can choose to render directly to the screen, using the

    vendors EGL implementation, or render to a Frame Buffer. Rendering to a Frame Buffer, you still in

    the OpenGL API, but the content will not be showed onto devices screen yet. Rendering directly to

    the devices screen, you go out the OpenGL API and enter in the EGL API. So at the render time, you

    can choose one of both outputs.

    But dont worry about this now, as I said, each vendor make their own implementation of EGL API.

    The Apple, for example, doesnt let you render directly to the devices screen, you always need torender to a Frame Buffer and then use EGLs implementation by Apple to present the content on the

    devices screen.

    OpenGLspipelinesI said before about programmable pipeline and fixed pipeline. But what the hell is a

    programmable pipeline? In simple words?

    The programmable pipeline is the Graphics Libraries delegating to us, developers, the responsibility

    by everything related to Cameras, Lights, Materials and Effects. And we can do this working with the

    famous Shaders. So every time you hear about programmable pipeline think in Shaders!

    But now, what the hell is Shaders?

    Shaders is like little pieces of codes, just like little programs, working directly in the GPU to make

    complex calculations. Complex like: the final color of a surfaces point which has a T texture,

    modified by a TB bump texture, using a specular color SC with specular level SL, under a light L with

    lights power LP with a incidence angle LA from distance Z with falloff F and all this seeing by the

    eyes of the camera C located on P position with the projections lens T.

    Whatever this means, its much complex to be processed by the CPU and is so much complex to

    Graphics Libraries continue to care about. So the programmable pipeline is just us managing that

    kind of thing.

    And the fixed pipeline?

    Its the inverse! The fixed pipeline is the Graphics Library caring about all that kind of things and

    giving to us an API to set the Cameras, Materials, Lights and Effects.

    To create shaders we use a language similar to C, we use the OpenGL Shader Language (GLSL).OpenGL ES use a little more strict version called OpenGL ES Shader Language (also known as GLSL

    ES or ESSL). The difference is that you have more fixed functions and could write more variables in

    GLSL than in GLSL ES, but the sintax is the same.

    Well, but how did works these shaders?

    You create them in a separated files or write directly in your code, whatever, the important thing is

    that the final string containing the SL will be sent to the OpenGLs core and the core will compile the

    Shaders to you (you even can use a pre-compiled binary shaders, but this is for another part of this

    serie).

    The shaders works in pairs: Vertex Shader and Fragment Shader. This topic needs more attention, so

    lets look closely to the Vertex and Fragment shaders. To understand what each shader does, lets

    back to the cube example.

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    9/22

    To render a 3D cube, OpenGL's programmable pipeline uses a Vertex Shader and a Fragment Shader.

    Vertex ShaderVertex Shader, also known as VS or VSH is a little program which will be executed at each Vertex of a

    mesh.

    Look at the cube above, as I said early, this cube needs 8 vertices (now in this image the vertex 5 is

    invisible, you will understand why shortly).

    So this cubes VSH will be processed 8 times by the GPU.

    What Vertex Shader will do is define the final position of a Vertex. Do you remember that

    programmable pipeline has left us the responsible by the camera? So now is its time!

    The position and the lens of a camera can interfere in the final position of a vertex. Vertex Shader is

    also responsible to prepare and output some variables to the Fragment Shader. In OpenGL we can

    define variable to the Vertex Shader, but not to the Fragment Shader directly. Because that, our

    Fragments variables must pass through the Vertex Shader.

    But why we dont have access to the Fragment Shader directly?

    Well, lets see the FSH and you will understand.

    Fragment ShaderLook at the cube image again.

    Did you notice vertex 5 is invisible? This is because at this specific position and specific rotation, we

    just can see 3 faces and these 3 faces are composed by 7 vertices.

    This is what Fragment Shader does! FSH will be processed at each VISIBLE fragment of the final

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    10/22

    image. Here you can understand a fragment as a pixel. But normally is not exactly a pixel, because

    between the OpenGLs render and the presentation of the final image on the devices screen has

    stretches. So a fragment can result in less than a real pixel or more than a real pixel, depending on

    the device and the renders configurations. In the cube above, the Fragment Shader will be processed

    at each pixel of that three visible faces formed by 7 vertices.

    Inside the Fragment Shader we will work with everything related to the mesh surface, like materials,bump effects, shadow and light effects, reflections, refractions, textures and any other kind of effects

    we want. The final output to the Fragment Shader is a pixel color in the format RGBA.

    Now, the last thing you need to know is about how the VSH and FSH works together. Its mandatory

    ONE Vertex Shader to ONE Fragment Shader, no more or less, must be exactly one to one. To ensure

    well not make mistakes, OpenGL has something called Program. A Program in OpenGL is just the

    compiled pair of VSH and FSH. Just it, nothing more.

    ConclusionVery well!

    This is all about the OpenGLs concepts. Lets remember of everything.

    OpenGLs logic is composed by just 3 simple concepts: Primitives, Buffers and Rasterize.

    Primitives are points, lines and triangles.

    Buffers can be Frame Buffer, Render Buffer or Buffer Objects.

    Rasterize is the process which transform OpenGL mathematics in the pixels data.

    1.

    OpenGL works with fixed or programmable pipeline.

    The fixed pipeline is old, slow and large. Has a lot of fixed functions to deal with Cameras,

    Lights, Materials and Effects.

    The programmable pipeline is more easy, fast and clean than fixed pipeline, because in

    the programmable way OpenGL let to us, developers, the task to deal with Cameras,

    Lights, Materials and Effects.

    2.

    Programmable pipeline is synonymous of Shaders: Vertex Shader, at each vertex of a mesh,

    and Fragment Shader, at each VISIBLE fragment of a mesh. Each pair of Vertex Shader andFragment Shader are compiled inside one object called Program.

    3.

    Looking at these 3 topics, OpenGL seems very simple to understand and learn. Yes! It is very simple

    to understand but to learn hmmm

    The 3 little topics has numerous ramifications and to learn all about can take months or more.

    What Ill try to do in the next two parts of this serie is give to you all what Ive learned in 6 immersive

    months of deeply hard OpenGLs study. In the next one, Ill will show you the basic functions and

    structures of a 3D application using the OpenGL, independently of which programming language you

    are using or which is your final device.

    But before it, I want to introduce you one more OpenGLs concept.

    OpenGLsErrorAPIOpenGL is a great State Machine working as a Port Crane and you dont have access to what happen

    inside it. So if an error occurs inside it, nothing will happens with your application, because OpenGL

    is a completely extern core.

    But, how to know if just one of your shaders has a little error? How to know if one of your render

    buffers is not properly configured?

    To deal with all the errors, OpenGL gives to us an Error API. This API is very very simple, it has few

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    11/22

    fixed function in pairs. One is a simple check, Yes or Not, just to know if something was done with

    successful or not. The other pair is to retrieve the error message. So is very simple. First you check,

    very fast, and if has an error then you get the message.

    Generally we place some checks in critical points, like the compilations of the shaders or buffers

    configurations, to stay aware about the most communs errors.

    OntheNextOK, dude, now we are ready to go.

    At next tutorial lets see some real code, prepare your self to write a lot.

    Thanks for reading and see you in the next part!

    NEXTPART: Part 2 OpenGL ES 2.0 in deeply (Intermediate)

    3D, iPad, iPhone, Objective-C, OpenGL, OpenGL ES, Xcode

    Abouttheauthor

    I'm passionate by the miracle of creation! Sometimes I look at the world and can

    see the lines of code behind it.

    Print

    article

    This entry was posted by Diney Bomfim on January 30, 2011 at 17:21, and is filed under

    3D, Feature, Objective-C, OpenGL. Follow any responses to this post through RSS 2.0.You can leave a response or trackback from your own site.

    Share

    thispost!

    RELATEDPOSTSTRACKBACKS(9)

    Great !!!

    This first part of the tutorial is great !!!, I have read a lot of tutorials and a few books,

    and this one is so clear and concise.

    great work.

    thank you very much, great tutorial, looking forward to the other. my first time to hear

    EGL:-)

    Thanks for the tutorial, great job! Looking forward to the third installation.

    #1writtenbymimestim

    about 1 year ago

    #2writtenbycjren

    about 1 year ago

    #3writtenbyRyan

    about 1 year ago

    #4writtenbymanubharghav

    COMMENTS(51)

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    12/22

    awesome tutorial!! thanks you..

    Great introduction to the basic concepts. Just what I needed, having looked at other

    tutorials that just start walking you through code right away.

    Thank you all guys,

    Keep reading the next parts.

    You said it all right there brother

    Dazmo:

    You said it all right there brother

    Im passionate by the miracle of creation! Sometimes I look at the world and can see

    the lines of code behind it.

    that, especially.

    Hey buddy,

    Thank you!

    Its awesome find someone thinking the same.

    Great work! All the 3 parts are very well written!

    about 1 year ago

    #5writtenbyRichard

    about 1 year ago

    #6writtenbyDineyBomfim

    about 1 year ago

    #7writtenbyDazmo

    about 1 year ago

    #8writtenbyDazmo

    about 1 year ago

    #9writtenbyDineyBomfim

    about 1 year ago

    #10writtenbyDigitalEye

    about 1 year ago

    #11writtenbyalex

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    13/22

    Hi.everyone im new to openGL and want to ask a simple question (im super new) HOW

    do you get to open GL? do you use a program to see it or how?do u go to cmd?

    command? or does OpenGL needs a program to run? in your pc?sorry about the

    question i just dont get it?also im using eclipe and java to do works.

    Hi buddy!

    Dont be shy, you did a great question. Its really a very important part and we

    are used to just talk superficially about.

    For example, I said: So, is OpenGL hardware dependent? Unfortunately Yes!,

    well, I meant: OpenGL cant be downloaded or installed by anyone. Its

    implemented directly by the vendors. For example, Apple implements OpenGL in

    their OS and their devices. The same happens with Symbian, Android, Windows

    Mobile, Playstation, etc

    It must be like this because OpenGL runs directly on the GPU, the graphics card,

    so we cant install nothing related to OpenGL.

    The Khronos Group (creators of OpenGL) made a solid API to us developers.

    That API should be fully supported by any vendor that implements OpenGL.

    So we, developers, have working on that API and this is the subject of the next

    tutorials of this series.

    Thank God, I found this!

    One of the best kick-start for me.

    This truly helped me understand important points for

    OpenGL es.no other article/book did any great

    Great work.moving to your second part

    Thanks

    Hey nice article.

    about 1 year ago

    #12

    writtenbyDineyBomfim

    about 1 year ago

    #13writtenbyRyanMorales

    about 1 year ago

    #14writtenbyAmal

    about 1 year ago

    #15writtenbyBub

    about 1 year ago

    #16writtenbyiNeoo

    about 1 year ago

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    14/22

    very nice tutorial, clean and clear, thank you o much cause created this.

    Hi,

    Thanks for your gr tutorial. I am new to OpenGL. I would like to reconstruct 3d images

    from a set of dicom images. I hope you are aware of dicom images. I am planning to

    use OpenGLES for generating 3d view of images. Like I have a set of images as an

    image stack or image array. I want to generate 3d view of those images in android.

    The images are the output of ct scan or MRI scan. I am planning to use 3.0 or above of

    android. So my first question is, is it possible in android to generate a 3D view from an

    array of images? Can you give me some hints. Please help.

    Hi man,

    Well, the important thing is your purpose with that images. Are you trying to

    make a single animated background or create a 3D environment?

    For single background you will use texture2D, for environment you will need the

    texture3D (its a cube which you place your images on 6 faces).

    So, everything is possible with OpenGL ES. You just need to choose the right

    method to achieve your objectives.

    Thanks for your reply.

    I have a set of images. For that I want to create the image like in he link.

    http://ablesw.com/

    regards

    Shihab

    Hello buddy,

    Hmmm.. you want to create a real 3D model from a set of images.

    Well man, its not possible. Unfortunately there are no 3D Professional

    Softwares or 3D Engine capable to do that. What you are trying to do is one of

    the most complex things in the 3D world. Even the Hollywood guys is looking

    for a definitive algorithm to do that. Someone that find the solution can become

    the new billionaire.

    Imagine the complexity of that algorithm, read each pixel of the image, interpret

    #17writtenbybharat

    about 1 year ago

    #18

    writtenbyDineyBomfim

    about 1 year ago

    #19writtenbybharat

    about 1 year ago

    #20

    writtenbyDineyBomfim

    about 1 year ago

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    15/22

    the differences between colors, edges and try to define a 3D curve based on it.

    Then, the most complex part, store all informations into a kind of buffer and

    repeat the process for the next image, comparing the new one with all the buffer

    to create a 3D model.

    There are many third party softwares that are trying to do that, like that one you

    showed, but trust me, always very far from a good result. There is a techniqueto 3D artists called Blue Print, which you use a set of images 2D images to

    create a 3D model: http://www.the-blueprints.com/tutorials/3dmax/

    By the way, the modeling process is usually a responsibility of the 3D artists

    and they do that using most advanced 3D Professional Softwares, like ZBrush,

    Modo, Maya, 3D Max, MudBox, etc.

    What I am planning to do is volume rendering.

    You mean its not possible in OpenGL ES ?.

    Actually its possible in OpenGL. And I have done it in Java 3d also. And

    webgl is also possible. Please check the below link.

    Its works only in chrome.

    http://demos.vicomtech.org/volren/

    But that is not a real 3D model

    Its just a cube with volumetric shader Oh man, thats easy.

    Search for volumetric shader and you will find what you arelooking for.

    Good Luck

    I new to openGL and ES. Can u suggest some useful links?

    Hmm..

    Try this one:

    http://www.daimi.au.dk/~trier/?page_id=98

    or this:

    http://www.vis.uni-stuttgart.de/~engel/pre-integrated/

    #21writtenbybharat

    about 1 year ago

    #22writtenbyDineyBomfim

    about 1 year ago

    #23writtenbybharat

    about 1 year ago

    #24

    writtenbyDineyBomfim

    about 1 year ago

    #25writtenbyJohnCongote

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    16/22

    Hello.

    If you want to do volume rendering in OpenGL ES then it is

    possible, the implementation you talk is about Volume Rendering

    in WebGL which is similar to OpenGL ES.

    If you want to get the iso-surfaces of the volume, you should try

    the marching cubes algorithm, This is possible to implement with

    a geometry shader, or you can enhance the volume raycasting

    algorithm to stop the ray in the iso-surface with similar results.

    Finally the implementation of volume rendering works in android,

    exactly in samsung galaxy 2 and samsung galaxy tab.

    Great post my friend yet again, you never seem to dissapoint

    This is the best place for beginners, I just bookmarked it, keep posting thanks!

    PS.: Going to part 2

    Hi, first the contents really great, but I think that you are overusing the exclamation

    mark a little bit Especially in the beginning of the article, there are like a fewsentences, and every single one ends with ! Nevertheless, thats the biggest flaw of

    this article I can see, so it is a compliment anyway, well done! I admire it.

    Hi buddy,

    Thanks for your comment. I agree, maybe I was very excited at the time I waswriting.

    Ive made some changes.

    Thanks!!!!!!!!!!

    Hi,I am working as a iOS Apps Developer, new with Open GL. And i

    searched for so many sites for this. Finally i found your tutorials, great

    about 1 year ago

    #26writtenbyMontrealwebdesign

    about 1 year ago

    #27writtenbysid

    about 1 year ago

    #28writtenbyTomasz

    about 1 year ago

    #29

    writtenbyDineyBomfim

    about 1 year ago

    #30writtenbyRajesh

    about 1 year ago

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    17/22

    job. Thanks. Its helpful for me, if you provide / suggest more tutorials for

    this Open GL.

    Its a great article.

    Hey buddy,

    Thanks,

    Well, I suggest you the other tutorials of this series.

    Their intention is to be a guide covering basic, intermediate and

    advanced skills. Not in so depth, but enough to understand the

    OpenGL world.

    Now Im working on tutorials about Shaders.

    I think this is among the most important information for me. And i am glad reading

    your article. But should remark on some general things, The website style is ideal, the

    articles is really great : D. Good job, cheers

    Nice intro.

    Oh by the way, it would be much appreciated if you could fix the table views of some of

    the method explanations because some of the text seems to be left out and theres no

    option to scroll.

    Thanks!

    Really good tutorial but i want to ask some questions about opengl 1.x not about this

    tutorial.

    What is the fastest way of importing a 3d model into 3d space in OpenGL ES 1.x?

    Is obj format suitable for a well-designed and high graphic quality game?

    Hello buddy,

    #31writtenbyDineyBomfim

    about 1 year ago

    #32writtenbyHTCTitanAccessories

    about 1 year ago

    #33writtenbyBomba

    about 1 year ago

    #34writtenbyLuisOscar

    about 1 year ago

    #35writtenbydroidman

    about 1 year ago

    #36

    writtenbyDineyBomfim

    about 1 year ago

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    18/22

    1. As I said in the next tutorial (http://db-in.com/blog/2011/02/all-about-

    opengl-es-2-x-part-23), there is no way to import 3D files with OpenGL (any

    version). Every import/parse is made with your own custom code.

    2. Depends, OBJ files have support to bump mapping and is lighter weight,

    however they dont support animations. In this case COLLADA is the best

    choice. But COLLADAs are too bigger. So the real best choice to games is acustom binary format (each game company has its own format), something

    that includes very light weigh, pre-parsed data and very fast importing times.

    Cheers,

    Thanks for answer.I want to use obj file but i cant find the method which

    is the fastest.In following link there is a function,method but im not sure

    that is the best way for this.http://etcodehome.blogspot.com/2011/07

    /android-rendering-3d-blender-models.html

    What is the best way of loading an obj model?I want to do this in Android

    actually.

    Hi man,

    As I said, there is no fast way to import obj files. Even the greatest

    3D softwares, running on desktops super machines, take a while

    to import an obj file. Now imagine this into small devices with

    limited hadware.

    As i said, the games always use their own binary format. Often,

    the obj is used just to generate a binary format. If you really need

    to import the obj files, it will be expensive. So, consider a great

    victory if you are importing obj correctly (reading all related .mtl,

    all groups, materials, etc), which is the most important point.

    Import it into a background and show a loading status to the user,

    there is no problem with it.

    Good luck.

    Thank you very much and my last question is about

    models.Okey games have their formats but how can create

    own binary format output from 3ds max or any other 3d

    program?

    #37writtenbydroidman

    about 1 year ago

    #38writtenbyDineyBomfim

    about 1 year ago

    #39writtenbydroidmanabout 1 year ago

    #40

    writtenbyDineyBomfim

    about 1 year ago

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    19/22

    Hello again,

    Well, the process is a little bit more complex.

    First of all, you really need to parse from a comum format,

    like OBJ or COLLADA, then you take the informations you

    need and with these informations you create your ownbinary format.

    For example:

    4 bytes = File version

    4 bytes = Count of the Array of Structures

    N bytes = Array of Structures

    And so on

    If youre used to other languages, like Phyton or Max Script,

    you can try to write a plugin to Blender or 3DS Max.However, in this case you must know the internal structure

    that those softwares use.

    The point is: this will be a very long path to a solo

    developer (Im talking about a lot of months or a year). If

    you have a game company that produce 3D games all time

    or if you are planning to create your own 3D engine, ok this

    is the right path.

    But, if you just want to use 3D in your apps, I suggest youto search for a 3D engine, a good one. Probably it will have

    a importing/parsing API that works pretty well.

    Thank you.I learned from you a lot.

    hello sir.i am trying to create a 2d side scrolling tile based game on Android and

    have to use opengl esyou mentioned in the tutorial that the code u will use will be

    apple oriented.are there any major differences between apple implementation and

    android?? do we need to be careful about some subtle differences?

    btwthanks for a rocking tutorialbeen a great guiding light..

    Hello buddy,

    Actually, the OpenGL API doesnt change almost nothing. So the same concept

    are applicable to iOS and Android. Besides, they use the same functions and the

    same structure.

    The greatest difference you could find is around the EGL API. Apple uses its

    own implementation, called EAGL. The EGL API is responsible to make the

    #41writtenbydroidman

    about 1 year ago

    #42writtenbygaurav

    about 1 year ago

    #43

    writtenbyDineyBomfim

    about 1 year ago

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    20/22

    bridge between the OpenGL render and the devices screen.

    Best,

    Very good think dear friend, nice tutorial.

    Thank you for your tutorial. Itll help me a lot. Thanks.

    Hello, and thank you for your nice post.

    I am new at OpenGL, and live in Japan.

    I read this post, and write down summary of this tutorial at Japanese to my blog.

    http://tsurumura-seisakusho.blogspot.jp/2012/03/open-gl-es-bd-interactively-

    all-about.html

    If you think this is not good (because of your right), please submit comment to my

    blog and tell me so.

    I am going to write down summary about next parts in Japanese.

    Thanks very much.

    (If need, please erase this comment.)

    Thank you so much. This is a great tutorial. Even if it were not as good you deserve

    lots of thanks for devoting your time to enlighing people with problems understanding

    OpenGL like me.

    The site was down.

    Thank you for bringing it up alive.

    This is a seriously amazing tutorial. Thank you!!

    One guy said you use !!!!!! Too much, but I found it more engaging. I could totally get

    #44writtenbyManimaran

    about 11 months ago

    #45writtenbyMarkusThayer

    about 9 months ago

    #46writtenbySaki

    about 9 months ago

    #47writtenbyMikeJM

    about 9 months ago

    #48writtenbyOscar

    about 8 months ago

    #49writtenbyBenM

    about 5 months ago

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    21/22

    how excited you were about it lol, and that made it better to read.

    Also, there seem to be a tonne of questions about importing .obj files etc. just google

    convert .obj to.h and that should show you how

    And lastly, some of the text in the boxes goes out of view and cant be read which is a

    shame, someone else mentioned it too, but its ok in the PDF versions.

    Thanks again Diney, this tutorial is great!

    I am not sure where you are getting your info, but great topic. I needs to spend some

    time learning more or understanding more. Thanks for fantastic information I was

    looking for this All about OpenGL ES 2.x (part 1/3) for my mission.

    Hi I am forced to work with OGL and GLSL and no clue where to startmedical image

    VR (unfortunately am a hardware engg. with out any software back ground..)

    This is the first article i found , that gives an idea about this . Thanks a lot

    Still am in air donno will be able to do a safe landing ;P

    Name (required)

    E-mail (required, will not be published)

    Website

    Submit Comment

    #50writtenbyawhieoawele

    about 5 months ago

    #51writtenbynikhila

    about 3 weeks ago

    App(2)

    3D(10)

    ActionScript3.0(2)

    Feature(20)

    Frameworks(6)

    General(8)

    Objective-C(14)

  • 7/30/2019 All about OpenGL ES 2.x (part 1_3)

    22/22

    Mystique theme by digitalnature | Powered by WordPress

    RSSFEEDS XHTML1.1 TOP

    followers

    MYTWEETS

    about 0 seconds ago

    USERLOGIN

    User

    Password

    Login

    Remember me

    Lost your password?

    BLOGROLL

    Cocoa(5)

    Shaders(2)OpenGL(10)

    WebAPIs(2)