android - Rendering a square -
The following is not giving me the triangle sections, why do anyone know ??
// defined as ... addcube (2, -2, 1, -1, 10); AdCube (Float LX, Float Hx, Float Lee, Float HE, Flatz) {Final Float Array 1 [] = New Float [] {// Front Face Lex, LE, HZ, LX, High, HZ, HX, High, HZ , Hx, Lee, H.J.}; } // Draw as ... gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, E, 4); E = E + 4; Gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, E, 4); E = E + 4; Gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, E, 4); E = E + 4; Gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, E, 4); E = E + 4; Gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, E, 4); E = E + 4; Gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, E, 4); E = E + 4;
I have tried to add gl.glDisable (GL10.GL_CULL_FACE);
But it only puts the rest of the square in the foreground, I've included Drawing Methods ...
Public Waste on Draffam (GL 10GL) {onDrawFrameCounter ++; Gl.glEnable (GL10.GL_TEXTURE_2D); Gl.glClear (GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); BindCameraTexture (GL); Println (Global.bearing); Float beer = global. Bearing; Gl.glLoadIdentity (); Gl.glNormal3f (0,0,1); System.out.println ("ARRAY!:" + GLCamTest.array.length); P = 0; Gl.glRotatef (bear, 1, 0, 0); Int E = 0; For (int q q = 0; q & gt; globalcube; q ++) {gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, E, 4); E = E + 4; Gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, E, 4); E = E + 4; Gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, E, 4); E = E + 4; Gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, E, 4); E = E + 4; Gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, E, 4); E = E + 4; Gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, E, 4); E = E + 4; }} Rotated in public (ZL 10GL, Int width, intensity height) {gl.glViewport (0, 0, width, height); Float ratio = (float) width / height; Gl.glMatrixMode (GL10.GL_PROJECTION); Gl.glLoadIdentity (); Gl.glFrustumf (-Ratio, ratio, -1, 1, 1, 20); Gl.glMatrixMode (GL10.GL_MODELVIEW); } Surfaces in public (ZL 10GL, EGL Confief Config) {gl.glHint (GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST); Gl.glClearColor (0, 0, 0, 0); Gl.glDisable (GL10.GL_CULL_FACE); Gl.glShadeModel (GL10.GL_SMOOTH); Gl.glEnable (GL10.GL_DEPTH_TEST); Cubebuff = macflot buffer (gelcommetest. Air); Teckfuff = MacFlot Buffer (Camtexocours); Gl.glVertexPointer (3, GL10.GL_FLOAT, 0, cubebuff); Gl.glEnableClientState (GL10.GL_VERTEX_ARRAY); Gl.glTexCoordPointer (2, GL10.GL_FLOAT, 0, Tex Buff); Gl.glEnableClientState (GL10.GL_TEXTURE_COORD_ARRAY); }
Try to use the number in the 'zigzag order' i.e.
xl, yl xl, yh xh, yl // This is the hypotenuse of triangle xh, yh // it is the end point of the last triangle, so the previous row is hypotenuse
You might be getting a broken two-triangle broken shape.
You can see, the square is made of triangles, and they are drawn in the order of numbers!
Comments
Post a Comment