Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


OpenGL programming


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
11 replies to this topic

#1 KrishKP   Members   -  Reputation: 125

Like
1Likes
Like

Posted 19 December 2013 - 07:38 AM

Hello there...I am a beginner to graphics and game programming.I have a doubt.What do you mean by OpenGL programming?Is it the same as C++ graphics programming?



Sponsor:

#2 exOfde   Members   -  Reputation: 809

Like
4Likes
Like

Posted 19 December 2013 - 07:44 AM

In general....OpenGL programming is c++ "graphics programming". Why i say that?

Because to code something which has graphical elements you need external libaries which

support such feature like OpenGL.

So C++ itself cannot do any graphical stuff at all. First additional libaries which their

API's allow the programmer to use function or classes that allow graphical programming.

 

Again OpenGL is such a libary. SDL would be an other one as example.


Edited by exOfde, 19 December 2013 - 07:49 AM.


#3 KrishKP   Members   -  Reputation: 125

Like
0Likes
Like

Posted 19 December 2013 - 07:50 AM

So OpenGL is a library.Which has built in functions for our uses...Its what helps us to do graphics programming.What we call OpenGL code is actually C++ code right?



#4 exOfde   Members   -  Reputation: 809

Like
1Likes
Like

Posted 19 December 2013 - 07:56 AM

  • I would not say built in functions, because the library itself provides functions we need for our purpose. In the library itself is nothing "built in"
    • but simply said yes you are right
  • OpenGL Code
    • if you use c++ as code language and use the OpenGL library then yes

Edited by exOfde, 19 December 2013 - 07:58 AM.


#5 Kaptein   Prime Members   -  Reputation: 2174

Like
5Likes
Like

Posted 19 December 2013 - 07:59 AM

OpenGL is a standard which can be implemented by just about anyone. Graphics drivers typically have OpenGL implementations installed with them. OpenGL specifies a C implementation, and the driver creators implement that by following the standard.

When you install Windows, it comes with a decades old OpenGL 1.1 dll. If you install graphics drivers from vendors who have modern implementations of OpenGL you can go all the way to OpenGL 4.2.

The most widely supported OpenGL version now is OpenGL 3.x. Some laptops with no GPU support OpenGL 2.x only. Please don't use it. Use 3.x.

 

As I said, OpenGL is a C-specification, and its a rasterizer. It doesn't require being hardware accelerated, but it sure helps.

To write your own OpenGL backend is very time consuming, but you'll learn alot. If you want to make games, don't do it. If you want to learn, go ahead. It can be frustrating, but very rewarding.

 

EDIT: I should probably add that a C-library works with C++. C++ can be thought of as an extension of C. C tends to have baggage from ye olde, but is very straightforward, while C++ has more functionality and stricter rules which could enable safer coding, and in some cases could end up with a class-hierarchy soup.

You will want to have classes in game programming, because projects tend to get big, fast. Abstracting away things which can go wrong into safe to use classes help alot. Just don't go overboard. If you find yourself overloading (float) in your vector class, you know you need counselling.

 

good luck!


Edited by Kaptein, 19 December 2013 - 08:03 AM.


#6 BitMaster   Crossbones+   -  Reputation: 4233

Like
6Likes
Like

Posted 19 December 2013 - 10:35 AM

C++ can be thought of as an extension of C. C tends to have baggage from ye olde, but is very straightforward, while C++ has more functionality and stricter rules which could enable safer coding, and in some cases could end up with a class-hierarchy soup.


I found thinking like that to be unhelpful and sometimes even dangerous. There was a time when C++ was indeed an extension of C (and C++ compilers actually worked by generating intermediate C code from the source C++ code). Those times are long gone though.
C and C++ are very different languages and they require completely different mindsets to work with efficiently. People who think of C++ as an extension of C very often end up with some kind of primitive 'C with classes'. They very often end up getting the disadvantages of both languages and the advantages of neither.

Obviously, you need a bit of C. Crossing library borders without a clean, pure C interface is either suicidal or requires strict rules and well-defined assumptions. But code from just about all languages communicates with each other over some kind of C interface - that is no reason to start thinking of one of those language as an extension of C though.

#7 Vortez   Crossbones+   -  Reputation: 2704

Like
2Likes
Like

Posted 19 December 2013 - 11:24 AM

OpenGL, like directx, are bits of code stored in a dll. It doesn't matter which language use them, as long as the language can load dlls, and you have the proper include files to access those functions from the dll, you'll be fine. For example, you could do OpenGL or dx in delphi or c# if you want to, it's just a bit more trouble to make it work at first, but when you're setuped, it's pretty much the same as c++.

 

Learning pure opengl is not easy at first, but fesable. You could start with glut since it handle the setup of a basic application for you, which mean you can concentrate on the code that really matter. Or try something like SDL.



#8 KrishKP   Members   -  Reputation: 125

Like
0Likes
Like

Posted 20 December 2013 - 04:21 AM

OpenGL, like directx, are bits of code stored in a dll. It doesn't matter which language use them, as long as the language can load dlls, and you have the proper include files to access those functions from the dll, you'll be fine. For example, you could do OpenGL or dx in delphi or c# if you want to, it's just a bit more trouble to make it work at first, but when you're setuped, it's pretty much the same as c++.

 

Learning pure opengl is not easy at first, but fesable. You could start with glut since it handle the setup of a basic application for you, which mean you can concentrate on the code that really matter. Or try something like SDL.

what is pure OpenGL?



#9 BitMaster   Crossbones+   -  Reputation: 4233

Like
0Likes
Like

Posted 20 December 2013 - 04:35 AM

I would guess he meant writing OpenGL code without any helper libraries. That is usually not a good idea. There is a lot of boiler plate code to be written until you get a window you can draw in. SFML, GLFW or SDL both simplify that process massively and are relatively easy to use (and cross-platform). I would not recommend GLUT.

If you are working on Windows you will also want GLEW since you only get (completely useless) OpenGL 1.1 out of the box.

#10 KrishKP   Members   -  Reputation: 125

Like
0Likes
Like

Posted 20 December 2013 - 08:31 AM

Then each language will have different codes while working with OpenGL right?There is no OpenGL code..Only C++ or any other language code implementing OpenGL functions..right?



#11 BitMaster   Crossbones+   -  Reputation: 4233

Like
1Likes
Like

Posted 20 December 2013 - 08:48 AM

The language of your OpenGL implementation is completely irrelevant and there is no one answer. Even on a fairly locked down operating system like Windows, the code contained in the library you link to is just a thin wrapper to communicate with the driver. The language the driver is written in is anyone's guess. Probably C and Assembler. Maybe not. Maybe something else.
The driver will communicate with the graphics card (unless it's a pure software OpenGL implementation, which is possible but not a common use case during game development) where the commands will be run by the manufacturer and model specific hardware.

The point you have to concern yourself with is the C interface defined by OpenGL. Any language which can link to C functions can use OpenGL (pretty much every language which could be used in a production environment can do that). Using a thin C library as a binding any such language could also to be used to create an OpenGL implementation.

Edited by BitMaster, 20 December 2013 - 08:52 AM.


#12 Solid_Spy   Members   -  Reputation: 420

Like
0Likes
Like

Posted 22 December 2013 - 04:27 PM

[/quote]
what is pure OpenGL?
[/quote]

"Pure" OpenGl, are the libraries that contain the code that is written in C, but can be used for C++ as well, or can be wrapped around for C# or any other language.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS