Sign in to follow this  
abdellah

3D wrapper of ClearRenderTargetView (DirectX 10)

Recommended Posts

hi everyone :

i want the equivalent and the correct vb.NET code for the following interface memeber :

 virtual void STDMETHODCALLTYPE ClearRenderTargetView( 
            /* [annotation] */ 
            __in  ID3D10RenderTargetView *pRenderTargetView,
            /* [annotation] */ 
            __in  const FLOAT ColorRGBA[ 4 ]) = 0;

REMARKS:

FLOAT is float;

this declaration is from MSDN :

void ClearRenderTargetView(
  [in]       ID3D10RenderTargetView *pRenderTargetView,
  [inconst FLOAT                  ColorRGBA[4]
);

____________________________________________________________________________________________________________

 

Edited by abdellah

Share this post


Link to post
Share on other sites

notes :

if i use those declarations i got AccessViolationException error :

Sub ClearRenderTargetView(ByVal pRenderTargetView As ID3D10RenderTargetView,
                                ByVal ColorRGBA() As Single)

or :

Sub ClearRenderTargetView(ByVal pRenderTargetView As ID3D10RenderTargetView,
                                ByRef ColorRGBA() As Single)

or :

Sub ClearRenderTargetView(ByVal pRenderTargetView As ID3D10RenderTargetView,
                                ByVal ColorRGBA As Single)

or :

Sub ClearRenderTargetView(ByVal pRenderTargetView As ID3D10RenderTargetView,
                                ByRef ColorRGBA As Single)

but if i use the following synthax i gives me nothing (there is no return value) :

Sub ClearRenderTargetView(ByVal pRenderTargetView As ID3D10RenderTargetView,
                                ByVal ColorRGBA As D3DXVECTOR4)

with :

<StructLayout(LayoutKind.Sequential, Size:=4)>
    Public Structure D3DXVECTOR4
        Dim x, y, z, w As Single
        Public Sub New(ByVal xp As Single, ByVal yp As Single, ByVal zp As Single, ByVal wp As Single)
            x = xp
            y = yp
            z = zp
            w = wp


        End Sub
    End Structure

but the result is :

 

a.PNG

Edited by abdellah

Share this post


Link to post
Share on other sites

I've never implemented a wrapper for an api before so I can't help you since you say you implemented your own.  But if I were to guess, I'd think that if clearrendertarget has a problem there are other calls that don't work as well... maybe if you track those down you can narrow down where you went wrong with your wrapper.  Another alternative might be to look at the source for slimdx or sharpdx since they are opensource.  Maybe seeing there implementation can help you with yours.

Also I'd like to say DX10 is a dead API, DX11 is DX10 done right.  In addition IIRC DX10 and DX11 are extremely similar.  So if you move to DX11 you can use slimdx or sharpdx directly which will make your life much easier.

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