VB.NET/DX9 Presentation Paramters Device Window 
Author Message
 VB.NET/DX9 Presentation Paramters Device Window

I like others on the forum have neen trying to display
dx9 content usning a picture box insted of the form.

The code below creates a device using the picCanvas
control on the form.  BUT this does not render until I
manually resize the form and then the image does not
resize (even though it is anchored).

Has anyone done this succesfully in vb.net?

presentParams.Windowed = True
presentParams.SwapEffect = SwapEffect.Discard
'presentParams.DeviceWindow = Me.picCanvas
'presentParams.DeviceWindowHandle = Me.picCanvas.Handle
device = New Device(0, DeviceType.Hardware, Me.picCanvas,
CreateFlags.SoftwareVertexProcessing, presentParams)
AddHandler device.DeviceCreated, AddressOf
Me.OnCreateDevice
AddHandler device.DeviceReset, AddressOf Me.OnResetDevice
Me.OnCreateDevice(device, Nothing)
Me.OnResetDevice(device, Nothing)

BTW setting the devicewindow and its handle don't seem to
have any effect, what do they do?

Thanks,

Matt



Tue, 19 Jul 2005 01:14:01 GMT  
 VB.NET/DX9 Presentation Paramters Device Window
And the rendering code is ?



Quote:
> I like others on the forum have neen trying to display
> dx9 content usning a picture box insted of the form.

> The code below creates a device using the picCanvas
> control on the form.  BUT this does not render until I
> manually resize the form and then the image does not
> resize (even though it is anchored).

> Has anyone done this succesfully in vb.net?

> presentParams.Windowed = True
> presentParams.SwapEffect = SwapEffect.Discard
> 'presentParams.DeviceWindow = Me.picCanvas
> 'presentParams.DeviceWindowHandle = Me.picCanvas.Handle
> device = New Device(0, DeviceType.Hardware, Me.picCanvas,
> CreateFlags.SoftwareVertexProcessing, presentParams)
> AddHandler device.DeviceCreated, AddressOf
> Me.OnCreateDevice
> AddHandler device.DeviceReset, AddressOf Me.OnResetDevice
> Me.OnCreateDevice(device, Nothing)
> Me.OnResetDevice(device, Nothing)

> BTW setting the devicewindow and its handle don't seem to
> have any effect, what do they do?

> Thanks,

> Matt



Tue, 19 Jul 2005 02:51:43 GMT  
 VB.NET/DX9 Presentation Paramters Device Window

Ive based my code on that used in Tutorial 3:

device.Clear(ClearFlags.Target,
System.Drawing.Color.Blue, 1.0F, 0)
device.BeginScene()
SetupMatrices()
device.SetStreamSource(0, vertexBuffer, 0)
device.VertexFormat = CustomVertex.PositionColored.Format
device.DrawPrimitives(PrimitiveType.TriangleList, 0, 1)
device.EndScene()
device.Present()

I confused to why rendering to a picture box insted of a
form would change it's behaviour.  i.e. it doesn't
initialise or resize properly.

Please Help.

Quote:
>-----Original Message-----
>And the rendering code is ?


dans le message de

>> I like others on the forum have neen trying to display
>> dx9 content usning a picture box insted of the form.

>> The code below creates a device using the picCanvas
>> control on the form.  BUT this does not render until I
>> manually resize the form and then the image does not
>> resize (even though it is anchored).

>> Has anyone done this succesfully in vb.net?

>> presentParams.Windowed = True
>> presentParams.SwapEffect = SwapEffect.Discard
>> 'presentParams.DeviceWindow = Me.picCanvas
>> 'presentParams.DeviceWindowHandle = Me.picCanvas.Handle
>> device = New Device(0, DeviceType.Hardware,
Me.picCanvas,
>> CreateFlags.SoftwareVertexProcessing, presentParams)
>> AddHandler device.DeviceCreated, AddressOf
>> Me.OnCreateDevice
>> AddHandler device.DeviceReset, AddressOf
Me.OnResetDevice
>> Me.OnCreateDevice(device, Nothing)
>> Me.OnResetDevice(device, Nothing)

