Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Whitehair

Loading of multiple .Raw files and displaying them to look like a 3D model

This topic is 5649 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have a problem with loading multiple .Raw files and displaying them to look like a 3D model. Currently all i can find and read up on is loading of a single BMP image. I need pointers on how to load multiple .raw files or maybe .bmp files and display them in order so that they will look like a 3D model.

Share this post


Link to post
Share on other sites
Advertisement
If you can display one then displaying multiple ones is easy.
First make sure that the images match up on the edges. Then, if you know the size ahead of time just draw one, translate by the size in the x or z direction and draw the other(s).

Jason Mickela
ICQ : 873518
Excuse my speling.

Vallejo Punk
The V-Town Have-Nots
Eskapo

"I don''t have to take this, I''m going to where I''m appreciated, my mom''s house"

Share this post


Link to post
Share on other sites
The problem I am facing, is a minimum of 80 raw binary images (or raw files) where each represent a sliced up captured view of a cross section of an irregular object

all i can read up and find to read is loading a single raw file.
And each of my raw file must not cover one another...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
This is a function for loading a single raw file in...
I figured to make sure that my multiple raw files do not block one another when being displayed, i have to just display the 1s of the binary file?

How do i load about 100 raw binary files in, and at the same time the greyarea or thw 1s of each binary file is displayed only. Dumping all the black details of each files.

// load a 512X512 RGB .RAW file as a texture
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 = 512;
height = 512;
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;
}

Share this post


Link to post
Share on other sites
This is a function for loading a single raw file in...
I figured to make sure that my multiple raw files do not block one another when being displayed, i have to just display the 1s of the binary file?

How do i load about 100 raw binary files in, and at the same time the greyarea or thw 1s of each binary file is displayed only. Dumping all the black details of each files.

// load a 512X512 RGB .RAW file as a texture
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 = 512;
height = 512;
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;
}

Share this post


Link to post
Share on other sites
quote:
Original post by PhiberOptic
Do you mean, load them as a height map?


If loading them as heightmap helps me to display them as a 3D object. Pls advice.

I have like 80-100 .raw images. which i converted them to binary form.

Each is a cross section slice of the whole object.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!