Jump to content

Image of the Day

What's the best way to move your heavy stuff? Using a power loader! #spacr #screenshotsaturday 💪🤖💪 https://t.co/sOjz2XNVeq
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

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

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 lehthanis   Members   

114
Like
0Likes
Like

Posted 10 April 2013 - 10:55 AM

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.

I work with X-Plane

#2 Dave Hunt   Members   

4872
Like
0Likes
Like

Posted 10 April 2013 - 12:03 PM

A quick google search for using libpng with opengl revealed this link as the first result.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.