Results 1 to 2 of 2

Thread: Porting OpenGL sw to OpenGL-ES, help needed - take 2

  1. #1
    Junior Member
    Join Date
    Oct 2004

    Porting OpenGL sw to OpenGL-ES, help needed - take 2

    Follow up on

    Got rid of most of the glBegin/glEnd stuff, only polygons needs rewriting. Thought this was relatively easy, but unfortunately it's not.

    The game's original code does something like this texture most of its model:
    glBegin (GL_POLYGON);
    for (i=0 ; i<numVertex ; i++)
    glTexCoord2f(tex[i][0], tex[i][1]);
    glEnd ();

    Which I've replaced with:

    glVertexPointer(3, GL_FLOAT, 0, GetVertex(0));
    glTexCoordPointer(2, GL_FLOAT, 0, GetTexture(0));
    glDrawArrays(GL_TRIANGLE_FAN, 0, numVertex);

    I store the original tex[] and vertex[] vector info in some global float arrays accessible via GetVertex () and GetTexture().

    The model gets drawn ok, but small triangles and rectangulars are not correctly textured. They appear solid grey. As I move around in the game, the areas that are not correctly textured change all the time, resulting in a very flickery look and feel.

    I've also tried to rewrite the polygon code by drawing n-2 triangles (GL_TRIANGLES) for an n polygon. The (not too surprising) result is exactly the same as for GL_TRIANGLE_FAN.

    Am I making an obvious mistake?

    cheers, Pete

  2. #2
    Junior Member
    Join Date
    Oct 2004

    Re: Porting OpenGL sw to OpenGL-ES, help needed - take 2

    Found the problem!

    For the record...
    The game draws (1) the 3D model using polygons and then (2) applies lightning also using polygons. Things get messed up if I only change GL_POLYGON to GL_TRIANGLE_FAN in (1), if I change this in (2) as well then all works just fine.


Similar Threads

  1. Replies: 3
    Last Post: 10-26-2011, 01:27 AM
  2. Porting OpenGL sw to OpenGL-ES, help needed
    By yipton in forum OpenGL ES
    Replies: 3
    Last Post: 10-30-2004, 05:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean