Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Lode

Member Since 29 Mar 2002
Offline Last Active Oct 10 2014 03:08 AM

#4984818 Why can't Bilinear/Bicubic resize transparent images properly?

Posted by Lode on 28 September 2012 - 12:51 PM

I like computer graphics and digital image processing, and therefore made a painting program in my spare time. This program works on RGBA by default for almost every filter. So possibly it will rescale correctly for you. Does it do what you want? http://sourceforge.n...ects/lodepaint/

If it doesn't work, then pick foreground color R=0, B=0, G=0, A=0 (so black and fully transparent, where black is the same color as the outlines of the image), and floodfill that on the transparent areas. Then try the resizing again.


#4884318 Transparent bitmaps help - lodePNG/SOIL problem

Posted by Lode on 15 November 2011 - 03:46 PM

Hello,

First of all, I think it is easier with the following code by using LodePNG_decode32_file which does everything (loading file, decoding, using RGBA format) at once. Also note the "free" at the end, otherwise you'll have a memory leak, the complete memory of the texture will remain in RAM for nothing. OpenGL makes a copy of this data, the original one can be freed.

GLuint GLTexture::LoadPNG(char* filename){
   		unsigned char* image;
   		unsigned w, h;
   		unsigned error;
   		GLuint texName;
   		error = LodePNG_decode32_file(&image, &w, &h, filename);
   		if(error) {
              printf("Error reading in png image: %d\n", error);
              exit(1);          
   		} else {
              glPixelStorei(GL_UNPACK_ALIGNMENT,1);
              glGenTextures(1,&texture[0]);
              glBindTexture(GL_TEXTURE_2D,texture[0]);
              glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
              glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
              glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
              glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
              glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,w,
                   		h,0, GL_RGBA,GL_UNSIGNED_BYTE,image);
   		}
   		free(image);
   		return texName;
}

If you're working in C++, you can also use the C++ version of LodePNG.

If you include all source files, normally it should be able to link. What happens if you use the code above? Probably the sample was for an older version of LodePNG. Does your project already exist out of multiple source files, is using functions from other source files possible, and are there differences in settings related to this file in your IDE? Does your IDE support mixing C and C++ code? Try renaming lodepng.c into lodepng.cpp?

Hello,

I am working on a 3D game, I'd like to overlay the 3D scene with some GUI elements with transparency... The engine I am working with has got loaders for TGA and BMP files, my first guess was to try incorporate PNG in it. I am trying to use lodePNG, which any recommend. I included lodepng.h to the header files and lodepng.c to the source files. I included the header in my class and created this function from a sample I saw:


GLuint GLTexture::LoadPNG(char* filename){
	unsigned char* buffer;
        unsigned char* image;
        size_t buffersize, imagesize;
        GLuint texName;
        LodePNG_Decoder decoder;

        LodePNG_loadFile(&buffer, &buffersize, filename);
        LodePNG_Decoder_init(&decoder);
        decoder.infoRaw.color.colorType = 6; /* Load image as RGBA */
        LodePNG_decode(&decoder, &image, &imagesize, buffer, buffersize);
        if(decoder.error) {
       	printf("Error reading in png image: %d\n", decoder.error);
       	exit(1);		
        } else {
       	glPixelStorei(GL_UNPACK_ALIGNMENT,1);
       	glGenTextures(1,&texture[0]);
       	glBindTexture(GL_TEXTURE_2D,texture[0]);
       	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
       	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
       	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
       	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
       	glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,decoder.infoPng.width,
                        decoder.infoPng.height,0, GL_RGBA,GL_UNSIGNED_BYTE,image);
        } 
        return texName;
}

But when I compile I get a bunch of unresolved symbol errors:
lodepng Error 1 error LNK2019: unresolved external symbol "void __cdecl LodePNG_decode
...
And many other references to functions....

I tried with SOIL (Simple Opengl Image Library) too, where I included the libSOIL.a file and the SOIL.h file to my project, still a bunch of unresolved simbols when compiling...

I am not sure what I am doing wrong.... But I don't necessarily need to read PNG, all I need is a quick and easy way to render 2D sprites with transparency...

Could anyone help with this?

Thank you!




#4861972 So what do you think of this DRM scheme?

Posted by Lode on 15 September 2011 - 03:04 AM

Wolfenstein 3D is a 20 year old game, and if you have it legally, you can still play it in DosBox today.

If you buy a game from today, and go 20 years forward. Will you still be able to play it in an emulator that emulates today's hardware on the hardware of 2030?

