
akuehn3000
Members-
Posts
18 -
Joined
-
Last visited
akuehn3000's Achievements
Newbie (1/14)
0
Reputation
-
Unfortunately, loading mp3 files is not possible with the secondarybuffer class. Therefore you have to use the AudioVideoPlayback classes whicht don´t provide a way to deal with streams: Microsoft.DirectX.AudioVideoPlayback.Audio audio = new Audio("song.mp3",true); You will have to look for third party solutions for this problem.
-
Especially when using Mesh.TextFromFont you have to take care of disposing your Meshes. Another problem might also be that you are instancing a new font each time you use TextFromFont. If you do so, you also have to dispose that font. Of course without actually seeing the code I can just guess what might be the problem. Just check your loops again and see if you are really taking care and dispose ALL of resources you keep creating.
-
I think you should center the meshes' pivot in blender to get a correct result with boundingbox or bounding sphere.
-
how can I read a vertexbuffer from a mesh? the following lines lead to invalidcallexception: //meshVertex is the struct for my vertexformat meshVertex[] buffer = new meshVertex[meshc.NumberVertices]; buffer = (meshVertex[])(meshc.VertexBuffer.Lock(0,typeof(meshVertex),LockFlags.None,meshc.NumberVertices)); does anyone know an example how to read vertexdata from a mesh properly?
-
setting up a vertexbuffer with multiple texture coordinates
akuehn3000 replied to akuehn3000's topic in DirectX
thank you. that was the problem. and i have to use texturecoordinate2 instead of texturecoordinate0 | texturecoordinate1 as format. -
Hello everyone, what´s the best way to set up a vertexbuffer that should support multiple texture coordinates? I tried the following: public struct MyVertex { public float X,Y,Z; public float Nx,Ny,Nz; public float Tu,Tv; public float Tu1,Tv1; } VertexElement[] decl = new VertexElement[] { new VertexElement( 0,0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0 ), new VertexElement( 0,12, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Normal, 0 ), new VertexElement( 0,24, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0 ), new VertexElement( 0,32, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0 ), VertexElement.VertexDeclarationEnd }; VertexDeclaration ourDeclaration = new VertexDeclaration(device, decl); device.VertexFormat = VertexFormats.Position | VertexFormats.Normal | VertexFormats.Texture0 | VertexFormats.Texture1; VertexFormats bufferFormat = device.VertexFormat; device.VertexDeclaration = ourDeclaration; But I get an error when trying instantiate the VertexDeclaration. Any ideas what´s wrong or how it could be done better?
-
I finally found what the problem was. I forgot to set the texcoordindex for the second texture stage. With the following code the lightmapping works fine (the lightmap is the cone lightmap from the mfctex example). device.Clear(ClearFlags.Target | ClearFlags.ZBuffer,Color.Black,1.0f,0); device.BeginScene(); device.SetTexture(0,brickTexture); device.TextureState[0].ColorOperation = TextureOperation.SelectArg1; device.TextureState[0].ColorArgument1 = TextureArgument.TextureColor; device.SetTexture(1,spotlightTexture); device.TextureState[1].TextureCoordinateIndex = 0; device.TextureState[1].ColorOperation = TextureOperation.Modulate; device.TextureState[1].ColorArgument1 = TextureArgument.TextureColor; device.TextureState[1].ColorArgument2 = TextureArgument.Current; device.TextureState[2].ColorOperation = TextureOperation.Disable; meshc.DrawSubset(0); device.EndScene(); device.Present();
-
I´m trying to use texture blending with the textures from the mfctex sample. With the following code the first texture gets just darkened instead of being illuminated like the lightmap. Does anyone has any idea what´s wrong? device.SetTexture(0,brickTexture); device.TextureState[0].ColorOperation = TextureOperation.SelectArg1; device.TextureState[0].ColorArgument1 = TextureArgument.TextureColor; device.TextureState[0].AlphaOperation = TextureOperation.SelectArg1; device.TextureState[0].AlphaArgument1 = TextureArgument.TextureColor; device.TextureState[0].ResultArgument = TextureArgument.Current; device.SetTexture(1,spotlightTexture); device.TextureState[1].ColorOperation = TextureOperation.Modulate; device.TextureState[1].ColorArgument1 = TextureArgument.TextureColor; device.TextureState[1].ColorArgument2 = TextureArgument.Current; device.TextureState[1].AlphaOperation = TextureOperation.Disable; device.TextureState[1].ResultArgument = TextureArgument.Current; meshc.DrawSubset(0);
-
how can i create new meshes from the meshes subsets? is that possible in an easy way?
-
it´s not an multithreaded environment. just now I use a thread in the onpaint method of my directx form to repaint it. that´s the only way I managed to let the directx panel redraw without disturbing the rest of the form. as for the input I used the main form of the application to set the cooperative level. but still it gives me this nasty error.
-
.X exporter for Maya 5.0 or 3D Max 6.0
akuehn3000 replied to seraphangel's topic in Graphics and Multimedia
for development you should use x files in text format. those are usually kinda big so just try how much polygon data you can display in your application before the framereate drops. i searched quite some time to find a good exporter. for maya the exporter that comes with directx sdk might work well, I didn't try that. The 3ds max exporter of the sdk doesn't work well though. actually it's really crappy. the panda exporter worked fine for me. it's even capable of exporting skeletal animation with your x-file. http://www.pandasoft.demon.co.uk/directxmax4.htm -
I´m not sure if I can reproduce the problem with few code. I´ve solved the problem by putting the redraw method in a single thread. Now my remaining problem is a problem with the focus of the input. When using DIrectInput in the DirectX-Panel, do you know how to make it possible that the rest of the form still receives mouse and key events? By setting a cooperative level on directinput I receive an index out of expected range error.
-
http://www.chilp.de/starblaster/screen1.jpg As you might see on the pic, when changing selecting another tabpage, its content is not fully drawn because the same time, i suppose, the black area (directx panel) gets redrawn. currently the directx panel is drawn with onpaint and invalidate. i also tried to let it draw by a timer but the problem remained. all other components except the directx panel are not drawn correctly and lose focus often.
-
i´m using a directx device in a panel which is embedded in a windows form next to some standard windows forms components (textbox, button, etc.). while i refresh the view of the directx panel (tried with onpaint with invalidate and with a timer), the standard windows forms components are not drawn correctly or lose focus. what can I do to prevent this and still having the directx panel refreshed often enough to play i.e. a fluent animation?
-
Hi all, to learn the basics of managed directx I started working on classic space shooter using managed directx/c#. If anyone wants to take a look just follow this link: http://paralax.cmgep.com It´s already a two level game, maybe you can tell me if it´s possible to have some fun with it or what should be changed.