Sign in to follow this  

[c++] Where do you start with graphics?

This topic is 3666 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I have simple goals. I want to make a dot move around the screen that is controlled by the player. Than I want to spawn other dots to move around the screen. Then I want to have them orbit the player. Then I want to define what happens when a dot hits the player. But my problem is this: I don't understand all this directX, openGL, and whatever crap. Google didn't find me an "I'll explain all" site, nor even a "Well I use ____ AND why." What's worse is I tried navigating the Microsoft website to get directX. If you've ever tried to navigate this website, maybe you'll agree that its ease of use is deceptive (and the layout is so goddamn cluttered!). I've finally learned about pointers, classes, arrays, and everything I believe to be background information, and I can't figure out how to get even a black screen! PS: If possible, I'd actually like to build my own graphics library (purely academic reasons) so please put that into consideration in your response. Thanks in advance.

Share this post


Link to post
Share on other sites
Well there is this start here guide on gamdev.net^^

DirectX and OpenGL are just two different ways to talk to the graphics card. Choose the one with the better sounding name and buy a beginners book for it.
I think books are better for beginners than learning with online tutorials.
Oh, and you should learn 3D mathematics at some point.

Browse the books section of gamedev.net for tips.

Share this post


Link to post
Share on other sites
Quote:
Original post by stonemetal
what you want to do sounds like it could be done in 2d I would look in to SDL if I were you. They have links to tutorials on how to use sdl on its website.

I second SDL!

Share this post


Link to post
Share on other sites
slowmike:
Not unhelpful, but I always forget to mention I'm a zero budget programmer.

tsukinokaze:
Also not unhelpful, but the gamedev articles are the first places I looked.
However, I'm glad to know that there's no real difference between OpenGL and DirectX, but part of my problem was getting them.

stonemetal:
Finally, something to google! Well, I did that and even followed a tutorial on how to put every file in its place and even made a program in it that says hello world with the help of that tutorial. Unfortunately I got more "[Linker error] undefined reference to `whatever' " errors than I've ever heard existed. But still, SDL looks pretty cool and is an alternative to Microsoft and whoever owns OpenGL.

Corrob:
That settles it. I'll get this to work and run with it!

PS: What would cause the linker errors? Might have solved the problem by the time you answer, but just in case I don't...

Thanks for the responses.

EDIT:
For the pure joy of it, Dev c++ gives me the error " [Linker error] undefined reference to `SDL_RWFromFile' ", but that's not even in the file! I've double, triple checked the files. What the hell could be happening?

[Edited by - Splinter of Chaos on December 1, 2007 7:29:48 PM]

Share this post


Link to post
Share on other sites
Drop Dev-C++, it hasn't been touched in years. Grab Code::Blocks or Visual C++ Express 2008.

As for SDL being an "alternative" to DX and OGL, that's not entirely true. SDL is entirely 2D and doesn't use graphics hardware. It's great if all you need is simple 2D graphics, but if you push it too much you'll start losing frames quickly.

In spite of this, I think SDL is a great way to start. Just getting some images onto a screen and moving around for the first time is a thrill.

Share this post


Link to post
Share on other sites
So in other words, if I'm going to do something that with punish CPUs (and I know the idea I mentioned at the top will because I've already made a version that does), I shouldn't use SDL?

Is there any way to adapt SDL to graphics hardware? An extra library? Something?


Yeah, getting something on the screen will be a thrill to me, but if it's a sooner or later thing, I'd rather learn... I guess OpenGL sooner than later.

EDIT:
I cannot believe how difficult it is to start in OpenGL, or any graphics thing, really. Tutorials expect to give me page long programs and learn what everything means in one sitting. I can't believe there's no such thing as a makeScreen(int width, int height) function.

[Edited by - Splinter of Chaos on December 2, 2007 1:20:55 AM]

Share this post


Link to post
Share on other sites
SDL is not slow at all!

It has been used in commercial games for their gnu/linux ports, and could just as well be used for the windows versions, if it weren't for political reasons.

It uses hardware acceleration for 2D graphics, and when you are ready to move to 3D, then it has built-in support for OpenGL. (You continue using the SDL functions for keyboard input, and sound etc, while using opengl functions for graphics)

SDL is highly recommended.

Another alternative is Allegro http://www.allegro.cc which is a little bit easier to get started with, since it has functions for drawing lines, drawing text, playing music, while SDL is very barebones, only allowing you to plot pixels and blit surfaces, and play raw sound PCM data

However, there are many addons for SDL that take care of these things, and also, it may be a good learning experience to write your own line drawing function :)

Good luck!

Share this post


Link to post
Share on other sites
if you are looking for some good tutorials on sdl, try lazy foo productions, as they give you good basics. if you want something on how to put a game together, try http://www.aaroncox.net/tutorials/.

if you want a good tutorial on opengl, try http://www.videotutorialsrock.com/ i agree that it is hard to get into, but he has both a video tutorial and a text tutorial to help clearly explain, with excersizes for each lesson, making it a lot clearer than other tutorials.

good luck

Share this post


Link to post
Share on other sites
Quote:
Original post by johnfarris
... it may be a good learning experience to write your own line drawing function :)


That's the idea. So it sounds like SDL for now, and I don't have to relearn that I learned in SDL anyway when I do OpenGL later.

I'm starting to see the advantage of being taught programming instead of learning it myself with tutorials. It's not depth, insight, or gaining the right tools (actually, those except insight are school's weaknesses), it's completeness and pacing. Tutorials might be in deep in some areas and lack where the writer's uninterested. A teacher needs to give consistent depth, and needs to tell you things in an order that reinforce usage AND technique simultaneously.

Share this post


Link to post
Share on other sites
http://lazyfoo.net/SDL_tutorials/index.php

Lazyfoo is where it's at. It shows you how to make a dot move around the screen and other cool stuff.

SDL is a great place to start.

Share this post


Link to post
Share on other sites
I think the info on making SDL work on the different IDEs might be a bit old, though. I've spent the past few hours on lesson three because I still can't get Code::Blocks to recognize the SDL_image library I supposedly put in there.

Isn't the hard part supposed to be the coding? Is there NO EASY WAY to get at least the files set up and only have to worry about whether I've included them or not?

Share this post


Link to post
Share on other sites

This topic is 3666 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this