iphone - Batching OpenGL sprites -


I am learning OpenGL and am able to create a successful 2D drawing system using triangle strips. I wrote a particle generator to test the geometry batching and everything works well, I am able to present 30k + corner at 60 fps on an iPhone 5. I use the defective triangle to add particles and pull them in at a time. What am I trying to do? Batch rendering without the use of the delisting triangle, because the amount of data sent for 1/3 of the amount in the GPU will be reduced which will be large.

I am trying to use glDrawElements to draw 2 demons with the following code with triangle

  // class (2D) GLfloat class Shorts for [] = {50, 50, // bottom left 100, 50, // bottom right 50, 100, // top 100, 100, top top 150, 200, // bottom left 200, 150, // Bottom right 150, 200, // top 200, 200 / top right}; // Texture Cores GL Float Tax [] = {0,0, 1,0,0,1,1,1,1,0,0,0,0,0, 0,1, 1,1}; GLubyte index [] = {0,2,3, 0,3,1, 0,2,3, 0,3,1}; // actual drawing code glBindBuffer (GL_ARRAY_BUFFER, 0); Glubbind Buffer (GL_ELEMENT_ARRAY_BUFFER, 0); GlVertexAttribPointer (ATTRIB_VERTEX, 2, GL_FLOAT, GL_FALSE, 0, Square); GlVertexAttribPointer (ATTRIB_TEX, 2, GL_FLOAT, GL_FALSE, 0, tex); GlActiveTexture (GL_TEXTURE0); Globinated (GL_TEXTURE_2D, image); GlDrawElements (GL_TRIANGLES, 12, GL_ UNSIGNED_BYTE, index);   

This code draws pictures without any problems, but the second image gets distorted. I am watching online but it is unable to understand the way it works properly.

First of all, you are currently using the same index for both quads, so the second The image should not be visible at all.

Your top data for the second quad has been confused, you have the point (150, 200) twice, first perhaps a (150, 150) yes.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

c# - Add Image in a stackpanel based on textbox input -

java - Reaching JTextField in a DocumentListener -