If no, and this no is not due to technical reasons, then it has unacceptable DRM imho.


#4850305 Today relevant hardware comparison

Posted by Lode on 17 August 2011 - 07:29 AM

because all the powerful AMD cards have been snapped up by bitcoin miners


Wow, seriously? Bitcoin has an actual effect on the hardware market?

So that's what all this computational power is used for, rather than for science, or, of course, games? :)


#4834190 What do you think about the Revelation?

Posted by Lode on 12 July 2011 - 02:50 AM

I'm indifferent towards it, I think books about programming languages, math and algorithms are way more useful and interesting and applicable to life today.


#4832475 Post your website, get candy

Posted by Lode on 07 July 2011 - 02:29 PM

http://www.lodev.org

Just a list of some projects, I'm not a designed unfortunately!


#4827986 The Worst of E3 2011

Posted by Lode on 26 June 2011 - 02:28 PM

Hehe


Uh I don't get it, that wasn't bad at all!


#4802601 Why can't we put a Brain in a Vat yet?

Posted by Lode on 25 April 2011 - 04:14 AM

It's not even possible to replace a single lost leg _properly_, and you want to replace the complete body?

Would you like to be the first? :)


#4793867 Test my Flash game!

Posted by Lode on 03 April 2011 - 10:37 AM

Hey,

The game has been updated quite a lot, and a graphics artist is working on the graphics now!!

What do you think of the latest state of the game? The new graphics start in level 6 (the outside theme is still the old graphics).

Also, would anyone be interested to make a few levels for it?

It can now be found here:

http://lodev.org/wizardtower/

Or direct link to Flash file here: http://lodev.org/wiz...wizardtower.swf

Thanks!


#4784863 What Does Everyone Think About The New Site Layout?

Posted by Lode on 12 March 2011 - 10:22 AM

Bring back the username colors of Moderators (lightred), Admins (green), GDNet+ Users (yellowbrownish), Banned Users (red strikethrough) and Suspended Users (also red?) please!

This color used to be visible on the thread listing page and inside threads. It was a great feature.


#4782469 Some music to spice up your games

Posted by Lode on 06 March 2011 - 11:19 AM

Not even a view;( Come on guys, where's the get feedback - give feedback spirit?


I like the first two the most.

The third is a bit too chaotic for me, and the fourth to bassy for me :)

The first song has some parts that remind me a bit of some Zerg music of StarCraft 1 :)


#4781535 Tower defense game mechanics/dynamic discussion thread

Posted by Lode on 03 March 2011 - 03:17 PM

Here's what I find important in TD games, I can express it much better in words here than in the poll.

1) I don't want multiplayer at all. I want single player in Flash, (both multiplayer and installing are too much of a hassle, and I use Linux)
2) There must be a campaign with upgrades between missions! There must be upgrades and the ability to replay earlier levels with the upgrades. There must be hard to earn skill points to do these upgrades, and there must be enough of them and hard enough to earn them (but not discouragingly hard) to keep you busy for hours or even days. GemCraft's upgrade system was fantastic!
3) Building mazes is nice but there are very fine games without maze building too, such as GemCraft.
4) There must be a mode where there keep coming progressively harder waves forever. I hate it when after 50 waves the game suddenly stops while you could have kept going due to your nice buildup.
5) It's very important that there are different towers for different strategies, and types of towers that are good against types of enemies. The splash damage vs single hit damage and air vs ground in Desktop TD was a good example, and the colors in GemCraft are another good example. And things that slow down, boost, etc..., obviously are very interesting.

Best TD game I've ever played is GemCraft 0 and GemCraft 1. Second best are the ones with the balloons and monkeys from Ninja Kiwi. Third best is Desktop Tower Defense. The one that gave me the most hours of fun was definately the GemCrafts.

By the way, if you want to make a multiplayer TD game, like it seems from the poll options, by no means I want to stop you from doing that, go ahead! :)


#4769651 Gdnet Black (Alpha)

Posted by Lode on 04 February 2011 - 01:00 PM

Another thingie, some smiley images have visible white border pixels.

Use translucent PNGs, IE6 is dead in the meantime, almost everyone and their cat's webbrowser supports translucent PNGs!


#4767004 Lets make a c++ program!

Posted by Lode on 30 January 2011 - 07:18 AM

I'll start:

#include <windows.h>


Um what a bad start, imho. Only the first line of code and already it's prevented from compiling on my Linux box!

EDIT: Oh, posts above this already talked about that, sorry for the duplication. However my point still stands. You should have titled the thread "let's make a MFC program" or so if this was the direction you were going.


PARTNERS