Multitexturing + Rendering

Started by
-1 comments, last by Whitehair 21 years, 4 months ago
Hi ppl, I am working on a code that takes in 80 to 100 .raw images which each represent a captured image of a "sliced" portion of the whole object. Any recommandation on any links/material i can read up for this task. I did a simple program, which load each file and display it onto the window. But ever later image will cover the image before it on the same window. How do i segmentate each image and display each of them as a tranparent image with a finite fixed width? here how i am taught how to load one raw file... GLuint LoadTextureRAW( const char * filename, int wrap ) { GLuint texture; int width, height; BYTE * data; FILE * file; // open texture data file = fopen( filename, "rb" ); if ( file == NULL ) return 0; // allocate buffer width = 256; height = 256; data = malloc( width * height * 3 ); // read texture data fread( data, width * height * 3, 1, file ); fclose( file ); // allocate a texture name glGenTextures( 1, &texture ); // select our current texture glBindTexture( GL_TEXTURE_2D, texture ); // select modulate to mix texture with color for shading glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); // when texture area is small, bilinear filter the closest mipmap glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST ); // when texture area is large, bilinear filter the first mipmap glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); // if wrap is true, the texture wraps over at the edges (repeat) // ... false, the texture ends at the edges (clamp) glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap ? GL_REPEAT : GL_CLAMP ); glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap ? GL_REPEAT : GL_CLAMP ); // build our texture mipmaps gluBuild2DMipmaps( GL_TEXTURE_2D, 3, width, height, GL_RGB, GL_UNSIGNED_BYTE, data ); // free buffer free( data ); return texture; }

This topic is closed to new replies.

Advertisement