wrapper of ClearRenderTargetView (DirectX 10)

Started by
7 comments, last by Infinisearch 6 years, 6 months ago

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,
  [in] const FLOAT                  ColorRGBA[4]
);

____________________________________________________________________________________________________________

 

Advertisement

Are you using some sort of DX10 wrapper?

edit - slimdx seems to be a dx wrapper for .net technologies.  Also IIRC there's also sharpdx

-potential energy is easily made kinetic-

yes, i make my own wrapper.

which one? If so it shouldn't it have that exact function?

-potential energy is easily made kinetic-

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

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.

-potential energy is easily made kinetic-

but sharpDX and slimDX hide the source (the first layer) methods and show only the wrapped one.

Thats the way a wrapper works.  Besides they describe themselves as "low-level" and "lean" which hint that they are minimal wrappers.

-potential energy is easily made kinetic-

This topic is closed to new replies.

Advertisement