Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is just my guess... Not a solution, but a possible explanation.</p> <p>I tried to trace how you are generating your mesh. At first I though you were doing some kind of intentional degeneration (as you are using a triangle strip, and using 4 vertices for each 2 triangles). But you are creating your mesh like this, right?.</p> <pre><code>3 ___ 4-7___ 8 | \ | \ | | \ | \ | 1 ___ 2-5 __ 6 </code></pre> <p>This creates triangles 123, [234], 345, [456], 567, [678]... and so on (note [] means reversed). So, you see that you are overlapping half of the triangles. I suppose the last triangle drawn is seen and the other is hidden... providing z is exactly 0 you are not having any artifact. When 4 = 7, and 2 = 5, which is when you are not modifying your texutre coordinate, everything works fine, as that, one way or another reduces to the following (which would be the correct way of doing it if you traspose it - acbdef). Translated to coordinates - same coordinate, same point it's like this:</p> <pre><code>c ___ d ___ f | \ | \ | | \ | \ | a ___ b ___ e </code></pre> <p>In the log you posted, you write 4 points at a time, right? So, in the 13th cycle of the "for" you generate this vertexes: (14*3 = 52):</p> <pre><code> [52] CGPoint (x=0.939453,y=1) //1 [53] CGPoint (x=1.00586,y=1) //2 [54] CGPoint (x=0.939453,y=0) //3 [55] CGPoint (x=1.00586,y=0) //4 [56] CGPoint (x=0.00585938,y=1) //5 </code></pre> <p>That makes 5 triangles. In particular 2 are of interest here: [234] and 345. 234 is ok, but 345 must be hiding it (because it renders after the other¿?. Try using an depth test function like GL_GREATER just to avoid it to render and see if i'm right on this one). Well, 345 is not right, it maps the texture from x= 0.07 to 1.00. So, even if you corrected 234, 345 is still drawn over your correct triangle. That should explain your background reversed thing.</p> <p>So, that was what i think is the problem (wouldn't happen if you didn't normalize your texture coordinates like in the tutorial).</p> <p>Do I still have to write the solution?? :/</p> <p>To begin with, I'd suggest you generated your mesh like what i draw at second place (a,b,c...). Then continue with a solution. A <strong>dirty</strong> solution would be to degenarte the evil triangle 345. That would be to repeat point 4 one time (i'm a little dizzy rigth now, could be wrong )- Anyway this is not a good solution, you are mixing orientations and overlapping triangles. Each for iteration you should only add</p> <pre><code> _hillVertices[_nHillVertices] = CGPointMake(pt0.x, 0); _hillTexCoords[_nHillVertices++] = CGPointMake(xTex0, 1.0); _hillVertices[_nHillVertices] = CGPointMake(pt0.x, pt0.y); _hillTexCoords[_nHillVertices++] = CGPointMake(xTex0, 0.0); </code></pre> <p>Let me think a clean solution, or let somebody write it for me - Providing this is in fact, the problem.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload