Big beginner tutorial

Ok guys, I’ve just finished my tutorial about making a 2D pong game with LWJGL.
For the moment, it’s only available in PDF format.

You can grab the tutorial here : http://chman.kaioa.com/blog/lwjgl/GLPong.pdf
And the source code here : http://chman.kaioa.com/blog/lwjgl/GLPong.zip

If you find any mistakes, please tell it, I would be please to make this tutorial better !

Chman

Edit: source link, thanks to Simon !

:smiley: I just browsed through your tutorial!
Nice work! Just what a noob ( like me :)) needs to get started in both games and LWJGL programming.

But I guess you screwed the link for the source code…
It points to your pdf tutorial file…

It looks nice and complete from the initial skimming, but I don’t think I like that LWJGL is encouraged to be installed in the JRE/JDK directory. I’d much rather prefer directions on how to use -Djava.library.path and instructions on adding lwjgl.jar to the classpath. It will make it easier to distribute LWJGL for the game developer in the long run and isn’t that much harder.

  • elias

Elias you’re absolutly right, but I don’t want to bother a beginner with many command parameters… The way I make people install LWJGL is for coding purpose only. I will make a special tutorial on how to distribute LWJGL games (with and without webstart).

Right now I’m writing another tutorial to make the pong game better (I plan two others pong tutorials : making the game time-based and another with point counting and drawing the score on screen).

If you have any recommandation for another beginner tutorial, tell me here or PM me :wink:

Chman

Nice work!

Bill

Brilliant, well done!

Kev

Thanks to all !

I’ve nearly finished the second tutorial but I won’t be at home tomorrow, so don’t expect it before this week end…

About posting my tutorial on JGF, I don’t have time to convert the all thing to HTML, so if someone want to do it, I can send him the OpenOffice formated document :slight_smile:

Chman

Friggin’ A, man.

Good Work :slight_smile:

Hope that more people will dig into LWJGL,
as the Documentation is the most worse part.

  • Jens

It’s me again :slight_smile:

Finally, I’ve just finished the second tutorial, which explains how to make a FPS counetr and how to use it to make the game time-based.

You’ll find the PDF and the source package at the bottom of my lwjgl demos/tutorials page : Clicky.

This tutorial is way smaller than the previous one, but I think it’s very important to know how to make games time-based and not frame-based.

A third article is on the way ! 8)

Chman

Whatever you do, don’t do that! :).

We don’t have ANYTHING in HTML.

Everything is in a small subset of XHTML. You just used properly-closed P, I, B, U, A, and IMG tags.

Love the tut. Question: I am using the following code to load a texture on the ball (just to see if I can)


glBindTexture(GL_TEXTURE_2D, texture[0]);
              // Start drawing a quad.
            glBegin(GL_QUADS);

                  glVertex2i((int)(locationX - 10), (int)(locationY + 10));
                  glVertex2i((int)(locationX - 10), (int)(locationY - 10));
                  glVertex2i((int)(locationX + 10), (int)(locationY - 10));
                  glVertex2i((int)(locationX + 10), (int)(locationY + 10));

              // End quad drawing.
            glEnd();

Unfortunately I only ever get white. Where am I dying?

M

Have you enabled GL_TEXTURE_2D ?
if not, just type that in the init code :

glEnable(GL_TEXTURE_2D);

:slight_smile:
Chman

You’ll also need to specify texture coordinates for each vertex - search Google for glTexCoord2f.

cfmdobbie is right. If you encounter others problems with textures, take a look at the LWJGL demos on my webpage, it could help you : here :slight_smile:

Chman

edit: there’s one called “AWT Texture Loading” that could help you.

thanks a bunch!

added both suggestions and voila!

luv it!

Thanks