Graphic programming?

Started by
17 comments, last by mumpo 18 years, 11 months ago
Hello I am new to C++ and this forum. The last year i programmed qbasic but now i wanted to make the step forward to C++. I had some pretty nice games in qbasic, many of them include grafics. My question now is, since in C++ we have the choice between a consol programm and a windows application: How do I draw simple lines? I can't to that in the consol correct? My goal is to create a game where a ball is bouncing in a field like that: thanks, now the picture is working I hope you get the concept ;) i could show you the qbasic code if you would like here it is ;)

DECLARE SUB border ()
DECLARE SUB ball ()
DECLARE SUB initvars ()

DIM SHARED bball(20)
DIM SHARED x
DIM SHARED y
DIM SHARED a
DIM SHARED b


SCREEN 12
CLS

CALL initvars
CALL border

DO
CALL ball
LOOP

SUB ball

  CIRCLE (x, y), 2, 4
  FOR delay = 1 TO 2500: NEXT delay
  CIRCLE (x, y), 2, 0

  xr1 = POINT(x + 3, y)
  xl1 = POINT(x - 3, y)
  yt1 = POINT(x, y - 3)
  yb1 = POINT(x, y + 3)
  IF xr1 <> 0 THEN a = -a
  IF xl1 <> 0 THEN a = -a
  IF yt1 <> 0 THEN b = -b
  IF yb1 <> 0 THEN b = -b
  x = x + a
  y = y + b

END SUB

SUB border

FOR i = 1 TO 48 STEP 3
c = i / 3
y = i + 3
LINE (0 + i, 0 + i)-(640 - i, 480 - i), c, B
NEXT i

END SUB

SUB initvars

x = 215
y = 140
a = 1
b = 1

END SUB

[Edited by - Iluminator on May 23, 2005 7:16:19 PM]
Advertisement
get the http://www.opengl.org files for OpenGL and GLUT

You can also find tutorials there =)
Use html image tags like:
<img src="http://www.calistoo.de/files/ball.jpg">

I'd second OpenGL, tutorials here.

Also, google for SDL, it's a cross platform wrapper for OpenGL, including I/O, sound, networking etc.
Thank to you two, i'll try that NeHe homepgae. It seems to be well written and well understandable. Thank you for the link and the fast response.
You wuold probably like allegro. If you use dev-c++ you can just goto tools->package manager->Update then install allegro from there and your all set. It has almost equivalent functionality to SDL but with (IMO) better documentation.
I do use Dev-Cpp (because its for free and i am just starting with C++). I followed your instructions: Tools -> Package manager, but there is no option called Update or allegro.

i also tried the NeHe tutorial, it talks about the glaux.h header, but i have the glext.h header, is there is difference?
yes. Glext is NOT glaux. Yahoo or Google glaux.dll or glaux.h and Im positive you'll find the file. I did but I don't remember the link =
I would abandon glaux once you get familiar with the OpenGL thing and going with GLUT. If you're already familiar with using OpenGL go with GLUT =)

~Brandon Haston~
I'd actually recommend glfw over glut now. There are a ton of examples with glut out there, but they're easily converted to the more up to date glfw.
If you're just starting out with graphics programming, I suggest going here: www.allegro.cc

Once you have allegro (all the resources you need are at that site), use the Loomsoft tutorials (which will give you a perfect start) to get you started in graphics. Allegro is my favorite 2D API. It's fun and easy to use, and once you get the hang of it, progression is quick. Good luck!

-IV

-IVHumble Student

Quote:Original post by Iluminator
I do use Dev-Cpp (because its for free and i am just starting with C++). I followed your instructions: Tools -> Package manager, but there is no option called Update or allegro.

i also tried the NeHe tutorial, it talks about the glaux.h header, but i have the glext.h header, is there is difference?

It is Tools->Check for Updates/Packages, pick the devpak server(I have mine set at Dev-C++ Primary Devpak server which is the default). After it connects and gets the list of devpaks you can install, just find Allegro.

-Dmitriy

This topic is closed to new replies.

Advertisement