What I did today

Love it .

Did we just loose an entire page?

It was appended to the RPC thread.

A giftastic post from me… I learned how to make animated GIFs in GIMP and made my first one, showing how my optical simulator builds up a diffraction pattern in a series of iterations (in this case, the pattern is the diffraction pattern formed by a newtonian telescope):

Received my 4x4 in the mail, and after a few hours solved it intuitively. Now off to find faster methods of solving it.
Programming wise, implemented particles into my game as a nice addon, which is due for the state competition in a couple weeks. It’s mostly done from regionals, but there are just… bugs… mountains and mountains of slimy, multilegged, mutant bugs that seem to love reproducing like rabbits.

Apparently this is what happens when I open FL at 3am: https://soundcloud.com/zen-flux/3am-something
The distant thunder outside actually goes along quite well…

I haven’t been terribly productive the last few days, but I have done some optimizations that I am proud of.

First, loading fonts for OpenGL:
When I originally ran my old code, it regularly took more than 350ms to load a font to use. With some tweaks and headscratching, I got it down to ~170ms when loading the font for the first time, and ~70ms when loading a preloaded font in a different size. That is a 50% and 80% reduction in load time :slight_smile:

Second, saving images from OpenGL (for things like screenshots):
I began with some code I pulled from an opensource project online, that used ImageIO to write a BufferedImage with pixels to a file. This regularly (once again) took ~350ms. With a PNGEncoder that I pulled from a tutorial site online and some tweaks and headscratching to flip the image, I got a replacement for ImageIO with opengl screenshots down to ~110ms, which is almost a 70% reduction in time :slight_smile:

Here is the optimized (so far) code if anybody is interested in cutting the speed of ImageIO for glReadPixels calls by 70%: http://pastebin.java-gaming.org/f49245650201f

I realized that I wanted to finish only one part of Astrofirm: the lighting :cranky:. So I totally recreated the lighting system and improved upon upon it a bit.
First I made it in much less code and, I made lights able to change their intensity (yup couldn’t do that on the old system). So in the end, not much has changed in the look, but I’m going to keep tweaking it until it.

Wow, that lighting looks really good (waaaay better than mine, haha). May I ask about how you mixed colours? I’m using libgdx and I had to use the lerp function to vaguely get the results I wanted. I tried the add function but it became white.

If you are mixing colors, they do have to potential to become white under high intensities. You can’t see it in my picture but if I raise the intensity of all the lights, they will mix together and may become white if enough colors are involved:

Try lowering the brightness of the lights. It may solve your white problem.

It helped a little bit, although the way I update lights (recursion, bleh) gives it a pattern where it ā€œcuts inā€. Right now I’m more concerned over performance than correct light colours, but thanks for helping!

Finally managed to work around an AMD driver bug that’s been in the drivers since OGL 4 came out. Basically, when using BPTC texture compression, the AMD driver throws a GL_INVALID_OPERATION error when I try to update a texture with glCompressedTexSubImage2D(). To avoid this, I fell back to S3TC if the BPTC extension wasn’t supported OR it failed to pass this simple test without an error:


			int tempTexture = glGenTextures();
			glBindTexture(GL_TEXTURE_2D, tempTexture);
			glTexImage2D(GL_TEXTURE_2D, 0, ARBTextureCompressionBPTC.GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, (ByteBuffer)null);
			
			//This fails if running on AMD
			glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, ARBTextureCompressionBPTC.GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB, BufferUtils.createByteBuffer(16));

			glDeleteTextures(tempTexture);
			
			if(glGetError() == GL_NO_ERROR){
				supportsBPTC = true;
				System.out.println("Test passed, enabling BPTC compression.");
			}else{
				supportsBPTC = false;
				System.out.println("Test failed! Falling back to S3TC.");
			}

I finally found a way to work around this. If the texture is allocated using ARBTextureStorage (glTexStorage2D()) instead, glCompressedTexSubImage2D() works as expected with BPTC! Oh, the things I do for AMD… At least glTexStorage2D() is slightly faster to do than one glTexImage2D() for each mipmap level, which reduces the stuttering from texture streaming in the background.

Fun fact: Insomnia is based on OGL 3.2 Core profile, but can take advantage of a number of extensions to improve performance and efficiency:

  • Texture Storage to work around driver bugs and reduce stuttering when loading textures.
  • BPTC texture compression to improve the quality of color textures.
  • Base instance to improve performance when rendering instanced stuff (which is pretty much all models in Insomnia).
  • Multi draw indirect to improve performance when rendering models to shadow maps that don’t require texture binds per model type.

Got the monsters draw up, ready to carry on now…

https://dl.dropboxusercontent.com/u/1668516/shots/um3.gif

Not sure where of course…

Cheers,

Kev

Snails have eyes in their anntenas. Plus it would look more cute

Updated:

https://dl.dropboxusercontent.com/u/1668516/shots/um4.gif

Cheers,

Kev

I really like how the sprite moves in sub-pixels when the sprite is more pixelly. I really love that style of animation!

I added particles and fluids (WIP). I’m trying out something different with fluids. This system doesn’t use any ā€œconcrete collisionā€ (for a lack of a better term) but it can emulate the look and pressure of water. I’m not sure if I like how it looks yet but I’m not done tweaking it. I also added directional light and ambient light (not shown in gif)

http://fat.gfycat.com/ShimmeringIndolentAmazonparrot.gif

[Edit]
Took my best shot at the Kool-aid man 8)->

Won a local science fair, 500$ College scholarship, and I’m going to finals ;D

What was the project?

Protein Folding with Computers.

More work on the lighting engine:
[spoiler]

[/spoiler]