My first little project

Hi, first of all excuse me for my bad english, I’m studing Opengl and I don’t know if my reasoning is correct:I’d like to write a little game

(a pong, for example) and so I’m studing in function of this.I follow this way:
a) My reference is the RedBook (avaiable in pdf on this web-site), so I use also the glut library, I’ will study at least the first five

chapter (or all?)
b) At this point, I hope to be able to write a game similary, if no,means that I must still study .


The questions are:
1)You suggest me to begin with a 2D game?
2)It’s useful, for the first time, to study on the source-code of other person, and the try to write a little game?
3)A book like “Beginning OpenGl game programming” is obbligatory?

whatever advise is welcomed!!!

Hello!

Originally posted by Omicron:
The questions are:
1)You suggest me to begin with a 2D game?

Generally OpenGL was designed to be efficient 3D API but since 2D is only a kind of ‘truncated 3D space’ once you know how use 3D you will be able to fully work with 2D also. Anyway, begining with 2D is usually more simple because some things are just easier to visualize (for example on a piece of paper). What’s more, most of 2D math remains true also for 3D. Anyway, I think that having some good tutorials or books (as Red Book surely is) you can go for 3D right away remebering to slowly and gradually advance in the material you are learning from.

2)It’s useful, for the first time, to study on the source-code of other person, and the try to write a little game?

Yes, of course! There is nothing better than referencing to someone else’s code. Some thing are just easier to understand if you actually see how to use them. It often happens that I read something in documentation and I have no clue what it is about. But when I take a glimpse at the sample code everything becomes clear (usually :wink: ). Just be careful to look for trusted source codes.

3)A book like “Beginning OpenGl game programming” is obbligatory?

IMO, having The Red Book is all you need at the time. Just read it from desk to desk (even a few times if you need to). Plus, you can check out some great OpenGL tutorials in the Net, like :
nehe.gamedev.net or www.gametutorials.com

Hope it helps! :slight_smile:

I will follow your advise !! For the moment I will study on the redbook, when I feel myself ready I begin to write a game. Thanks :wink:

I just find the base for my first game. At this link there is a little example of pong 2D using glut and openGL. It’s so easy that understood also me :smiley:

Hi, I have a problem. the paddle, using by player, goes up with this code:

if(playerPaddle < windowWidth/*=700*/) 
	{
	if(GetAsyncKeyState(VK_UP))
		playerPaddle += step;
	}  

If in the main(), I declare:
glutInitWindowSize(700, 900);
the paddle goes up and it dosn’t stop.
How I can make this verification, changing the size of window?

if(playerPaddle < windowWidth/=700/)

hum no windowWidth = 900 … try windowHeight.

Idem, the paddle goes up and up and up…
if I use, for example
if playerpaddle < 350
it is nearly ok, I must find the righ mode!!!