resortnsa.blogg.se

Opengl es 2.0 draw line
Opengl es 2.0 draw line





This is how I initialise the sprite array (GLKViewController. Following piece of codes shows how the dotted line is drawn in OpenGL ES 1.1. Currently I have been doing this: // In main: float mypoints new float 100 // Fill mypoints with some data to be drawn as a continuous line on the screen. We know that in OpenGL ES 1.1, glLineStipple() is used to draw the dotted line. Currently I call glDrawArrays(GL_TRIANGLE_STRIP, 0, 4) for each of the 50 sprites for each of the frames (target frame rate is 60) which is equally to 3000 calls per second.Ĭould that be the bottle neck ? How could I optimise this ? Assuming that I can open an OpenGL context, please could you (a SO user reading this question) clarify all the steps required to render an array of points describing a line in OpenGL.

opengl es 2.0 draw line

I am able to draw the line but color is always black. In the following sections I have listed the important parts of the program. I want to draw line on this texture and fill red color to the line. Anyway this should work too because tesselation is the same for both lines or triangles. If you need to display the wireframe, the best way is to prepare indices to draw the wireframe. A 3D model or Mesh is a collection of triangles. OpenGL ES do not expose the tesselator AFAIK. I am wondering how I could optimise my program, since the frame-rate drops on my iPhone 4S to about 25 FPS when displaying 50 sprites (all with the same texture/png-file!) with a size of 128x128 px each. OpenGL can draw lines, triangles and quads, while OpenGL ES 2.0 can only draw and lines. I introduced a sprite class that can load png-files as textures, manipulate the sprite (SRT) and some additional properties like alpha blending and so on. I have an animated background layer that is built on top of OpenGL ES 2.0 and I am using GLKView as graphics container and GLKViewController as controller.







Opengl es 2.0 draw line