
rifter1818
Avatar/Signature-
Posts
257 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by rifter1818
-
Where would i declare POSITION0,Position1? the vertex declaration or in the Effect file? The first option is nice but not possible as i want to use this for mesh's where i cant controll the vertex format. I know this is covered in the dolphinVS example but the vertexShader there is allready compiled (i think) and i cant understand it at all.
-
Stopped paying attention changed nothing then they worked... Odd but not the point. My Question is this How do i pass 2 positions and 2 normals to my Vertex Shader in an effect,im trying to Create a tweening EFFECT.(just to start) lets say i have my vertex data in streams 0 and 1, and for this example they are PositionNormalColor, and i want to pass 2 of each Variable (position,normal and color) (one from each stream) to my effect. How do i do it? VertexDecleration = New vertexDeclaration(device,new vertexelements(){new vertexelement(0,0,Float3,Position,0),new vertexelement(1,0,float3,Position,0),........? then in my effect void VS(in float3 Pos1 : POSITION, in float3 Pos2 : POSITION,........ or am i way off track here?
-
With Vertex Declaration If i want the Position and texture Coordinants only, Dim PT() As VertexElement = {New VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0), _ New VertexElement(0, 12, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0), VertexElement.VertexDeclarationEnd} PositionTexture.VDec = New VertexDeclaration(D3d.Device, PT) If I want to Pass a Vertex Buffer thats got Position NOrmal And Texture Elements to the vertex Shader do i need to create a new Declaration? if i pass a position only Vertex buffer?
-
Is there Any Font and or setting that has every character (and spaces) the same width such that: WWWWW IIIII I I Are all the same width? Sorry for the Double Thread but i didnt know which this fit better in (General or Directx (note im using directx's Fonts and such to draw this text))
-
*Bangs Head* I cant believe this, but im just being an idiot (Again) im really sorry RobyDx for all the time youve been thinking about this (and i know you have noting the number of posts and checking your profile showing when your viewing this form, Anyways what happened was that i was using the wrong VertexFormat as i was programming at home and at school and forgot to update the creation code at home (where thanks to your website RobyDx i coded my VertexShader). Anyways VertexShader isnt showing up but its not erroring so its just that the Vertex Shader isnt quite right but i will fix that eventually.. Thanks for your help and Thumbs up on the website. Oh ya, I need to know a bit more about what info the normals should contain, right now ive got them all as +/- 0.7071, but im not sure thats right, lets say i have a triangle (0,1,0) (-1,0,0) (0,0,-1) what should the normals for each verticy be? i have (-0.7071,0.7071,-0.7071) for all 3.
-
Vertex Format As i said im using CustomVertex.PositionNormal as the format.
-
... I dont know if the vertex declaration is right or not (note the first code sample of my previous post), All of the Format,Shader and Declaration are set to the Device, And the vertex Buffer is being rendered the same as allways (worked before the Shader), as i said. Just the shader Code and VertexDeclrations that im questioning.
-
Can you Use CustomVertex Structures? My code is giving me an error when rendering the primitives. (worked before i added the vertex shader): Important Things, VertexBuffer im rendering 4 Primitives Triangle list, CustomVertex.PositionNormal, VertexDeclaration : dim PN() As VertexElement = {New VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0), _ New VertexElement(0, 12, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Normal, 0), VertexElement.VertexDeclarationEnd} PositionNormal.VDec = New VertexDeclaration(D3d.Device, PN) the Vertex Shader is loaded GS = ShaderLoader.CompileShaderFromFile(Application.StartupPath & "\...\VS-GlowPN.VSH", "VSGlowPN", Nothing, Nothing, "vs_1_1", ShaderFlags.None, Errors, Nothing) Diagnostics.Debug.WriteLine(Errors) PositionNormal.AddVertexShader("Glow", New VertexShader(D3d.Device, GS)) And the Vertex Shader Its self float GlowPower:register(c0); float4x3 WorldView:register(c1); float4x4 Projection:register(c49); float4 GlowAmbient:register(c113); float4 GlowColor:register(c117); struct OUTPUT { float4 Position : POSITION; float4 Diffuse : COLOR0; }; OUTPUT VSGlowPN ( float4 Position : POSITION, float4 Normal : NORMAL ) { OUTPUT Out; float3 N = normalize(mul(Normal, (float3x3)WorldView)); float3 P = mul(Position, WorldView) + GlowPower * N; float3 A = float3(0, 0, 1); float Power; Power = dot(N, A); Power *= Power; Power -= 1; Power *= Power; Out.Position = mul(float4(P, 1), Projection); Out.Diffuse = GlowColor * Power + GlowAmbient; return Out; } Any ideas whats wrong here? The Error message is RenderVertexBuffer: Error in the application. -2146232832 (Unknown) at Microsoft.DirectX.Direct3D.Device.DrawPrimitives(PrimitiveType primitiveType, Int32 startVertex, Int32 primitiveCount) at W_Logic_RPG.DX9.Direct3d.RenderVertexBuffer(VertexBuffer& VertexBuffer, PrimitiveType PrimitiveType, Int32 StartVertex, Int16 PrimCount, Matrix Transform) in C:\Documents and Settings\Harry\Desktop\Programming\W-Logic RPG\clsDX901.vb:line 498 [/Code]
-
Dim DevType As DeviceType Dim CFlags As CreateFlags Dim Caps As Caps = D3d.GetCaps() Dim PP As New Microsoft.DirectX.Direct3D.PresentParameters DevType = DeviceType.Hardware CFlags = CreateFlags.SoftwareVertexProcessing If Caps.DeviceCaps.SupportsHardwareTransformAndLight Then CFlags = CreateFlags.HardwareVertexProcessing End If If Caps.DeviceCaps.SupportsPureDevice Then CFlags = CFlags Or CreateFlags.PureDevice Debug.WriteLine("PureDevice") End If PP.BackBufferCount = 1 FileOpen(1, Application.StartupPath & "\config.cfg", OpenMode.Input) Input(1, PP.BackBufferWidth) '1024 Input(1, PP.BackBufferHeight) '768 Input(1, PP.BackBufferFormat)'A8R8G8B8 FileClose(1) PP.Windowed = False PP.SwapEffect = Microsoft.DirectX.Direct3D.SwapEffect.Discard PP.AutoDepthStencilFormat = DepthFormat.D16 PP.EnableAutoDepthStencil = True PP.PresentFlag = PresentFlag.None MainForm.Show() If Not D3d.Initialize(DevType, MainForm, CFlags, PP) Then End End If
-
Ok i finnally got my program to accept the fact that purehardware or hardwarevertexprocessing is a valid and desirable flag but somthing is terribly wrong. As soon as i change from SoftwareVertexProcessing to (HardWareVertexProcessing or PureDevice) two things happen, 1 DROP IN FRAMEFRATE 60 fps -> 20, all my meshes disapear (again). Any ideas of why this is / how to fix it? (video card is a nVida GeForce 4 128mb)
-
Ohh What i want to do is apply the transparancy to an allready loaded texture. (like for instance a texture i created by rendering to its surface....)
-
Thanks for your help hopefully one day ill be able to solve a problem for you, but that day seems quite distant right now...
-
What is the best way to get a more accurate tick count than enviornment.tickcount? is the directxTimer the best way to go?
-
Sorry Could you include a qiuck code snipit please, and thanks once again for all your help.
-
Thanks Do you know of any service that can translate a whole site for me (i have enough trouble with english let allone italian). Thanks very much though, i think i can figure it out, the book i have is loading them as effects which is what was giving me so much trouble your way might be better for me. Although my Graphics card only supportsr VS_1_1 and PS_1_3... but oh well...
-
Hi just wonder about making copies of things, what i want to know is how to control what makes a copy of and what makes a refrence to, A prime example of this is using ByRef and ByVal in functions, however i want to do this with objects not being passed into the functions, such as lets say i have my character class and Player1 is a character,..... how would i set Player2 = to player1 such that player2 is independant (not a refrence to) of player1, and how would i set it such that it is?
-
Hi there does anyone know some good tutorials on HLSL ive had trouble with it, also some tutorials on implementing it as that too isnt working for me. Thanks for all your help.
-
Not sure its my programming Everytime i change anything the fonts either stop working or work a bit better, such as before each draw text command i added if mFont is nothing then mFont = new cFont(d3d.device,new D.Font("Arial",12) debug.writeline("Font was nothing") end if This caused 1 of the 2 fonts to work again, however nothing showed up in the debug output, so i removed the line "debug.writline "font was nothing" and the fonts stopped working?!!!!
-
How can i make a certain color (for instance Black) transparant in an allready loaded Texture (or surface). So far the only means by which i can think of is SufaceLoader.FromSurface(Surf,Surf,SomeFilter,color.black.toargb) this works however the framerate drops from 60 to 3 which a bit too much, ive tried filter.point,.linear,.none all end up with the same wonderfull 3 fps so i dont think its the filter.... Does anyone know of an actually usefull way to do this? Actually Thinking about it its probably because the surface is so large, so i guess next question asside from is there a more efficiant way to apply a transparancy, is what is the best way to scale a texture or surface down?
-
Ok this has got to be an even dumber mistake by me than the last one http://www.xtremedotnettalk.com/showthread.php?t=84160 but it none the less has baffled me. When i turn on my DepthStencil PP.AutoDepthStencilFormat = DepthFormat.D16 PP.EnableAutoDepthStencil = True My mesh disapears...what am i forgeting?
-
I know this has got to be something stupid im doing that im doing, but i dont know what. Im trying to add in Effects (Pixel/Vertex Shaders) and allong the way ive decided to use createflags.PureDevice or createflags.HardwareVertexProcessing.. I know my device supports them as i have a sample program (Came with the book Kick Start -> Managed Directx 9 Graphics and Game Programming) that uses these flags. But as soon as i change my CFlags over to them, my cFont.DrawText Throws the following exception "NullReferenceException: Object reference not set to an instance of an object. at Microsoft.DirectX.Direct3D.Font.DrawText(Sprite sprite, String text, Rectangle rect, DrawTextFormat format, Int32 color)" This isnt Much fun and it works just fine in SoftwareVertexProcessing.... oh heres my Font Class in case that helps any.. (omiting the unused parts...) imports d = system.drawing Public Class cFont Inherits Microsoft.DirectX.Direct3D.Font Public Color As D.Color Private pFontDesc As FontDescription Public Sub New(ByRef Device As Device, ByVal Font As D.Font) MyBase.New(Device, Font) End Sub Public Overloads Sub DrawText(ByVal Text As String, ByVal Rect As D.Rectangle, ByVal Format As DrawTextFormat, ByVal FColor As D.Color) MyBase.DrawText(Nothing, Text, Rect, Format, FColor) End Sub End Class
-
Thank you Menge Im am just out of it this week (probably may have something to do with the leaky oil tank across the street... Oh well, Thank you for your help. the Update Surface method should work i think.
-
This was solved? Yes im Sorry that my question was a little less than concise. However i still dont see the answer to it here. I still need to make a texture out of a surface. And i dont see the answer here it may be with that locking a surface as a render target but then What i need to know is how do i render the surface onto it.
-
Sorry The Function i ment was getFrontBufferData (Too tired i think) (*notes 1Am, ya time to think about bed....) For Clarity What i want to do simply is Create a Texture From the screen. This being the Third thread on this subject and still no workable solution for me.... OK The Second thread (Started by thePentiumGuy i believe) got me to Device.GetFrontBufferData(0,Surface) Now all i want is to Make a texture out of that surface.... So that i can render a VertexBuffer using that texture,... Im sorry that my questions are hard to understand what im getting at (and usually simple to solve), And thank you all for your patience.