Sign in to follow this  
emt

Rendering Context VS Device Context

Recommended Posts

emt    134
Hi !

Wanted to know the technical meaning and the difference between "[b]RENDERING CONTEXT[/b]" and "[b]DEVICE CONTEXT[/b]". These terms cause frequent confusion :mellow:.

Share this post


Link to post
Share on other sites
elurahu    258
I'm guessing you're thinking DirectX 11 specifically. Rendering contexts were introduced in DirectX 11 as a way of handling multithreaded rendering.

The Device context are used for resource creation / manipulation, while all state are handled through the Rendering contexts. When you create a Device context you automatically create one Rendering context called the immidiate context which generally are all you need for non-multithreaded rendering.

It's been a while since I worked with DX11 so bear with me - But all the above are also very clearly stated in the "DirectX Graphics Documentation" which comes with the SDK.

If this was not what you were looking for, just try and elaborate a bit on the issue.

Share this post


Link to post
Share on other sites
emt    134

Both are also terminology used in Windows OpenGL, so yeah, you need to be specific about what context (pun intended) you mean.

Asked in OpenGL context

Share this post


Link to post
Share on other sites
Brother Bob    10344

I don't know how accurate this description of the decide context actually is in reality, but think of the device context as the object holding the window-side resources such as the frame buffers, describing the pixel formats of the window and frame buffer, and such. From OpenGL's perspective, the DC is more or less the window itself. Tasks such as allocating a frame buffer, depth buffer and stencil buffer, swapping double buffers at the end of a rendering pass and deciding the pixel format of the window, is not done via OpenGL, but with the help of a platform dependent layer such as WGL for Windows, glx on X-based systems and so on.

 

The rendering context is the OpenGL-side resources such as texutre objects, vertex buffer objects and shader programs, and it also manages states such as which texture is attached to which texture unit, which shader programs are active, which vertex attribute buffers are bound to the shader attributes, and so on.

 

Basically, any call to function beginning with gl is made on the rendering context. A rendering context is attached to a device context with for example the wglMakeCurrent function on Windows. You can have for example two windows (each window is practically equal to a device context) and one rendering context, and you then direct the rendering to each window by attaching the rendering context to each of the window and draw whatever you want.

Share this post


Link to post
Share on other sites

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