Jump to content
Xtreme .Net Talk

theHollow

Members
  • Posts

    9
  • Joined

  • Last visited

theHollow's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Ok That's kind of out of my league right now, but thanx anyway. Do you know any good books that I can buy on that subject? Or a good website? I use VB.NET, but I understand C++ as well. I have looked at the Tutors Corner, but with no luck. //theHollow
  2. Hi there (again) I was just wondering if i am right if I conclude with the fact that you can't use PositionNormalTextured and PositionNormalColored on the same device? I have created some figures with PositionNormalColored because I need to set colors on each side. But one of the sides needs to be textured with a jpg image. Any suggestions? //theHollow
  3. Ah, I found the answer to my problems. I had to add a third reference: Microsoft.DirectX.Direct3DX //theHollow
  4. Hi there I am currently looking for ways to save a DirectX/Direct3D surface to a file. I searched the web and found some examples that used SurfaceLoader.Save(). So far so good. But then I tried to use it in my program, but it says that SurfaceLoader don't exist in Microsoft.DirectX.Direct3D. The same with ImageFileFormat. I use VB.NET and DirectX 9c (dec 2004), and I begin wondering that these two classes I seek is either deleted or renamed. What do I do wrong? Can anyone help me? I have implemented both Microsoft.DirectX and Microsoft.DirectX.Direct3D in my program. //theHollow
  5. Ah! Thank you very, very, very much. I've been looking for this solution for quite a while now. Again...thank you!
  6. I just don't seem to understand what the h*ll I am doing wrong. I know that there is something I haven't quite understood, but I just can't seem to figure out what. I have created two rectangles, one blue and one red. Each rectangle are created by four triangles, where the two first are facing out, the other in. Just to avoid transparency when the object is rotated. That's at least what I thought. Here are two images. The first is what I like it to be. The second image is the source of my frustrations. The two images (screenshots) are taken while the two rectangles are rotating. I use VB.NET, and I have attached my code if something's missing. I am just so close to giving up. I have read various tutorials on this forum, but no luck. Please help... test3.zip
  7. Hi there! This may to many of you seem like a stupid question. But my objects seem to be transparent to the objects to the right. I must have misunderstood something here. I'm using VB.NET, and I'm using PositionNormalColored() to create the triangles. I use DirectX9c dec.04 and the DirectX object is named D3Ddev in this program. I use no lights (so far). I would very much appreciate if someone could tell me why the cubes to the right "shines through" the ones to the left. Do I create the triangles the wrong way? Like counter clockwise instead of clockwise? I really have no idea at all. I have programmed "normal" applications for quite a while, but I am very(!) new to DirectX programming. Here is some code (not complete...too much to post :-\ ): ' Some variables I use Private buffer(5) As VertexBuffer Private vertex(5) As Integer Private numObj As Integer '---------------------' ' CREATING THE CUBE ' '---------------------' ' This function returns the number of vertices that is used in this object Private Function CreateCube(ByRef aBuffer As VertexBuffer, ByVal posX As Single, ByVal posY As Single, ByVal posZ As Single, ByVal x As Single, ByVal y As Single, ByVal z As Single, ByVal col As Integer) As Integer Dim Vertices() As CustomVertex.PositionNormalColored Const antVertices = 36 aBuffer = New VertexBuffer(GetType(CustomVertex.PositionNormalColored), antVertices, D3Ddev, Usage.WriteOnly, CustomVertex.PositionNormalColored.Format, Pool.Default) Vertices = aBuffer.Lock(0, LockFlags.None) ' Front face Vertices(0) = New CustomVertex.PositionNormalColored(New Vector3(posX, posY + y, posZ), New Vector3(0.0F, 0.0F, -1.0F), col) Vertices(1) = New CustomVertex.PositionNormalColored(New Vector3(posX + x, posY + y, posZ), New Vector3(0.0F, 0.0F, -1.0F), col) Vertices(2) = New CustomVertex.PositionNormalColored(New Vector3(posX, posY, posZ), New Vector3(0.0F, 0.0F, -1.0F), col) Vertices(3) = Vertices(1) Vertices(4) = New CustomVertex.PositionNormalColored(New Vector3(posX + x, posY, posZ), New Vector3(0.0F, 0.0F, -1.0F), col) Vertices(5) = Vertices(2) ' Back face Vertices(6) = New CustomVertex.PositionNormalColored(New Vector3(posX + x, posY + y, posZ + z), New Vector3(0.0F, 0.0F, 1.0F), col) Vertices(7) = New CustomVertex.PositionNormalColored(New Vector3(posX, posY + y, posZ + z), New Vector3(0.0F, 0.0F, 1.0F), col) Vertices(8) = New CustomVertex.PositionNormalColored(New Vector3(posX + x, posY, posZ + z), New Vector3(0.0F, 0.0F, 1.0F), col) Vertices(9) = Vertices(7) Vertices(10) = New CustomVertex.PositionNormalColored(New Vector3(posX, posY, posZ + z), New Vector3(0.0F, 0.0F, 1.0F), col) Vertices(11) = Vertices(8) ' Left face Vertices(12) = New CustomVertex.PositionNormalColored(New Vector3(posX, posY + y, posZ + z), New Vector3(-1.0F, 0.0F, 0.0F), col) Vertices(13) = New CustomVertex.PositionNormalColored(New Vector3(posX, posY + y, posZ), New Vector3(-1.0F, 0.0F, 0.0F), col) Vertices(14) = New CustomVertex.PositionNormalColored(New Vector3(posX, posY, posZ + z), New Vector3(-1.0F, 0.0F, 0.0F), col) Vertices(15) = Vertices(13) Vertices(16) = New CustomVertex.PositionNormalColored(New Vector3(posX, posY, posZ), New Vector3(-1.0F, 0.0F, 0.0F), col) Vertices(17) = Vertices(14) ' Right face Vertices(18) = New CustomVertex.PositionNormalColored(New Vector3(posX + x, posY + y, posZ), New Vector3(1.0F, 0.0F, 0.0F), col) Vertices(19) = New CustomVertex.PositionNormalColored(New Vector3(posX + x, posY + y, posZ + z), New Vector3(1.0F, 0.0F, 0.0F), col) Vertices(20) = New CustomVertex.PositionNormalColored(New Vector3(posX + x, posY, posZ), New Vector3(1.0F, 0.0F, 0.0F), col) Vertices(21) = Vertices(19) Vertices(22) = New CustomVertex.PositionNormalColored(New Vector3(posX + x, posY, posZ + z), New Vector3(1.0F, 0.0F, 0.0F), col) Vertices(23) = Vertices(20) ' Bottom face Vertices(24) = New CustomVertex.PositionNormalColored(New Vector3(posX, posY, posZ), New Vector3(0.0F, -1.0F, 0.0F), col) Vertices(25) = New CustomVertex.PositionNormalColored(New Vector3(posX + x, posY, posZ), New Vector3(0.0F, -1.0F, 0.0F), col) Vertices(26) = New CustomVertex.PositionNormalColored(New Vector3(posX, posY, posZ + z), New Vector3(0.0F, -1.0F, 0.0F), col) Vertices(27) = Vertices(25) Vertices(28) = New CustomVertex.PositionNormalColored(New Vector3(posX + x, posY, posZ + z), New Vector3(0.0F, -1.0F, 0.0F), col) Vertices(29) = Vertices(26) ' Top face Vertices(30) = New CustomVertex.PositionNormalColored(New Vector3(posX, posY + y, posZ + z), New Vector3(0.0F, 1.0F, 0.0F), col) Vertices(31) = New CustomVertex.PositionNormalColored(New Vector3(posX + x, posY + y, posZ + z), New Vector3(0.0F, 1.0F, 0.0F), col) Vertices(32) = New CustomVertex.PositionNormalColored(New Vector3(posX, posY + y, posZ), New Vector3(0.0F, 1.0F, 0.0F), col) Vertices(33) = Vertices(31) Vertices(34) = New CustomVertex.PositionNormalColored(New Vector3(posX + x, posY + y, posZ), New Vector3(0.0F, 1.0F, 0.0F), col) Vertices(35) = Vertices(32) 'aBuffer.SetData(Vertices, 0, LockFlags.None) aBuffer.Unlock() CreateCube = antVertices End Function ' Drawing the objects (this goes on a loop) numObj = 3 vertex(0) = CreateCube(buffer(0), -0.5F, 0.0F, 0.0F, 0.5F, 0.5F, 0.5F, Color.Red.ToArgb) vertex(1) = CreateCube(buffer(1), 0.0F, 0.0F, 0.0F, 0.5F, 0.5F, 0.5F, Color.Yellow.ToArgb) vertex(2) = CreateCube(buffer(2), 0.5F, 0.0F, 0.0F, 0.5F, 0.5F, 0.5F, Color.Yellow.ToArgb) D3Ddev.Clear(ClearFlags.Target, Color.FromArgb(255, 255, 255), 0, 0) D3Ddev.BeginScene() D3Ddev.Transform.View = Matrix.LookAtLH(New Vector3(0.0F, 0.0F, -3.0F), New Vector3(0.0F, 0.0F, 0.0F), New Vector3(0.0F, 1.0F, 0.0F)) D3Ddev.Transform.Projection = Matrix.PerspectiveFovLH(Math.PI / 3.0F, 1.0F, 1.0F, 10.0F) ' Drawing the number of objects that is set in numObj For i = 0 To numObj - 1 D3Ddev.SetStreamSource(0, buffer(i), 0) D3Ddev.DrawPrimitives(PrimitiveType.TriangleList, 0, vertex(i) / 3) Next D3Ddev.EndScene() D3Ddev.Present() Any tips, hints would be appreciated! //theHollow
  8. Ah... I have found out that I have to use PositionNormalColored instead of PositionColored. If anyone can tell me why, and maybe the differences between PositionNormalColored and PositionColored? I don't quite understand all the parameters of PositionNormalColored. Still learning :rolleyes: - theHollow
  9. Lighting problems Hi there I have problems adding lights on my project. I have created a simple cube with different colors on the different sides. Very simple. And it works very well if I have set D3Ddev.RenderState.Lighting = False (my Direct3D device is called D3Ddev). So I tried to set the Renderstate.Lighting to true. As expected, my object became black. So I added this: D3Ddev.Lights(0).Type = LightType.Directional D3Ddev.Lights(0).Diffuse = Color.White D3Ddev.Lights(0).Direction = New Vector3(0.0F, 0.0F, 1.0F) D3Ddev.Lights(0).Update() ' Commit() D3Ddev.Lights(0).Enabled = True But it still don't work. I believe I have misunderstood something, and that I must apply the light to something or...I don't know. I have noticed that the D3Ddev.DeviceCaps.MaxActiveLights = 0. Can anyone help me? I have VB.NET and DirectX 9c (december 2004). Does anyone have a VB.NET project that I can look at? - theHollow Split from http://www.xtremedotnettalk.com/showthread.php?t=72399
×
×
  • Create New...