Jump to content
Posted 07 June 2011 - 04:24 PM
Posted 07 June 2011 - 04:50 PM
Follow my RTS game ICBM
Posted 07 June 2011 - 05:37 PM
Posted 09 June 2011 - 12:57 AM
Quite right. ATI driver developers dont need to know what a opengl context is among other things.
<BR>Unless you plan on become a programmer in a team that makes GL drivers and you want to work at nVidia, it doesn't matter what a GL context is.<BR>
Posted 09 June 2011 - 06:29 AM
Posted 09 June 2011 - 07:03 AM
Posted 09 June 2011 - 01:13 PM
If you can define something then you don’t understand it!
Sadly, nobody before Tachikoma tried to answer to the question. Although it is not crucial for programmers to know how rendering context is implemented, it is important to understand what it is in order to know how to use it.
An OpenGL context is the data structure that collects all states needed by server to render an image. It contains references to buffers, textures, shaders, etc. OpenGL API doesn’t define how rendering context is defined, it is up to the native window system; but none of OpenGL commands can be executed until rendering context is created and made current.
A rendering context should be compatible with a window it will render to. There can be several contexts per application, or even per window. On the other hand, the same context can be used for rendering in multiple windows, but in that case all windows using the same context must have the same pixel format. Now we have come to another important aspect of rendering context: its rendering surface must be adequate for appropriate window. In order to achieve that we have to choose and set appropriate pixel format of the window that have to be created. The rendering surface is the surface to which primitives are drawn. It defines types of buffers that are required for rendering such as a color buffer, depth buffer, and stencil buffer.
Choosing pixel format must be performed in order to verify support for defined pixel format. The system would return ID of appropriate pixel format, or the closest match. Setting pixel format that is not previously returned from the system would almost certainly fail. It is not recommended to set pixel format for the window more than once.
In order to issue any OpenGL command we have to make OpenGL context active (i.e. “current”). By making active we assume binding OpenGL context to a window’s DC. It is done from a certain thread. Only one context can be made current for a single thread at a moment. Calling OpenGL commands from another thread (different from that made the context current) fails. If we want to make use of multithreading update of OpenGL resources, we have to make a share-group. All contexts from the share-group share resources like textures, buffers, etc. Although multithreading update can be useful in some cases, we have to be aware that most OpenGL drivers serialize access to the GPU. OpenGL guarantees that all commands in the single context will be executed in the order in which they are issued, but there is no guarantee for multiple contexts. Since OpenGL 3.2 synchronization is enabled through sync objects.
Prior to OpenGL 3.0, there was just one type of OpenGL rendering contexts; the context that contains full functionality. OpenGL3.0 introduced forward compatibility, and 3.2 introduced concept of profiles. If anyone is interested in further discussion, we could proceed, but I think it is a bit out of the scope of the OP’s question. I was already too comprehensive.
Posted 10 June 2011 - 07:16 AM
This isn't a direct answer to your question, but I would recommend the NeHe tutorial for learning openGL. It will take you through creating a Window, setting up openGL, drawing on the Window, and much more.
Posted 10 June 2011 - 07:22 AM
Posted 10 June 2011 - 08:00 AM
Posted 10 June 2011 - 09:49 AM
You can say that about any other webpage.
Anyway it is good that beginners can read something, although I don't think they really read wiki.
Posted 10 June 2011 - 12:35 PM
You need a window because that is how it is designed. It is as simple as that.
You can of course modify it or make suggestions right here if you want things worded differently.