• Advertisement

Archived

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

Milkshape Loading Texture

This topic is 5504 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, small prob. I''m fairly new at OPenGL and c++ in general, so please feel free to mock me if I''ve done something galatically stupid here. I''m using WinXP, DEV c++ 4.9.7.3 with the SDL wrapper. Using the tutorial I can load in the actual ms3d shape not a problem. I can render it in pixels, wire frame, add lighting. I can''t, however, get the damn thing to texture. I thought it was the path name stored in the object but I managed to pass out the filename reference and load it as a normal SDL surface bitmap. I tried this on the model, but it is just white. SDL apparantly stores the RGB data in a different order then OPENGL, but if I use this code (from NEHE Game Tutorial 4 SDL port) tmpbuf = (Uint8 *)malloc(image->pitch); if ( tmpbuf == NULL ) { fprintf(stderr, "TEXTURE::LoadBMP: could not allocate buffer\n"); return 0; } rowhi = (Uint8 *)image->pixels; rowlo = rowhi + (image->h * image->pitch) - image->pitch; for ( i=0; ih/2; ++i ) { for ( j=0; jw; ++j ) { tmpch = rowhi[j*3]; rowhi[j*3] = rowhi[j*3+2]; rowhi[j*3+2] = tmpch; tmpch = rowlo[j*3]; rowlo[j*3] = rowlo[j*3+2]; rowlo[j*3+2] = tmpch; } memcpy(tmpbuf, rowhi, image->pitch); memcpy(rowhi, rowlo, image->pitch); memcpy(rowlo, tmpbuf, image->pitch); rowhi += image->pitch; rowlo -= image->pitch; } free(tmpbuf); My PC goes bananas, anyone got an ideas?

Share this post


Link to post
Share on other sites
Advertisement
[Long repeditive abuse post (the bishop_pass one) - I thought dave told you to stop it]

[edited by - Andrew Russell on January 27, 2003 10:39:44 PM]

Share this post


Link to post
Share on other sites

  • Advertisement