>> BTW setting the devicewindow and its handle don't seem
to
>> have any effect, what do they do?

>> Thanks,

>> Matt

>.



Fri, 22 Jul 2005 16:56:46 GMT  
 VB.NET/DX9 Presentation Paramters Device Window
Hi,

    I am not familiar with dot-net, but unless you "anchored" the picture box, the resizing will
not occur automatically. And even if you resize the picture box (or the form) without redefining
the back buffer, the stretch-bit will kill your frame rate, even if you resize JUST A LITTLE BIT
and the diagonals boundaries will be coarse (relatively large "squared steps" instead of a smooth
diagonal) when you resize-upward.

    In VB6, a possible way is to redefine a Device in the onResize event of the control (or of the
form) (with the right hwnd, leaving the height and width to zero, so DX will query and compute the
right size).

'  VB6 code

Private mSpecs As D3DPRESENT_PARAMETERS
Private mDevice As Direct3DDevice8

    ...
Public Sub Resize()
    ' To be executed if the window is resized
    On Error Resume Next
    mSpecs.BackBufferWidth = 0  'to be resized
    mSpecs.BackBufferHeight = 0 ' see help file
    mSpecs.hDeviceWindow = mHwnd
    mDevice.Reset mSpecs

    If 0 <> Err.Number then
            ...
    End If
End Sub

    Since I am absolutely not interested by the dot-Net technology, at the moment, I can't tell
more, but I hope those few hints may help you,

Vanderghast, Access MVP


Ive based my code on that used in Tutorial 3:

device.Clear(ClearFlags.Target,
System.Drawing.Color.Blue, 1.0F, 0)
device.BeginScene()
SetupMatrices()
device.SetStreamSource(0, vertexBuffer, 0)
device.VertexFormat = CustomVertex.PositionColored.Format
device.DrawPrimitives(PrimitiveType.TriangleList, 0, 1)
device.EndScene()
device.Present()

I confused to why rendering to a picture box insted of a
form would change it's behaviour.  i.e. it doesn't
initialise or resize properly.

Please Help.

Quote:
>-----Original Message-----
>And the rendering code is ?


dans le message de

>> I like others on the forum have neen trying to display
>> dx9 content usning a picture box insted of the form.

>> The code below creates a device using the picCanvas
>> control on the form.  BUT this does not render until I
>> manually resize the form and then the image does not
>> resize (even though it is anchored).

>> Has anyone done this succesfully in vb.net?

>> presentParams.Windowed = True
>> presentParams.SwapEffect = SwapEffect.Discard
>> 'presentParams.DeviceWindow = Me.picCanvas
>> 'presentParams.DeviceWindowHandle = Me.picCanvas.Handle
>> device = New Device(0, DeviceType.Hardware,
Me.picCanvas,
>> CreateFlags.SoftwareVertexProcessing, presentParams)
>> AddHandler device.DeviceCreated, AddressOf
>> Me.OnCreateDevice
>> AddHandler device.DeviceReset, AddressOf
Me.OnResetDevice
>> Me.OnCreateDevice(device, Nothing)
>> Me.OnResetDevice(device, Nothing)

>> BTW setting the devicewindow and its handle don't seem
to
>> have any effect, what do they do?

>> Thanks,

>> Matt

>.



Fri, 29 Jul 2005 23:46:39 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. DX9 VB .Net Docs--WHERE?!

2. Direct3D, DX9 VB.NET DrawPrimitives Limitation?

3. Vb.Net / DX9 tutorials?

4. Creating a mesh (DX9, VB.NET)

5. IndexBuffer / VB.net / DX9

6. VB .Net or VS .Net for Smart Devices

7. VB .Net 2003 Standard or VS .Net 2003 Pro for Smart Devices

8. VB.NET presentation in San Francisco 9/23

9. VB.NET presentation in San Francisco 9/23

10. SMART DEVICE EXTENSION (Windows CE.NET)

11. Presentation, Demonstrations or Installation on Windows, Windows NT

12. VB.NET: Steps for Converting a Windows .NET Application to a Web .NET Application

 

 
Powered by phpBB® Forum Software