Results 1 to 5 of 5

Thread: OpenGL ES code for GL_Quads

  1. #1
    Junior Member
    Join Date
    Sep 2008
    Posts
    4

    OpenGL ES code for GL_Quads

    Im facing problems in changing this code to openGL ES.
    glBegin(GL_QUADS);
    {
    glColor4fv(c0);
    glTexCoord2f(s0, t1); glVertex2i(x, y);
    glTexCoord2f(s1, t1); glVertex2i(x + w, y);

    glColor4fv(c1);
    glTexCoord2f(s1, t0); glVertex2i(x + w, y + h);
    glTexCoord2f(s0, t0); glVertex2i(x, y + h);
    }
    glEnd();

    c0,c1(pointers) are passed through function..


    This is my code in openGL ES:-

    GLfloat ColorVertices[]= {*(c0+1),*(c0+2),*(c0+3),
    *(c0+1),*(c0+2),*(c0+3),
    *(c1+1),*(c1+2),*(c1+3),
    *(c1+1),*(c1+2),*(c1+3)};

    glEnableClientState (GL_COLOR_ARRAY);
    glEnableClientState (GL_TEXTURE_COORD_ARRAY);
    glEnableClientState (GL_VERTEX_ARRAY);

    glColorPointer (4,GL_FLOAT,0,ColorVertices);
    glTexCoordPointer (2,GL_FLOAT,0,TexVertices2);
    glVertexPointer (2,GL_INT,0,QuadVertices2);
    glDrawArrays (GL_TRIANGLE_FAN,0,4);

    glDisableClientState (GL_COLOR_ARRAY);
    glDisableClientState (GL_TEXTURE_COORD_ARRAY);
    glDisableClientState (GL_VERTEX_ARRAY);

    Plz help its really urgent...

  2. #2
    Senior Member
    Join Date
    May 2006
    Posts
    353

    Re: OpenGL ES code for GL_Quads

    You're only using three colour channels in your ColorVertices array but tell GL to use 4 so your colours will be wrong. And GL_INT is not a valid type for glVertexPointer. Use GLshort if the range is sufficient, otherwise use GLfloat.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  3. #3
    Junior Member
    Join Date
    Sep 2008
    Posts
    4

    Re: OpenGL ES code for GL_Quads

    Sorry.. it was my mistake... Im using like this only....
    GLfloat ColorVertices[]= {*c0,*(c0+1),*(c0+2),*(c0+3),
    *c0,*(c0+1),*(c0+2),*(c0+3),
    *c1,*(c1+1),*(c1+2),*(c1+3),
    *c1,*(c1+1),*(c1+2),*(c1+3)};

    text is missing... wat could be the reason ????

  4. #4
    Senior Member
    Join Date
    May 2006
    Posts
    353

    Re: OpenGL ES code for GL_Quads

    Did you try changing the type of your position array?
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  5. #5
    Junior Member
    Join Date
    Sep 2008
    Posts
    4

    Re: OpenGL ES code for GL_Quads

    yaa.. i'hv try that but result is still the same.. i.e. no text ...

Similar Threads

  1. Problem using GL_TRIANGLES instead of GL_QUADS
    By srobles in forum OpenGL ES general technical discussions
    Replies: 4
    Last Post: 03-31-2008, 04:19 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
  •