Few simple questions...

Started by Unknown, December 08, 2004, 05:11:34

Previous topic - Next topic

Unknown

I have started to make my first 2d-game with LWJGL, but there are still few questions that I need answers to. I have some experience in java and game programming but practically none in OpenGL :cry:.

1. My project uses the TextureLoader class from Space Invaders example. Unfortunately this class doesn't seem to support png-images with alpha channels. Nice transparency effects are a must for any good 2d-game. Is there any simple way to add this support? As I have said before, I have little knowledge of OpenGL, so some sample code would be nice.

2. How can I adjust screen gamma and similar values (Like done in AlienFlux, for example)?

3. What would be the best way to create scrolling background with LWJGL? It should have multiple layers with alpha values.

4. I remember reading somewhere in this forum that 3d quads are uneffective and slow to be used in a 2d game. Is this true? What other ways are there to create 2d graphics with LWJGL?

Chman

1) I don't really know, I've never use this kind of thing into OpenGL. I only use blend & alpha states... You should take a look at www.javagaming.org forum into the lwjgl part, make a search, many people have asked the same question...

2) Display.setDisplayConfiguration(floatÃ, gamma,  floatÃ, brightness, floatÃ, contrast) :)

3) Do you need background with many objects (static or animated) or just a simple background texture (like, for example, a sarfield for a space shooter) ?

4) Triangles are sightly faster than quads, and triangle strips are very fast, but if you don't have to draw more than some thousands polygons, don't worry about the quad performances. Why triangles are faster ? simply because 3D cards are built to compute triangles...

Chman

princec

I use GL_QUADs for my sprites and particles. I should really use GL_TRIANGLEs for particles but I'm lazy.

Cas :)

Unknown

The background should be a simple transparent static texture with multiple layers. :|

princec

If you try to simply blit huge textures on top of each other with alpha blending you'll run out of fill rate very fast. Tiles is the best way to go here. The bottom layer should be opaque and drawn without blending.

I use my sprite engine for blitting tiles in some other (unreleased) code I've got, which works fine.

Cas :)