PDA

View Full Version : Velociraptor model for download



HJ
08-27-2002, 04:23 PM
Go here: http://hendrik.itgo.com

08-28-2002, 01:15 AM
Originally posted by HJ:
Go here: http://hendrik.itgo.com

Cool! However, when I tried it the texture would not work. Even when I converted to tga it would only work for my cube object. The velociraptor refused to be textured.

HJ
08-30-2002, 01:49 AM
I'm using this for texture mapping:

bitmap = new Graphics::TBitmap;
bitmap->LoadFromFile("texture.bmp");
GLubyte bits[128][128][4];
for(int i = 0; i < 128; i++)
{
for(int j = 0; j < 128; j++)
{
bits[i][j][0]= (GLbyte)GetRValue(bitmap->Canvas->Pixels[i][j]);
bits[i][j][1]= (GLbyte)GetGValue(bitmap->Canvas->Pixels[i][j]);
bits[i][j][2]= (GLbyte)GetBValue(bitmap->Canvas->Pixels[i][j]);
bits[i][j][3]= (GLbyte)255;
}
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, bits);

and:

glPushMatrix();
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture);
glBegin(GL_TRIANGLES);
etc...

tinak
08-30-2002, 04:48 PM
Thanks

erm, ... I will have to see if that code can be reworked into mine somehow. Plenty of time for that though. ;-)

Tina