Night play?
2014-02-23, 11:49 AM (This post was last modified: 2014-02-23, 12:27 PM by rXn.)
#31
RE: Night play?
Here's the final texture load code:
Code:
//somewhere outside the function
static void change_nv = 0;
//...
//In gl_drawhud()
     if(nightvision) {
        glEnable(GL_TEXTURE_2D);
        static Texture *nvtex = textureload("packages/misc/nv1.png", 3);
        static Texture *nvtex2 = textureload("packages/misc/nv2.png", 3);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        if((lastmillis - change_nv) < 50) {
            glBindTexture(GL_TEXTURE_2D, nvtex->id);
        } else {
            change_nv = lastmillis;
            glBindTexture(GL_TEXTURE_2D, nvtex2->id);
        }
        glColor4f(1, 1, 1,1);
        glBegin(GL_QUADS);
            glTexCoord2f(0, 0); glVertex2f(0, 0);
            glTexCoord2f(1, 0); glVertex2f(VIRTW, 0);
            glTexCoord2f(1, 1); glVertex2f(VIRTW, VIRTH);
            glTexCoord2f(0, 1); glVertex2f(0, VIRTH);
        glEnd();
     }
and the fog code:
Code:
//Best in gl_drawframe() behind the water stuff, but put it whereever you want.
    if(nightvision) {

        glFogfv(GL_FOG_COLOR, nfogc);
        glFogi(GL_FOG_START, 0);
        glFogi(GL_FOG_END, 30);
    }

For now it is flickering quite fast and I am not responsible for any monitor damage or mental diseases that might result of it...

Here are the images nv1.png and nv2.png:
[Image: GeEK49P.png]
[Image: Vvz7LiH.png]

They are basically the same, but one is moved one pixel up so when they are loaded one by one they flicker nicely (insanely? Tongue)

The C Programming Language: combines the flexibility of assembly language with the power of assembly language.
Post Reply Quote this message in a reply


Messages In This Thread
Night play? - by {KE}Agent 1007 - 2014-02-02, 08:41 AM
RE: Night play? - by DeltaStrikeOp - 2014-02-03, 09:39 PM
RE: Night play? - by rXn - 2014-02-04, 02:37 AM
RE: Night play? - by DeltaStrikeOp - 2014-02-04, 07:37 PM
RE: Night play? - by rXn - 2014-02-05, 10:57 AM
RE: Night play? - by DeltaStrikeOp - 2014-02-05, 01:25 PM
RE: Night play? - by {KE}Agent 1007 - 2014-02-13, 04:21 PM
RE: Night play? - by DeltaStrikeOp - 2014-02-13, 07:27 PM
RE: Night play? - by {KE}Agent 1007 - 2014-02-14, 07:36 PM
RE: Night play? - by DeltaStrikeOp - 2014-02-14, 10:54 PM
RE: Night play? - by dm.mossberg590a1 - 2014-02-15, 10:16 PM
RE: Night play? - by DeltaStrikeOp - 2014-02-16, 01:58 AM
RE: Night play? - by Victor - 2014-02-16, 09:00 AM
RE: Night play? - by DeltaStrikeOp - 2014-02-16, 08:01 PM
RE: Night play? - by ruler501 - 2014-02-16, 08:24 PM
RE: Night play? - by dm.mossberg590a1 - 2014-02-16, 08:46 PM
RE: Night play? - by ruler501 - 2014-02-16, 09:05 PM
RE: Night play? - by Victor - 2014-02-17, 12:49 PM
RE: Night play? - by rXn - 2014-02-18, 08:04 AM
RE: Night play? - by DeltaStrikeOp - 2014-02-18, 09:33 PM
RE: Night play? - by Victor - 2014-02-19, 04:11 PM
RE: Night play? - by rXn - 2014-02-21, 08:59 AM
RE: Night play? - by DeltaStrikeOp - 2014-02-21, 07:43 PM
RE: Night play? - by {KE}Agent 1007 - 2014-02-22, 08:03 AM
RE: Night play? - by rXn - 2014-02-22, 08:24 AM
RE: Night play? - by {KE}Agent 1007 - 2014-02-22, 03:06 PM
RE: Night play? - by DeltaStrikeOp - 2014-02-22, 11:24 PM
RE: Night play? - by {KE}Agent 1007 - 2014-02-23, 07:14 AM
RE: Night play? - by rXn - 2014-02-23, 10:07 AM
RE: Night play? - by -{ET}-xdEpicZombie - 2014-02-23, 10:35 AM
RE: Night play? - by rXn - 2014-02-23, 11:49 AM
RE: Night play? - by {KE}Agent 1007 - 2014-02-27, 09:07 PM
RE: Night play? - by rXn - 2014-02-28, 08:58 AM
RE: Night play? - by -{ET}-xdEpicZombie - 2014-02-28, 11:56 AM

Forum Jump: