# Unity Back/Front faces glitch with 3DS Loader

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

## Recommended Posts

I'm trying to compile libpng. But it won't work properly. With the included Makefile & the GNU Compiler /w wxDev-Cpp, all I get is make errors. When I use a Makefile generated by wxDev-Cpp, it compiles, but when I just link against the built library, in the console that shouldn't be there in my 3D app,(which was there before) libpng does some test by reading a png file, then writing it out to another file, then libpng forces the program to exit, certainly not what I want. What do I need to change in the generated Makefile to fix this? Are there any pre-compiled libpng builds, for Windows? How is libpng doing this anyway?(Executing code, when I didn't even use it, just linked against it.) Click here for the 3D problem. [Edited by - yellowstar on July 9, 2008 1:41:14 PM]

##### Share on other sites
Now zlib is acting up... It's basicly doing about the same thing as libpng, except now that I get got the console removed, it doesn't say what went wrong. Previously it would do some test, now zlib forces my program to quit when I'm just linking against it, for some reason. And the statically linked libz isn't included in that Win32 download... I'll try it anyway.

EDIT:
That pre-compiled libpng/libz for Win32 worked! At least it didn't force my program to quit anyway.

##### Share on other sites
I'm trying to use my code with PNGU. It's made for Nintendo Wii/Gamecube homebrew, but it compiles after fixing some things. For some reason, all I get is a black texture. My .png doesn't have an alpha channel, I don't think. And PNGU doesn't handle RGB directly, it still uses alpha, it just uses a default alpha value. Could somebody post an example on using libpng?(The Wii version of this code works fine, textures-wise.)

unsigned char *LoadTexture(char *filename, GXTexObj *texObj){	int texsize;	int width, height;	unsigned char *texture_data = NULL;	char str[256];	char Str[256];	memset(str, 0, 256);	sprintf(str, "%s", filename);	IMGCTX pngContext;	PNGUPROP imgProp;	memset(&pngContext, 0, sizeof(IMGCTX));	memset(&imgProp,0 ,sizeof(PNGUPROP));	if(!(pngContext = PNGU_SelectImageFromDevice(str)))	{	sprintf(Str, "Failed to open texture %s!",str);;	//MessageBox(NULL,Str, "ERROR",MB_ICONEXCLAMATION);	return NULL;	}	PNGU_GetImageProperties(pngContext, &imgProp);	width = (int)imgProp.imgWidth;	height = (int)imgProp.imgHeight;        if(width<=0 || height<=0)return NULL;	texsize = (width * height) * 4;	texture_data = (unsigned char*)malloc((size_t)texsize);	if(texture_data==NULL)return NULL;	memset(texture_data, 0, texsize);        PNGU_DecodeToRGBA8(pngContext, (PNGU_u32)width, (PNGU_u32)height, texture_data, 0, 255);	PNGU_ReleaseImageContext (pngContext);        glGenTextures(1, (GLuint*)texObj);	glBindTexture(GL_TEXTURE_2D, *texObj);        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture_data);        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);	// Linear Filtering	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);	// Linear Filtering	return texture_data;}

EDIT:
I tried a .png with an alpha channel, with the same result.

[Edited by - yellowstar on July 8, 2008 10:39:25 PM]

##### Share on other sites
yellowstar: have you tried using GL_RGBX?

##### Share on other sites
Now that I disable the color gl commands when there's a texture, it works better. The texture shows up at least now. It's worse than the Wii version... But anyway, here's the new problem.(Note that topic is for this problem, for the Wii version, but the same glitch is on this PC version too.)

MOD: Move this topic to the Graphics Programming and Theory section.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 13
• 9
• 9
• 15
• ### Forum Statistics

• Total Topics
634075
• Total Posts
3015349
×