Jump to content
  • Advertisement
Sign in to follow this  
ColdDoT

OpenGL C++ DDS to PNG

This topic is 3008 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

Hello all, There is a game called WonderKing, and they store all there pictures in headerless DDS files. Well i've been able to track down the patterns of the file name with what type of DDS format they are. And the same for the filesize and width height. Currently they i got 4 formats figured out: DXT1 DXT5 A4R4G4B4 A1R5G5B5 There are 4 textures of 4096kb whom i can not figure out what type they are. Anyways i'm currently converthing them to png through opengl. i first use
	glGenTextures(1, &textureNo);
	glBindTexture(GL_TEXTURE_2D, textureNo);

	switch(format.name)
	{
		case DXT1:
		case DXT5:
			glCompressedTexImage2D(GL_TEXTURE_2D, 0, format.dataType, width, height, 0, fileSize*1024, rawBuffer);
		break;
		case A4R4G4B4:
		case A1R5G5B5:
			glTexImage2D(GL_TEXTURE_2D, 0, format.internalFormat, width, height, 0, format.pixelFormat, format.dataType, rawBuffer);
		break;
	}

	rgbBuffer = (GLubyte*)malloc(width*height*4);
	glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgbBuffer);
The glTexImage2D and glCompressedTexImage2D are for preps and then calling glGetTexImage to get the the image information in the correct format. I'm not sure if this is faster then skipping opengl and just setting the pixel buffer correct by plain C (if so is there some documentation on buffers with formats etc) After that i use lodepng to encode the picture to png and save it. However this step takes like 10-20 secs per texture. So my question is, how would you tackle this problem? If you wanna convert dds files to png, and preverable also show the pictures is a GUI (currently i'm using a opengl rendering area to render the textures to) This is my first, post btw so thanks for reading and taking your time. +ColdDoT

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!