• Advertisement
Sign in to follow this  

Need a quick and dirty png loader with libpng...help?!?

This topic is 1748 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, sorry for the super noob post...I'm just getting started but I have a very short turnaround time needed for this for my boss.
I'm modifying something in X-Plane, and drawing a really large set of quads that cover the sky...it works....here's the code:
    glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    glBegin( GL_QUADS );
        glVertex3f( xt+150000.0f, yt, zt-150000.0f );
        glVertex3f( xt+150000.0f, yt, zt+150000.0f );
        glVertex3f( xt-150000.0f, yt, zt+150000.0f );
        glVertex3f( xt-150000.0f, yt, zt-150000.0f );
    glEnd();
    glColor4f(0.8f, 0.8f, 0.8f, 0.5f);
    glBegin( GL_QUADS );
        glVertex3f( xt+150000.0f, yt+1, zt-150000.0f );
        glVertex3f( xt+150000.0f, yt+1, zt+150000.0f );
        glVertex3f( xt-150000.0f, yt+1, zt+150000.0f );
        glVertex3f( xt-150000.0f, yt+1, zt-150000.0f );
    glEnd();
    glColor4f(0.5f, 0.5f, 0.5f, 0.2f);
    glBegin( GL_QUADS );
        glVertex3f( xt+150000.0f, yt+2, zt-150000.0f );
        glVertex3f( xt+150000.0f, yt+2, zt+150000.0f );
        glVertex3f( xt-150000.0f, yt+2, zt+150000.0f );
        glVertex3f( xt-150000.0f, yt+2, zt-150000.0f );
    glEnd();
I know, it's the old glBegin method, but that's how the code I have is written for X-Plane...
Anyways...I need to apply a texture to those 3 quads. And I need it to be a png texture.
I've downloaded and compiled libpng, and linked it to my project, but I need a quick and dirty way to load a png file and apply it to the quads.
Is there an easy way to do this without using any additional libraries? Or perhaps a simple header file I could drop in that someone has layign around?
Sorry again for the frantic-ness...once I get a quick and dirty png loader, I'll definitely be able to spend some time learning more about libpng, but for now, I need a quick fix.
Thanks so much to anyone that can help.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement