Jump to content
  • Advertisement
Sign in to follow this  
Dark_Light

SetTexture(Base Texture)

This topic is 4964 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

I have been using direct X for a while now, but today I just happened to notice that the Device.SetTexture takes in a Base Texture and not a Texture. Now when looking at the base texture I find its missing a lot of the things I would assume are needed. Ie there is no locking or unlocking interface! No format definitions no width height or anything. I understand that’s it’s a base class and so contains less than the texture class, But how can the device accept a base class if none of this stuff is supported?? If someone could just let me know how this works then it will put my mind at rest. Take the case where I want to make a new texture called SupperTexture : BaseTexture.. This is what the texture class douse. And at this point it adds locking and unlocking. So what it is locking and unlocking? And what’s the point when the BaseTexture will not lock or unlock anything!

Share this post


Link to post
Share on other sites
Advertisement
Whilst Direct3D provides many interface definitions that you'll throw around in your progams, the actual implementations are mostly private - and actually subclassing them can cause you more problems than its worth..

Quote:
Now when looking at the base texture I find its missing a lot of the things I would assume are needed. Ie there is no locking or unlocking interface! No format definitions no width height or anything. ..... But how can the device accept a base class if none of this stuff is supported??

Have you considered the possibility that the device doesn't need this information? [wink].

Rememeber that the driver will be the final holder of information - it can/will know anything/everything about the created resources.

hth
Jack

Share this post


Link to post
Share on other sites
I know it all works since the fact it is working.

And to be honist I don’t relay cair to much, Its more of a would be nice to know thing if you get what I mean.

Take the locking for instance. If locking is not in the base class. And that’s what SetTexture is using then what put locking into the Texture class?
There must be some way of getting at the data in a BaseTexture without the need to lock it,

Now this is not the case with Index buffers and Vertex buffers as the most basic class for them contains locking and unlocking. And so I can see that it is needed.

So if the device can get along without this stuff why put it in. It’s a real bottle neck having to lock and unlock a texture.

The only real reason I can think of is to just keep things all the same. And that’s fine. Like I said it just something I would like to know more about.

Share this post


Link to post
Share on other sites
When you create a Direct3D resource, D3D owns it. It has priviledged access to it. Lock calls are there to give YOU safe access to the resources.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!