Jump to content

  • Log In with Google      Sign In   
  • Create Account


opengl initialization flow


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
6 replies to this topic

#1 gokudev   Members   -  Reputation: 117

Like
0Likes
Like

Posted 13 December 2013 - 11:00 PM

I am building my first opengl app. I have been following the tutorials here http://www.rastertek.com/gl40tut03.html

I would like some explanation as to how the author know what calls to make next. Like what is the flow of initializing opengl?

 

looking at the InitializeExtensions method, he sets the devicecontext, then sets a pixel format and then creates a rendering context. So what decides what should be initialized before or after? is there a diagram where I can visualize as to what should be init first?

 

Thanks



Sponsor:

#2 reenigne   Members   -  Reputation: 199

Like
0Likes
Like

Posted 14 December 2013 - 01:25 AM

Where he got the information from was as he stated the documentation provided by the Khronos Group. You should be able to find it on opengl.org
As to what reason there is to an order. Some things rely on others to be built before hand. In other cases some of them can certainly be moved around and done at different times.
If you look at the function calls various items need to be passed to them. Example: you can't get the devicecontext with out the hwnd(handle to window) you can't get the renderContext without the device context. So the requirements for each of those in effect sets the order they are created.

In truth there are easier ways to create an opengl 4 program using SDL2.0 with opengl and glew is easier by far in my opinion having done both ways.

Using a simpler method would allow you more time to work on learning the API rather than dealing with the setup. Also using SDL2.0 will make it easier to go cross platforms if that is ever an interest.
 



#3 gokudev   Members   -  Reputation: 117

Like
0Likes
Like

Posted 15 December 2013 - 12:59 AM

interesting, glew should be very useful! at first site, i was totally disgusted by putting all those typedefs and proc addresses in my project. I wished there was a simpler way so glew seems to be the way to go. What other benefits does one get from SDL2.0. It says it provides lowlevel access to the video buffer, audio output, mouse and keyboard. Isn't all that available in opengl? 



#4 EarthBanana   Members   -  Reputation: 697

Like
0Likes
Like

Posted 15 December 2013 - 01:34 PM

everything to do with rendering is available in opengl - the benefit to SDL is that it also gives you input, sound, some file io, texture loading help, and other stuff.. opengl basically gives you access to functions that can manipulate the graphics card - you have to do everything else (or use other libraries to help - like loading images from file in to textures for example - I would definitely use some library to help with that)

 

if your going to be doing direct opengl calls then you should definitely be using GLEW or some such thing.. dont forget to initialize it before making any opengl calls


Edited by EarthBanana, 15 December 2013 - 01:34 PM.


#5 gokudev   Members   -  Reputation: 117

Like
0Likes
Like

Posted 15 December 2013 - 03:34 PM

I also ran into SFML  (http://www.sfml-dev.org/documentation/2.1/) it seems to be doing the same function as SDL. What do you guys think of SFML?



#6 richardurich   Members   -  Reputation: 1160

Like
0Likes
Like

Posted 15 December 2013 - 11:53 PM

If you like low-level libraries, use SDL (it's C). If you like higher level libraries and object oriented stuff, use SFML (C++).

 

 

The only issue I can see that would override your preference above is smart phone/tablet support. SFML still shows iOS and Android support as "soon", so SDL is probably more mature and a safer bet if you're going to target smart phones and tablets.


Edited by richardurich, 15 December 2013 - 11:53 PM.


#7 reenigne   Members   -  Reputation: 199

Like
0Likes
Like

Posted 16 December 2013 - 01:26 AM

My preference is SDL2.0 https://www.youtube.com/watch?v=UwpZOwT9nVc If you are using code::blocks this will tell you what you need to set it up with opengl3+ ->4+ and how to compile GLEW for it. Its easy enough my 12 year old son can do it.

If you are using Visual studio it is already compiled for it to start with. There majority of sites seem to cover visual studio. I chose code blocks because I can switch from Windows to Linux and my environment doesn't change. I've had no trouble compiling the programs from one OS to the other.






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