Morph-SynRJ

view trans_fade.cxx @ 0:22de913c2d84

morph-synrj intro
author "Cedric Pinson <cedric.pinson@alcove.fr> <mornifle@plopbyte.net>"
date Tue Nov 27 15:23:52 2007 +0100 (2007-11-27)
parents
children
line source
1 #include "trans_fade.h"
2 #include "gl_header.h"
3 #include "cmn_intro.h"
4 #include "cmn_texture.h"
12 void transFade_t::Init()
13 {
14 texture[0]=txtCreateEmptyTexture(1024,1024);
15 texture[1]=txtCreateEmptyTexture(1024,1024);
16 alpha[0]=1;
17 alpha[1]=0;
18 }
21 void transFade_t::GetBuffer1()
22 {
23 CopyBackBufferToTexture(texture[0],RX,RY);
24 }
26 void transFade_t::GetBuffer2()
27 {
28 CopyBackBufferToTexture(texture[1],RX,RY);
29 }
32 void transFade_t::Draw(float _time)
33 {
34 alpha[1]=_time;
35 alpha[0]=1-_time;
38 // cmnDisplayBackground(texture[0]);
39 // return ;
41 cmnPushMatrix();
42 cmnSetPlanarView();
43 //glDisable(GL_BLEND);
44 glEnable(GL_BLEND);
45 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
46 glDisable(GL_DEPTH_TEST);
48 for (int i=0;i<2;i++) {
49 txtBindTexture2d(texture[i],0);
50 glBegin(GL_QUADS);
51 glColor4f(1,1,1,alpha[i]);
52 glTexCoord2f(0,RY*1.0/1024);
53 glVertex2f(0,RY);
55 glColor4f(1,1,1,alpha[i]);
56 glTexCoord2f(RX*1.0/1024,RY*1.0/1024);
57 glVertex2f(RX,RY);
59 glColor4f(1,1,1,alpha[i]);
60 glTexCoord2f(RX*1.0/1024,0);
61 glVertex2f(RX,0);
63 glColor4f(1,1,1,alpha[i]);
64 glTexCoord2f(0,0);
65 glVertex2f(0,0);
66 glEnd();
67 //glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_COLOR);
68 }
69 txtUnBindTexture2d(0);
71 cmnPopMatrix();
72 glMatrixMode(GL_MODELVIEW);
73 }