Sign in to follow this  
lehthanis

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this