steviedisco

Members
  • Content count

    39
  • Joined

  • Last visited

Community Reputation

109 Neutral

About steviedisco

  • Rank
    Member
  1. I've ended up using Reflection. I still haven't got it working (I'm just trying to draw a triangle), but I'm confident my problem now lies elsewhere. I found the documentation lacking but I had a brainwave - I had a look through the OGRE source and they do pretty much the same thing so I pilfered a bit from there. It's a bit messy at the moment, but I'll tidy it up when I come to making a generic solution for it all.
  2. Thanks guys. I'm not ready to optimize yet, I really just want to get it working. I think I've figured out a way of doing it - just declare a pointer to a char[] of arbitrary size (say 1024), then pass the values in and increase the pointer by the relevant size (ie Matrix4x4 or Vector4). I *should* have the same memory layout as though I declared a hard-coded unique struct. The only caveat is I have to pass the arguments into the shader in the same order as they are declared in the shader itself. This might not work, I haven't got as far as testing it yet - I'm not so good at this memory manipulation stuff coming from C#. If it doesn't work, I'll have a look at the Reflection APIs. That looks like what I'm after. Thanks all
  3. Need help with unity3d

    I highly recommend Silo for creating polygonal models. It's not free but it is very cheap compared to some of the heavyweights and I found it a lot easier to understand than Blender.
  4. Hi, I'm working on a multi-API rendering framework. I started off with OpenGL, then added DirectX9 and am now in the process of converting that to DirectX 10. I will add DirectX 11 when that is done. Today, I've come across the constant buffer concept. In DirectX 9, when I wanted to pass uniform constants to my shader I would call ->SetFloatArray() or similar on the constant table. In the SDK samples (HLSLWithoutFX10), the equivalent method requires a constant buffer declaration as below: [code]struct VS_CONSTANT_BUFFER { D3DXMATRIX mWorldViewProj; //mWorldViewProj will probably be global to all shaders in a project. //It's a good idea not to move it around between shaders. D3DXVECTOR4 vSomeVectorThatMayBeNeededByASpecificShader; float fSomeFloatThatMayBeNeededByASpecificShader; float fTime; //fTime may also be global to all shaders in a project. float fSomeFloatThatMayBeNeededByASpecificShader2; float fSomeFloatThatMayBeNeededByASpecificShader3; };[/code] This can be accessed by calling ->map and then setting the values. What do I do if I don't know what the format of the constant buffer is going to be? I don't particularly want to hard-code in a declaration into the source, as all my shaders have different constants and I don't know what I'm going to be adding in the future. I'm not using the effects capabilities, but am compiling using D3DX10CompileFromMemory (I realise this is deprecated so intend to change this later). Is there no way to access the constant buffer properties by name without using the effects functions? I currently store all my shaders in separate .vp (vertex) and .fp (fragment) files. I was hoping that I wouldn't need to change anything in these between DX9 and 10. I'm in the really early stages of all this and am nowhere near thinking about optimizing by reducing the number of draw calls, constant changes etc. It really is just a simple framework at the moment, not an engine as such. Having read all that, you'll probably tell me not to bother with DX10 anymore but for the sake of argument, I'm really just using it as a learning exercise. Many thanks in advance all you genius gurus [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  5. I got closer, but I think by the looks of what I have read I am trying to achieve the impossible, as far fetched as that might seem. It appears that it *should* be possible like follows: [code] float3 LightPositions[MAXLIGHTS] : POSITION < string SasBindAddress = "Sas.Light[*].Position"; >; float3 LightDirections[MAXLIGHTS] : DIRECTION < string SasBindAddress = "Sas.Light[*].Direction"; >; float4 LightColors[MAXLIGHTS] : COLOR < string SasBindAddress = "Sas.Light[*].Color"; >; [/code] but either FX Composer doesn't support that method of SAS Binding or it used to and now doesn't. I can't seem to find any concrete information on this, just bits and pieces on forums which seem years old. I can't be the only one wanting to do this can I? I can work around it I think, just set a limit on the number of lights (say, 3) and hard-code the bindings in, but it would have been nice to have this all wrapped up in a neat little package. To be honest, I'm not working toward a particular goal (ie, plugging into an engine), I'm just playing and expanding on what I've learnt so I can build up a good knowledge of shaders and in particular how FX Composer works. I could always take it right out of FX Composer and run it through a C++ app, in which case I could easily get it to work, but it would have been nice to get it all tied up in one environment. oh well
  6. Hi, I'm currently learning shaders and have gone through all the basics (diffuse, specular lighting etc). The examples that I have read have referred to a one-light system. Within FX Composer, you can tie lights to variables via the use of annotations and semantics. I've extended my base shader to two lights, but that is hard-coded. For instance: [code] float4 LightDirection1 : DIRECTION < string Object = "Light0"; string UIName = "Light Direction 1"; string Space = "World"; > = {-0.5f, 2.0f, 1.25f, 1.0}; float4 LightDirection2 : DIRECTION < string Object = "Light1"; string UIName = "Light Direction 2"; string Space = "World"; > = {0.5f, 1.0f, 0.5f, 1.0};[/code] I'm trying to set up a more general case for an abitrary number of lights, say 3. I'd rather have an array of light structs like so: [code] struct Light { float4 Position : POSITION; float4 Direction : DIRECTION; float4 Color : COLOR; }; Light Lights[3]; [/code] Any idea how to tie FX Composer's light objects to this via annotations? I can't seem to get it to work, I've made all sorts of attempts, but nothing will compile. Do I need to do this via scripting or am I missing something simple? I think I know how to do this if I was connecting into my DirectX app, but I'm trying to keep it all within FX Composer while I develop. Help a brother! Many thanks.
  7. check out DirectXTutorial.com. That'll get you up to speed on the basics of DirectX, and then it's up to you if you want to pay for the premium service to learn the rest or go tutorial hunting. It's good if you want everything in one place.
  8. 3d modeling software for Beginners

    I'm not using it currently myself, but for a pure, focused, *cheap* polygon modeller, Silo is hard to beat. I don't know how that would export to XNA, but presumably you could write your own converter
  9. OpenGL tutorials

    If you do go down the nehe route, be sure to check out the latest framework code to work from, which is somewhere linked on the left-hand side.
  10. Best Guidelines to make a 3D game in OpenGl?

    That said, a week seems more than a little tight considering the amount you want to implement. Is it for a course or a competition?
  11. Best Guidelines to make a 3D game in OpenGl?

    I would recommend DevIL for loading images into OpenGL. I implemented it a few weeks ago, it only took half hour tops. I can post my source code if you like.
  12. Is transitioning from C# to C++ really THAT simple?

    It's certainly easier than moving from Visual Basic to C++, at least the syntax is generally the same.
  13. Super Beginner

    A programmer should be able to program into any language. Once you've learned the concepts with one, you should be able to move across to another language taking what you know with you. it's only really the syntax which is different, unless you move into a different paradigm like functional languages. Roll up your sleeves, learn one and concentrate on that without thinking what it's like on the other side of the fence. It'll take you a while to become proficient in your first language. More haste, less speed and all that. Personally, I would recommend C#. I use both C++ and C#, and C# is definitely easier to learn, with less that can go wrong. You pretty much don't have to worry about memory management, corrupt heaps and things like that - garbage collection is taken care of for you. With C++, a lot less is given to you and you have to take detours all the time to do some of the simple things you can do with C#. For instance, to read a xml file in C#, you just reference the System.xml assembly and use the ready-made objects in that namespace. Job done. In C++, you have to either roll your own or download someone elses' solution, for instance TinyXML and TinyXPath, get those compiled, installed and working without errors for your different configurations and even then they're just not as nice to use. The .NET Framework is a thing of beauty. To be honest, the only major advantage C++ has over C# is speed. On your first few projects, you're much better off learning programming and game development concepts with as few obstacles as possible and C# with XNA gives you just that. You'll only get yourself in a big frustrated mess if you try to do it in C++ first time. The trade off in execution time is well worth it IMO. I've been programming professionally for 12 years, and am working on my first 3D game/render engine in C++, and even for me it is a challenge. XNA doesn't give you everything, so there's still room to learn a lot with it.
  14. OpenGL OpenGL + ALT-TAB

    Ah, you're a genius! That works perfectly. I doff my cap to you sir.
  15. OpenGL OpenGL + ALT-TAB

    I'm using Windows 7 64-bit. Sorry for not explaining correctly, but the behaviour I would expect is for the display to return to the user's desktop, with the application paused and minimised in the taskbar, ready to be returned to by clicking the application's taskbar icon. I got this working in DirectX - it wasn't straightforward, as I had to deal with a lost device and recreate my assets upon re-entry. But I found some decent source code and went from there. I hadn't thought about Alt-Enter. I'll look into how it operates with Aero disabled. Thanks