Waterfall Display

How bout a little background on this waterfall thingamajig, preferably something in PDF format with lots of pictures if it’s not too much trouble.

I still can’t get my head around it…

P.S. No need to jack this thread with your own over here
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=252177#Post252177

Oops, that thread isn’t yours either. Sorry.
Consider creating your own thread so we can get to the bottom of this thing :wink:

Modus…
Link below is my thread…
http://www.opengl.org/discussion_boards/…2722#Post252722

Thanks

As suggested by you , i have created rectangular screen texture,but unable to scroll down…
can you pls suggest me some more

Thanks for the Response

scroll with texture coordinates.
assume some variables, in float (not int, otherwise division will be very wrong) :
TEXTURE_HEIGHT (constant)
TOTAL_MILLISECONDS (total time elapsed, updated every frame)

glTexCoord2f(0,0); becomes :
glTexCoord2f(0,-TOTAL_MILLISECONDS/TEXTURE_HEIGHT);
glTexCoord2f(0,1); becomes :
glTexCoord2f(0,1-TOTAL_MILLISECONDS/TEXTURE_HEIGHT);
etc.

by the way, if you use one of the TEXTURE_RECTANGLE extensions, you don’t need the TEXTURE_HEIGHT divide.

Thank you for your response…
I will try this …

As you have suggested i have done some experiment using glut.

but i am not able to create it using wxGlCanvas.
Can we create textures on a Canvas which is inherited by wxGlCanvas.

I have done whatever suggested by you but the screen is not updating with the new cordinates.
Here is the code…
Pls verify it and suggest me…

const int IMAGE_WIDTH = 1000;
const int IMAGE_HEIGHT = 1000;
const int CHANNEL_COUNT = 4;
const int DATA_SIZE = IMAGE_WIDTH * IMAGE_HEIGHT * CHANNEL_COUNT;
const GLenum PIXEL_FORMAT = GL_BGRA;

GLuint textureId; // ID of texture
GLubyte* imageData = 0; // pointer to texture buffer

WaterFall::WaterFall(BottomPanel *k):wxGLCanvas(k,-1,wxPoint(50,20),wxSize(1000,700),0,"",0,wxNullPalette)
{
this->Connect(wxEVT_PAINT, wxPaintEventHandler(WaterFall::OnPaint));

fp3=fopen("KKK.txt","w");
if(fp3 == NULL) wxMessageBox("Unable to open KKK.txt");

SetBackgroundStyle(wxBG_STYLE_CUSTOM);
SetBackgroundColour(wxColour(0,1,0));

	initGL();
glGenTextures(2, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, IMAGE_WIDTH, IMAGE_HEIGHT, 0, PIXEL_FORMAT, GL_UNSIGNED_BYTE, (GLvoid*)imageData);
glBindTexture(GL_TEXTURE_2D, 0);

}
float TOTAL_MILLISECONDS=1000.0;
float TEXTURE_HEIGHT=1000.0;

void updatePixels(GLubyte* dst, int size)
{
static int color = 0;
fprintf(fp3,"IN UpdatePixels
");
if(!dst)
return;

int* ptr = (int*)dst;

// copy 4 bytes at once
for(int i = 0; i < IMAGE_HEIGHT; ++i)
{
    for(int j = 0; j < IMAGE_WIDTH; ++j)
    {
        *ptr = color;
        ++ptr;
    }
    color += 257;   // add an arbitary number (no meaning)
}
++color;            // scroll down

}

void WaterFall::OnPaint(wxPaintEvent& event)
{
SetCurrent();
// save the initial ModelView matrix before modifying ModelView matrix
glBindTexture(GL_TEXTURE_2D, textureId);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, PIXEL_FORMAT, GL_UNSIGNED_BYTE, (GLvoid*)imageData);
updatePixels(imageData, DATA_SIZE);

  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
 glPushMatrix();

#if 1

// draw a point with texture
glBindTexture(GL_TEXTURE_2D, textureId);
 glColor4f(1, 1, 1,1);
glBegin(GL_QUADS);
glNormal3f(0, 0, 1);
float x=TOTAL_MILLISECONDS/TEXTURE_HEIGHT;

 glTexCoord2f(0.0f, 0.0f);   glVertex3f(-1, -1, 0.0f);
 glTexCoord2f(1.0f, 0.0f);   glVertex3f( 1, -1, 0.0f);
 glTexCoord2f(1.0f, 1.0f);   glVertex3f( 1.0f,  x, 0.0f);
 glTexCoord2f(0,1);		glVertex3f(-1,  x, 0.0f);
 glEnd();

      // unbind texture
glBindTexture(GL_TEXTURE_2D, 0);

glPopMatrix();

SwapBuffers();
--TOTAL_MILLISECONDS;
//if(TOTAL_MILLISECONDS == 0) TOTAL_MILLISECONDS=1000;

}