Sign in to follow this  

Textures and surfaces

This topic is 4113 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


As far as I understand, your question doesn't make sense to me.

In Direct3d there is this base class called surface. Many D3D objects, such as vertex buffers and index buffers, are derived from it. Texture is just a special form of surface. There are lots of operations that you can do with textures, such as assigning them to certain texturestage or nowadays to a shader sampler. You can also use a texture as a rendertarget in order to render the scene into a texture (and perhaps use it later for rendering other things). Textures, as other surfaces, may be locked for reading / writing the data on byte level.

Can you give us an example where the subject was mentioned ?

Cheers

Share this post


Link to post
Share on other sites
Textures are collections of surfaces. Look up IDirect3DTexture9::GetSurfaceLevel() - each of the mip-map levels is an IDirect3DSurface9.

Quote:
You can also use a texture as a rendertarget in order to render the scene into a texture (and perhaps use it later for rendering other things)
I understand what you're saying, but just to be pedantic this isn't quite right [smile]

A render-target is actually a surface - look up IDirect3DDevice9::CreateRenderTarget() and see that it actually creates/returns a IDirect3DSurface9. Same with SetRenderTarget() calls - they take a surface not a texture.

For RtT effects you're going to use the aforementioned GetSurfaceLevel() to retrieve one of the surfaces making up a texture then use it to connect rendering with the contents of the texture. Surfaces can't be bound as texturing/shading inputs but textures can, thus it'd be reasonably accurate to describe the process as a form of casting like you get in most programming languages [smile]

Quote:
surfaces were some kind of formated memory space just for storing graphics
They are! One of the big things in the early days of DirectDraw (which is where the concept of 'surface' originated afaict) was that surfaces represented a contigous block of memory that could be used to store pixels. Its a bit before my time, but as I understand it this wasn't always the case when doing Mode13/DOS level graphics. Having the API provide (even if its just an abstraction) a continuous block of memory to use was very useful...

I don't think it's accurate to consider IDirect3DSurface9 as a base class though. Via composition (correct OOP term?) it is used to construct more complex types but it is, in its own right, a valid type that can be used on its own. IDirect3DResource9 and IDirect3DBaseTexture9 are probably better examples of base classes [smile]

Share this post


Link to post
Share on other sites

This topic is 4113 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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