Basic matrix initialization problem... 
Author Message
 Basic matrix initialization problem...

hi to all...

    I have been working on "VB6 + DirectX 8" for soem while...    i jsut
started working on "VB.NET + DirectX 9". I am a relative newcomer to the
later. I have problems with initialization matrices (i think).
    Thou i am doing lotsa things..     to be simple..   if i draw a simple
2d geometry (triange) giving pixel coordinates, it has no problem. Now if i
initialise my World matrix + View Martix + Projection matrix as described in
the code below..  and change my geometry to draw a triangle around the
origin..  it does not render the triangle..  it just displays the blank
screen..

CODE:
'matrix function...

Public Sub SetupMatrices()
'** World Mtrix - describes out 3D world.. (i know.. abstract definition..
:)

D3Ddevice.Transform.World = Matrix.Identity()

'** View Matrix - describes the properties of the camera (position, target,
axis)

D3Ddevice.Transform.View = Matrix.LookAtLH(New Vector3(0.0F, 0.0F, 10.0F), _

New Vector3(0.0F, 0.0F, 0.0F), _

New Vector3(0.0F, 1.0F, 0.0F))

'** Projection Matrix -describes our perspective of view (angel of view,
aspect ratio, nearest pt., farthest pt.)

D3Ddevice.Transform.Projection = Matrix.PerspectiveFovLH(CSng(Math.PI) / 4,
1.0F, 1.0F, 1000.0F)

End Sub

' my geoemtry function....

Public Sub IniGeoemtry()

VBuffer = New VertexBuffer(GetType(CustomVertex.TransformedColored), 6,
D3Ddevice, 0, CustomVertex.TransformedColored.Format, Pool.Default)

Dim vCube As CustomVertex.TransformedColored() = CType(VBuffer.Lock(0, 0),
CustomVertex.TransformedColored())

vCube(0) = New CustomVertex.TransformedColored(100, 100, 0, 1,
System.Drawing.Color.Red.ToArgb)

vCube(1) = New CustomVertex.TransformedColored(150, 50, 0, 1,
System.Drawing.Color.Red.ToArgb)

vCube(2) = New CustomVertex.TransformedColored(200, 100, 0, 1,
System.Drawing.Color.Red.ToArgb)

VBuffer.Unlock()

End Sub

End of code...

    i call the SetupMatrix() after i create my 3Ddevice...  (i can call even
in the render loop)...     and the IniGeometry() after that..      could
anybody tell me what i am doing wrong...  in the matrices or anythign else..
any response will be greatly appreciated....

thanks a lot
Phalgun Babu



Wed, 28 Dec 2005 15:11:04 GMT  
 Basic matrix initialization problem...
[Please do not mail me a copy of your followup]



Quote:
>    Thou i am doing lotsa things..     to be simple..   if i draw a simple
>2d geometry (triange) giving pixel coordinates, it has no problem.

This is a triangle in screen space?

Quote:
>    i call the SetupMatrix() after i create my 3Ddevice...  (i can call even
>in the render loop)...     and the IniGeometry() after that..      could
>anybody tell me what i am doing wrong...  in the matrices or anythign else..
>any response will be greatly appreciated....

It sounds like your geometry is either outside the view frustum, or
you have the winding order backwards.  Try comparing your code to the
appwizard generated sample that draws a single triangle.
--
"The Direct3D Graphics Pipeline"-- code samples, sample chapter, FAQ:
          <http://www.xmission.com/~legalize/book/>
    Pilgrimage: Utah's first annual demoparty on August 9th, 2003
               <http://pilgrimage.scene.org>


Thu, 29 Dec 2005 04:59:23 GMT  
 Basic matrix initialization problem...
hi..
    i have tried all that.  its completly inside the view frustum..  i have
camera set at (0, 0, 10) and looking at (0,0,0)..  with projection martix as
(pi/4, 1, 0.1, 1000).. (as described in the code in my original mail) that
is a big enuf view i guess..  as i draw the triangle only 1 unit around the
origin...(for now)   and i have it clockwise and i have disabled culling..
but doesnt help..   tried comparing it to samples..  everything looks normal
n very similar..     i just cant find the missign link..   the same logic
was working great with DX8..  but now i dunno with DX9..
    lets see anyway..  thanks for the response...   any more advise is
allways welcome..

regards
Phalgun



Quote:
> [Please do not mail me a copy of your followup]



> >    Thou i am doing lotsa things..     to be simple..   if i draw a
simple
> >2d geometry (triange) giving pixel coordinates, it has no problem.

> This is a triangle in screen space?

> >    i call the SetupMatrix() after i create my 3Ddevice...  (i can call
even
> >in the render loop)...     and the IniGeometry() after that..      could
> >anybody tell me what i am doing wrong...  in the matrices or anythign
else..
> >any response will be greatly appreciated....

> It sounds like your geometry is either outside the view frustum, or
> you have the winding order backwards.  Try comparing your code to the
> appwizard generated sample that draws a single triangle.
> --
> "The Direct3D Graphics Pipeline"-- code samples, sample chapter, FAQ:
>           <http://www.xmission.com/~legalize/book/>
>     Pilgrimage: Utah's first annual demoparty on August 9th, 2003
>                <http://pilgrimage.scene.org>



Fri, 30 Dec 2005 13:02:26 GMT  
 Basic matrix initialization problem...
[Please do not mail me a copy of your followup]



Quote:
>but doesnt help..   tried comparing it to samples..  everything looks normal
>n very similar..

Did you generate an AppWizard single triangle program and compare it
to that?
--
"The Direct3D Graphics Pipeline"-- code samples, sample chapter, FAQ:
          <http://www.xmission.com/~legalize/book/>
    Pilgrimage: Utah's first annual demoparty on August 9th, 2003
               <http://pilgrimage.scene.org>


Fri, 30 Dec 2005 23:47:56 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Visual Basic 5.0 CCE and UserControls Object Initialization

2. Dynamic Matrix in Visual Basic

3. Revive Matrix Dartmouth Basic

4. matrix inversion in basic

5. initialization problem?

6. VBAJET32.DLL INITIALIZATION PROBLEM

7. DLL Initialization Problem

8. Big Array Initializations Problems

9. Initialization problem

10. MDI Child initialization problem (Runtime Error 6 Overflow)

11. Compressed printing problem - dot matrix - Help!

12. VB5.0, labels and matrix printer problem

 

 
Powered by phpBB® Forum Software