Morph-SynRJ

view trans_radial.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_radial.h"
2 #include "gl_header.h"
3 #include "cmn_intro.h"
4 #include "cmn_texture.h"
7 void transRadial_t::Init()
8 {
9 level=0;
10 texture=txtCreateEmptyTexture(1024,1024);
11 }
14 void transRadial_t::GetBuffer1()
15 {
16 CopyBackBufferToTexture(texture,RX,RY);
17 }
19 void transRadial_t::Draw(float _time)
20 {
22 const NbPasses=5;
23 const Scale=30;
24 const Alpha=1.0/NbPasses;
26 cmnPushMatrix();
27 cmnSetPlanarView();
28 glEnable(GL_BLEND);
29 glBlendFunc(GL_SRC_ALPHA,GL_ONE);
30 //glBlendFunc(GL_ONE,GL_ONE);
31 glDisable(GL_DEPTH_TEST);
33 // float scale=Scale*_time;
34 float tr=0;
35 float alpha=0;
37 for (int i=0;i<NbPasses;i++) {
38 txtBindTexture2d(texture,0);
39 glBegin(GL_QUADS);
40 glColor4f(1,1,1,alpha);
41 glTexCoord2f(0,RY*1.0/1024);
42 glVertex2f(0-tr,RY+tr);
44 glColor4f(1,1,1,alpha);
45 glTexCoord2f(RX*1.0/1024,RY*1.0/1024);
46 glVertex2f(RX+tr,RY+tr);
48 glColor4f(1,1,1,alpha);
49 glTexCoord2f(RX*1.0/1024,0);
50 glVertex2f(RX+tr,0-tr);
52 glColor4f(1,1,1,alpha);
53 glTexCoord2f(0,0);
54 glVertex2f(0-tr,0-tr);
55 glEnd();
56 tr+=Scale*_time;
57 alpha+=Alpha*_time;
58 //glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_COLOR);
59 }
60 txtUnBindTexture2d(0);
62 cmnPopMatrix();
63 glMatrixMode(GL_MODELVIEW);
64 }