glTexImage2D unable to set border

First of all I have an nvidia card and my writing partner has an ati card.

I wanted to load textures into our game and wrote this code which recives the name of a .raw file. The size of the picture that i gave is 512*512. When i set the border to 0 in glTexImage2D we both could see the texture but there was a seam between textures (I put in a skybox). When I set the border to 1 and left everything the same including the picture I could see everything fine and the seams were gone but my partner couldn’t see anything and when i looked at the error created it was that the width and height were no good.
From what i understand i need the picture to be of size 2^n+2 because of the border, so i resized the picture to 514 and tried that, but then i see the picture very distorted, in black and white. When i tried to resize it to 1024 it looks fine, when i resize it to 600 it has tiny almost invisible lines going throw it.

I use IrfanView to convert my pictures, and my original pictures are jpg, but I did try to convert from .bmp and that was no good either.

When i try to open a .bmp with the same code i get the picture in different colors.

Please help, I really want to get rid of the seams.

This is the code

bool loadTexture(const char* filename,int width,int height, GLuint& texture)
{
FILE* file = fopen( filename, “rb” );
if (file == NULL)
return false;

int dataSize = widthheight3;

unsigned char* pixels = (unsigned char*)malloc(dataSize);
if (pixels == NULL)
{
fclose(file);
return false;
}

// read texture data
fread(pixels,dataSize,1,file);

fclose(file);

glGenTextures( 1, &texture );

// select our current texture
glBindTexture( GL_TEXTURE_2D, texture );

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

// select modulate to mix texture with color for shading
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );

glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, width, height, 1, GL_RGB, GL_UNSIGNED_BYTE,pixels);

// free buffer
free(pixels);

return true;
}

give it a try with glPixelStorei(GL_UNPACK_ALIGNMENT,1);

before your glTexImage2D

If you can’t get borders to work, try using GL_CLAMP_TO_EDGE instead of GL_CLAMP. It won’t give perfect filtering, but it should make the seam a lot less visible.