Updating Texture Issue - TV like effect

Started by
9 comments, last by MShaw 16 years, 3 months ago
Oh IC....

Thats sounds proper to me - you probably did not writing your own event loop and the program finishes the glutMainLoopEvent(); and exit your program.

Just set that back to glutMainLoop(); and you should see the window and its contents.

Do this
1) run the NeHe code AS IS
2) run the NeHe code with the modification of makeing it update the texture whenever needed.


I use this simple function where load_image_data() loads a bitmap:

void LoadAndUpdateGLTexture(char* file_name) {

load_image_data(rightIMG, file_name);

glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 1, 640, 480, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, rightIMG_Linear);
texCount++;
};

So every time you need to update the texture I just call LoadAndUpdateGLTexture("somefilename.bmp");

Cheers,

Michael

This topic is closed to new replies.

Advertisement