Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualVero

Posted 10 July 2012 - 09:31 AM

Ok, I've created an simple little image it's a 32x32 pixel image with a white background in MSPaint.  then I created a second image this one is a copy of the 1st image only any part that had color was replaced with white and the rest of the image was filled in as black.

Do I need to do something special to either image within the image editor? would I need to install something like GIMP to do so? or is MS paint in windows 7 capable of something that advanced?  I uploaded the images into the program with SOIL.  source: http://www.lonesock.net/soil.html

Image loader function:
bool MPlayer::LoadObjTexture(char *filename,int slot)
{
	char *index = strchr(filename,'.');
	char *mask= new char[0];
	strncpy(mask,filename,index-filename);
	mask[index-filename]='\0';
	strcat(mask,"_mask.bmp");

	if(MObject::LoadObjTexture(filename,slot,false)&&
	   MObject::LoadObjTexture(mask,slot,true))
		return true;
	else
	{
		MessageBox(NULL,L"Hero Sprite failed to Load",L"GAME ERROR",MB_OK|MB_ICONEXCLAMATION);
		return false;
	}
}

bool MObject::LoadObjTexture(char *Filename,int slot,bool isMask)
{
	if(isMask)
	{
		mask[slot]=SOIL_load_OGL_texture
			(
			Filename,
			SOIL_LOAD_AUTO,
			SOIL_CREATE_NEW_ID,
			SOIL_FLAG_INVERT_Y | SOIL_FLAG_MIPMAPS|SOIL_FLAG_NTSC_SAFE_RGB
			);
		if(mask[slot]==0)
			return false;
		else return true;
	}
	else{
		sprite[slot]=SOIL_load_OGL_texture
			(
			Filename,
			SOIL_LOAD_AUTO,
			SOIL_CREATE_NEW_ID,
			SOIL_FLAG_INVERT_Y | SOIL_FLAG_MIPMAPS|SOIL_FLAG_NTSC_SAFE_RGB
			);
		if(sprite[slot]==0)
			return false;
		else return true;
	}
	return false;
}

Edit: glEnable(GL_BLEND) was declared in my initGL() function which is called at the start of the program. currently I've had no reason to disable blending

#1Vero

Posted 10 July 2012 - 09:29 AM

Ok, I've created an simple little image it's a 32x32 pixel image with a white background in MSPaint.  then I created a second image this one is a copy of the 1st image only any part that had color was replaced with white and the rest of the image was filled in as black.

Do I need to do something special to either image within the image editor? would I need to install something like GIMP to do so? or is MS paint in windows 7 capable of something that advanced?  I uploaded the images into the program with SOIL.  source: http://www.lonesock.net/soil.html

Image loader function:
bool MPlayer::LoadObjTexture(char *filename,int slot)
{
    char *index = strchr(filename,'.');
    char *mask= new char[0];
    strncpy(mask,filename,index-filename);
    mask[index-filename]='\0';
    strcat(mask,"_mask.bmp");

    if(MObject::LoadObjTexture(filename,slot,false)&&
       MObject::LoadObjTexture(mask,slot,true))
        return true;
    else
    {
        MessageBox(NULL,L"Hero Sprite failed to Load",L"GAME ERROR",MB_OK|MB_ICONEXCLAMATION);
        return false;
    }
}

bool MObject::LoadObjTexture(char *Filename,int slot,bool isMask)
{
    if(isMask)
    {
        mask[slot]=SOIL_load_OGL_texture
            (
            Filename,
            SOIL_LOAD_AUTO,
            SOIL_CREATE_NEW_ID,
            SOIL_FLAG_INVERT_Y | SOIL_FLAG_MIPMAPS|SOIL_FLAG_NTSC_SAFE_RGB
            );
        if(mask[slot]==0)
            return false;
        else return true;
    }
    else{
        sprite[slot]=SOIL_load_OGL_texture
            (
            Filename,
            SOIL_LOAD_AUTO,
            SOIL_CREATE_NEW_ID,
            SOIL_FLAG_INVERT_Y | SOIL_FLAG_MIPMAPS|SOIL_FLAG_NTSC_SAFE_RGB
            );
        if(sprite[slot]==0)
            return false;
        else return true;
    }
    return false;
}

PARTNERS