Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exactly is a surface in OpenGL ES or Direct3D?

I did not find a good definition of the concept of a drawing surface. What properties are associated with a surface? In the context of pure OpenGL there is no surface, since OpenGL has no notion of window system specific things. In OpenGL ES though you have the EGL API, which introduces the concept of a drawing surface, without defining it properly. What is your concise definition of a drawing surface?

like image 304
nschmidt Avatar asked Jun 23 '09 15:06

nschmidt


3 Answers

Basically, a surface is something that you can render to. It's a kind of device context, but potentially smarter since surfaces may know how to display themselves or do other useful things. EGL has three surface types:

  • Window Surface: a window.
  • Pixmap Surface: an image.
  • Pbuffer Surface: a pixel buffer.

This forum post may be helpful.

like image 77
Naaff Avatar answered Nov 11 '22 09:11

Naaff


In the Direct3D world, broadly speaking, a surface is some 2D image data. A texture is something that can be sampled and used in a shader. Typically textures are 'made of' surfaces; for example, each mip-map of a 2D texture is a surface, and each face of a cube map is a surface.

like image 2
sdclibbery Avatar answered Nov 11 '22 09:11

sdclibbery


In Direct3D, a hardware surface is typically -- but not always -- a section of hardware memory in the DirectDraw surface format. This is the same format used by DDS image files, and basically consists of a header, and then image data in one of several image formats that are specified in the header section. The usual properties are width, height, pixel format, and maybe a few misc things like stereo (which may not actually be supported, of course).

It's basically not much more than a generic term for an image.

like image 1
Promit Avatar answered Nov 11 '22 07:11

Promit