How to draw text clearly in OpenGL ES (Android?

How do I get started with OpenGL ES on Android?

Shayan Jay at Quora Visit the source

Was this solution helpful to you?

Other answers

Go through some presentations that describes overview of OpenGL Graphics e.g http://www.slideshare.net/darvind/opengles-android-graphics  (Disclosure: My talk at GDG conference) At highlevel, this is how graphics pipeline works 1) Geometry of the 3D Model is described . 2) The geometry is divided into triangles. Transformations are applied to the model (i.e triangles of the model) are called Model Transforms 3) We have a virtual camera corresponding to eye. The transformation applied on the camera are called View Transforms 4) To give a 3D effect, perspective projection is applied which converts the  3D model to 2D space. These are called Projection Transforms 5) Model View Projection Transformations transform the objects and put them into screen space. These are described by MVP matrices 6) Rasterize the triangles to get the pixels( they are called fragments till you get to the final stage) 7) Fragments are shaded. It can be as simple as using interpolated color or complex (Apply lighting and texturing to get realism) 8) Fragments are combined(blended) to get a single pixel. The combination can be any arbitary operation like blending or as simple as displaying the closest pixel to the observer .  This blending phase combine the fragments generated by (possibly several primitives that overlapped and compute final color Learn more about the Graphics pipeline from http://www.slideshare.net/SandipJadhav3/opengl-basics Now you must realize at a very highlevel, we do the following 1. Transformation - Transform the geometry to Screen space 2. Rasterization - Rasterize the pixels(or fragments) 3. Applying Lighting and Texturing 4. Blend the fragments to single color. 5. Shaders are user defined code used to customize the pipeline We will expand on each of these section in details Transformation Watch few introductory videos e.g , this  video from Samsung  gives overview of the transformations Become familiar with the transformations going on at high level (these are model, view and projection transformations). Also be familiar with terms like View Frustum . Some basic math will help in knowing what is going on http://diaryofagraphicsprogrammer.blogspot.in/2011/05/points-vertices-and-vectors.html. Optionally if you like to know more details and the math  http://en.wikibooks.org/wiki/GLSL_Programming/Vertex_Transformations Now start reading articles http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Table-of-Contents.html http://www3.ntu.edu.sg/home/ehchua/programming/opengl/CG_Introduction.html#zz-6.8 http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.htm http://www.songho.ca/opengl/index.html http://www.informit.com/articles/article.aspx?p=1616796 RASTERIZATION Rasterization is simply the process of finding which pixels are lying inside the triangle. We can say that we are just coloring the triangles. If the color attributes at the vertices are same we can uniformly color the region. Otherwise the attributes at the vertices must be interpolated. See a demo of interpolated triangle in openGL LIGHTING Recall that rasterizer just interpolates the color. For most applications this is sufficient, but in presence of light we need more sophisticated models. The effect of light is captued using Shading equations.  The simplest lighting is Flat Shading. There are advanced mathematical models like Phong/Gourard. Get Overview of Lighting from optionally if you want to learn  Lighting in detail, watch video by Barbara Hecker   It covers different lighting models. Texture MappingLearn some basic texture mapping here http://cse.csusb.edu/tong/courses/cs520/notes/texture.php Optionally you can also dive into advanced texture mapping - http://www.antongerdelan.net/teaching/3dprog1/multitex/multitextures.html#(1) BlendingThe blending phase combine the fragments generated by (possibly several primitives that overlapped and compute final color Learn about different blending modes here http://devmaster.net/posts/3040/shader-effects-blend-modes We also need to remove parts of those surfaces that are partially obscured by other surfaces. These are called hidden surfaces. http://glasnost.itcarlow.ie/~powerk/GeneralGraphicsNotes/HSR/hsr.html. This is done using Depth buffer SHADERS Read how the fixed functionality of the pipeline is replaced using shaders http://zach.in.tu-clausthal.de/teaching/cg_literatur/glsl_tutorial/ http://www.lighthouse3d.com/tutorials/glsl-tutorial/shader-examples/ BOOKSI found book by Peter Shirely to be very good for learning the concepts of computer graphics. Most books dive into the details without giving the motivation. Shirley gives good background  of the concepts. http://www.amazon.com/Fundamentals-Computer-Graphics-Peter-Shirley/dp/1568814690 VIDEOSwatch courses like http://www.youtube.com/user/raviramamoorthi/videos   or NPTEL Watching few videos in Computer Graphics Series by  Dr. Sukhendu das and also few related videos in the play list Subscribe to youtube channel http://www.youtube.com/channel/HCreZMJOcDPvk/videos. Most of the videos are general and not informative like lectures. But they are motivating This video is also very general, but may interest if you are into game programming DEMOS Watch demos of how things work. There are lot of demos that let you change for e.g the model view projection matrices , lighting parameters. One of the best demos is from Nate Robbins. Get Nate Robbin's OpenGL demos and change the parameters and see how it affects the rendering. Have http://en.wikibooks.org/wiki/OpenGL_Programming  as reference. There seems to be hundreds of OpenGL calls. Its easy to learn if you break down to categories. This page has nicely summarized them https://www.cs.umd.edu/users/mount/427/OpenGL/ogl_ref/ogl_ref.html Ideally you should install some framework on your local system, but if you want quick web demo, use Web Demos http://learningwebgl.com/blog/?page_id=1217 http://codedstructure.net/projects/webgl_shader_lab/ http://learningwebgl.com/blog/?p=11 or other frameworks http://stackoverflow.com/questions/13624124/online-webgl-glsl-shader-editor PRACTICE OpenGL USING GLUT / FreeGLUT http://ogldev.atspace.co.uk/index.html has some exercises. Try few of them. Install GLUT http://www3.ntu.edu.sg/home/ehchua/programming/opengl/CG_Introduction.html#zz-6.8 helps in installing glut. Try  Some Keyboard and Mouse Handling http://www.codeincodeblock.com/2011/06/mouse-event-handling-source-code-in.html. Try some animation e.g Moving ball. Apply Texture using http://en.wikibooks.org/wiki/OpenGL_Programming/Intermediate/Textures Get the OpenGL code running with Shaders. Watch this for reference. http://cse.csusb.edu/tong/courses/cs520/notes/glsl.php. Write you own Fragment shader to draw circle http://people.freedesktop.org/~idr/OpenGL_tutorials/03-fragment-intro.html. Write your own shader for lighting using http://learningwebgl.com/blog/?p=1523 PRACTICE OpenGLESOpenGLES is a subset of OpenGL. It deprecates few functions like glBegin/glEnd which is used to describe geometry. Get OpenGLES samples working on Android http://www.learnopengles.com/android-lesson-one-getting-started/. In OpenGLES, geometry is specified using Vertex Buffers. Learn more about it herehttp://www.arcsynthesis.org/gltut/Positioning/Tutorial%2005.html .Try advanced stuff on android also e.g http://www.learnopengles.com/android-lesson-four-introducing-basic-texturing/ iPhone users http://iphonedevelopment.blogspot.in/2009/04/opengl-es-from-ground-up-part-2-look-at.html http://db-in.com/blog/2011/02/all-about-opengl-es-2-x-part-23/ https://developer.apple.com/library/ios/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008793-CH1-SW1   ADDTIONAL RESOURCESThough OpenGL doesn't care about the modeling tools, its good to understand the overview how this is done. Just take a  quick glance at http://cse.csusb.edu/tong/courses/cs520/notes/mesh.php You can dive into math if you are interestedhttp://www.essentialmath.com/GDC2009/Vectors_and_Matrices_Final.pptx. http://www.songho.ca/math/homogeneous/homogeneous.html are used to represent vertices If you want an indepth knowledge read http://fgiesen.wordpress.com/2011/07/01/a-trip-through-the-graphics-pipeline-2011-  and other parts And watch in depth lectures by John Owens (UCDavis) (this one is on Pipeline overview, but also others on Rasterization etc)

Arvind Devaraj

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.