Jump to content
  • Advertisement
Sign in to follow this  
jarcher1390

C++

This topic is 3834 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

Im going to buy a book on game developing but i cannot choose Beginning C++ Game Programming - Premier Press Game Development or the one for opengl So what is the relation ship between C++ and Opengl What codeing do macintosh use just out of interest Thanks Jonny

Share this post


Link to post
Share on other sites
Advertisement
You can't use OpenGL without knowing C++ (assuming you're programming in C++). Think of it like this: C++ is a language that you use to tell the computer what to do. OpenGL is a tool used within C++ (though OpenGL can be used in other programming languages also) that lets you draw pictures and render things. You can't tell the tool what to do without knowing how to use the language (it's like telling someone how to build a house when you can't speak their language). If you want to use C++ and OpenGL, learn C++ first, then OpenGL.

Macs use OpenGL for their graphics, so if you want to program on a Mac, you can't use Direct3D or DirectX. However, you can use various languages on a Mac. C++ isn't the only one. There's C, C++, Java, Python, and a billion others that work on Macs. Some of these languages have graphics built into them that you can use to render things, so you don't need to learn OpenGL (though they might use OpenGL, they will tell it what to do, not you). C++ on the other hand, doesn't have a prebuilt in graphics library, so you can use C++ and OpenGL, but you can't really draw anything in C++ without some rendering API (which is what OpenGL is).

Share this post


Link to post
Share on other sites
Quote:
Original post by MikeTacular
You can't use OpenGL without knowing C++ (assuming you're programming in C++).


While I get what you're saying, let us not forget to remind jarcher1390 that he can use openGL in many languages.

Share this post


Link to post
Share on other sites
Quote:
Original post by nobodynews
Quote:
Original post by MikeTacular
You can't use OpenGL without knowing C++ (assuming you're programming in C++).


While I get what you're saying, let us not forget to remind jarcher1390 that he can use openGL in many languages.

Quote:
Original post by MikeTacular
You can't use OpenGL without knowing C++ (assuming you're programming in C++). Think of it like this: C++ is a language that you use to tell the computer what to do. OpenGL is a tool used within C++ (though OpenGL can be used in other programming languages also) that lets you draw pictures and render things. You can't tell the tool what to do without knowing how to use the language (it's like telling someone how to build a house when you can't speak their language). If you want to use C++ and OpenGL, learn C++ first, then OpenGL.

@nobodynews: If you didn't see in my first post that I explicitly said OpenGL can be used in other languages and you only need to know C++ before OpenGL if you're programming in C++, I have bolded some portions of my original post which will hopefully clear up any confusion.

Share this post


Link to post
Share on other sites
opengl is a tool, like directx. it isn't a program by itself, its a bunch of files you include in with you c++ project, or other programming languages, so you can use its functions, types, classes and all that to make graphics programming a lot faster and easier to deal with. you could write your own c++ program which doesn't use opengl or another graphics api, but you would need to know a lot more than you probably do(not that you don't know a lot), and it would take a lot of time

Share this post


Link to post
Share on other sites
Quote:
Original post by jarcher1390
okay i kinda get it so does opengl come in certain computer programs or does it have it own program.
Thanks again jonny

OpenGL is used in programs. It does not come in a program. OpenGL is just a collection of C++ (or whatever language you are using) functions. It isn't a program of any sort. I think you might be confused about what OpenGL actually is.

Share this post


Link to post
Share on other sites
It's really hard to describe what OpenGL truly is without programming jargon. If you are interested in knowing the details, first look up the Wikipedia and Google entries on API, and Library (for programming).

Share this post


Link to post
Share on other sites
C++ is used to make programs on your computer. C++ can add on openGL to help you make graphical programs for your computer.

Perhaps an analogy is needed. What if I compared it too cooking. You can have some basic ingredients and that is C++. What you do with them determines what you get at the end, wether it be an omlette or scrambled eggs. So if C++ is the iingredients, the result food could be a game or a word processor.

OpenGL comes into this by being preprocessed ingredients. Someone has already done some of the work for you. For example a pizza base could be bought from the store and you dont have to make it yourself. Then you can put your toppings on and it's done. Now if the pizza base is opengl you can then program with C++ and opengl to make your final product, the game/pizza.

If you read you are using a library, in this case opengl, you are basically using someone elses code for your own use. That's good because it speeds it up for you to make things. Why invent the wheel when programming when you can use someones library.

One last thing to keep in mind is that, jumping back to the cooking analogy, what if the pizza base isnt how you want it? Well dont use it and find a different pizza base or make your own. So if opengl doesnt do what you want, use another library that does or make your own.

Now hopefully you know the difference. Like cooking, if you want the job done right learn the basics first. Learn a language and then think about libraries. Plus unlike cooking where using the pizza base you dont need to get how they made it, using libraries you need knowledge of C++.

The analogy is no where near perfect as the subject is complicated and I'm thinking on my feet but figured I'd have a go helping

Share this post


Link to post
Share on other sites
I code in C++ on a mac.

You would want to learn C++ (although generally not advised as a first programming language to learn it is quite possible). The book "Beginning C++ through game programming" is quite good, fast paced, however some of the examples (actually only tic-tac-toe/referencing program) are a little over-complex imho.

I would say though, get that book to start with, then add in a supplemental book. If you get stuck on something in Game Programming Through C++ then you can look at the supplemental book for some different examples. This is usually a good way to learn because one C++ book is definitely not like the other.


If you want to try something simpler at first Python is usually recommended by people on this site. Visual Basic is also a good one. Just whatever you do when picking books don't get the "Learn in 24 hours" books.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!