Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About P3D-BrandonR

  • Rank
  1. P3D-BrandonR

    Memory Management Part II

    Great series ! Looking forward to the future postings in this series. Memory management is always something I'm looking to strive better at in my works. -Brandon R.
  2. P3D-BrandonR

    Font HLSL Blending problem

    Thanks so much Adam_42, I implemented that 2nd option of yours in my shader file and bingo, works great!
  3. Hello all, I never really post b\c I'm usually really good at finding my answers in past posts, but this one problem I've been dealing with for some time now and can't seem to get over the hurdle. What I have is a 8-bit grayscale PNG file that has a black background, with pure white font layout just as various tutorials around here show. I have the proper code in place that correctly sets the index buffer to only show the letters as I tell the function to print out. The Problem: I just made a generic FX file to try and get the font to hid the black areas, only show the white areas, but use the vertex diffuse color passed in to color the white to that color. I hope that I'm thinking along the right path, but if I'm not please stop me now and let me know. In the FX file I have tried multiple methods from previous posts and the closest I can get is the black area invisible, but the white area is replaced with a faint pink color instead of say pure red that I store in the vertex diffuse values. Otherwise, I can properly paint the red in place of the white, but then the black areas show up again. >< I'm determined to understand these blend settings one way or another. Below is the FX coding that will print out the font with black areas, but replace the white with pure red. // A simple attempt at taking a grayscale PNG and set the black areas to transparent, // and replace the White areas as the passed in vertex diffuse color. //------------------------------------ struct vertexToPixel { float4 HPosition : POSITION; float4 Color : COLOR0; float2 UV : TEXCOORD0; }; struct pixelToFrame { float4 Color : COLOR0; }; Texture xColoredTexture; sampler ColoredTextureSampler = sampler_state { texture = <xColoredTexture>; magfilter = LINEAR; minfilter = LINEAR; mipfilter = LINEAR; AddressU = mirror; AddressV = mirror; }; //------------------------------------ vertexToPixel myVertexShader( float4 inPos : POSITION, float4 inColor : COLOR0, float2 inUV : TEXCOORD0 ) { vertexToPixel OUT = (vertexToPixel)0; OUT.HPosition = inPos; OUT.Color = inColor; OUT.UV = inUV; return OUT; } pixelToFrame myPixelShader( vertexToPixel psIn ) { pixelToFrame OUT = (pixelToFrame)0; float4 tmpColor = tex2D(ColoredTextureSampler, psIn.UV); // According to a post in Gamedev.net // Statically set the Black color here to be blended since we know // pure black is the color we use to be transparent. // OUT.Color = float4( 0.0, 0.0, 0.0, 1.0 ) * ( tmpColor ); return OUT; } pixelToFrame myPixelShader2( vertexToPixel psIn ) { pixelToFrame OUT = (pixelToFrame)0; float4 tmpColor = tex2D(ColoredTextureSampler, psIn.UV); // Pass #2 // Attempt to blend now against the passed in vertex diffuse. OUT.Color = psIn.Color * tmpColor; return OUT; } technique low { pass P0 { AlphaBlendEnable = true; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; AlphaTestEnable = true; AlphaRef = 8; ColorOp[0] = modulate; ColorArg1[0] = Texture; ColorArg2[0] = Diffuse; AlphaOp[0] = modulate; AlphaArg1[0] = texture; AlphaArg2[0] = diffuse; Lighting = false; VertexShader = compile vs_2_0 myVertexShader(); PixelShader = compile ps_2_0 myPixelShader2(); } } Just a simple 1 pass FX file. Like I said I'm not sure if I'm even using the right method of blends and such here. I'd like to thank everyone ahead of time for the help given. I really enjoy the forums and read them all the time! Sorry, I left out the pixelfunction that I was calling in the FX file, the other function with the static black is not being called right now. -Brandon
  4. P3D-BrandonR

    [.net] .Net and XNA - Future ?

    Great info, I geuss I need to sit down with my team and rethink some of the MDX direction we was heading in. Maybe read some more up on it and XNA and make a better decision. Hopefully they will keep a flavor of MDX for those of us that want to use it. Unless the XNA Pro version offers the same. Geuss we will have to wait and see.
  5. Hello everyone, I was browsing the Microsoft Dev site today and seen they released the XNA Beta 1 for download. Was reading the faq and towards the bottom seen this ... Q: Will there be any more improvements to Managed DirectX 2.0? A: The current Managed DirectX 2.0 beta libraries have been unchanged since the April 2006 SDK release. There will be no further changes to MDX 2.0 beta, nor will MDX 2.0 ever release officially. The MDX 2.0 assemblies will be removed from the DirectX SDK once the XNA Framework beta is released. Q: Does the XNA Framework replace Managed DirectX? A: The XNA Framework will have a managed API for working with hardware on the Xbox 360 and Windows. This API will subsume functionality in MDX 2.0 beta today. So it seems MDX 2.0 will be no more. But I wonder what the plan for MDX 1.1 will be ? Is XNA the replacement for MDX period now ? =/ Maybe I'm reading to much into this, I dunno. Maybe someone else has some insight into this. The FAQ link is here: http://msdn.microsoft.com/directx/xna/faq/
  6. P3D-BrandonR

    Sphere Texturing ...

    Thx so much for the comments. And sorry about posting in wrong forum. I guess I do need to try the cube a little more. I guess I was set on the sphere idea from one of the DX9 books I had where there was a implementation of each. I'm not that experienced in the skyboxes, this is my first as you can see. Oh and smitty. I was able to stop the pinching at the poles by simply using the Filter->Distort->Polar Coordinates [Polar to Square] ... then flip, rinse, and repeat. Granted its not the best method but it did stop the ugly pinching effect at the poles. But thank you so much everyone for your responses. Much appreciated. I have some cube map patterns I will try tommorrow and see what I can come up with. Oh and cpiasminc, I'll give that a look see too. That sounds very interesting. I'm all about learning. Thanks, -Brandon
  7. P3D-BrandonR

    Sphere Texturing ...

    Hello everyone, I try not to post unless it's a last resort to not finding any info online or on these past forum posts. I'm stumped at the moment with the situation of Texturing a Sphere and getting it to look right. Here is what I'm trying to accomplish: Using Sphere mesh as a skybox. I have one created, and all the faces flipped so that they face inside, since thats where our view will be. Here is my problem: I have tried tiling a image inside this sphere now with varrying deminsions 512x256, 1024x512 etc. What ever texture I make in photoshop, it looks nice and crisp. Once applied to the sphere it's stretched to fit. I solved the pinching at the poles problem btw. It's just the over all image is strechted so much that my image looks blown up or zoomed in once in the program. I have tried inside of 3dmax to just tile the image say 5-10 times and it makes it look just like I want it. Yet of course once in the program I have the pinching at the poles again, but the rest looks good. Heh, at a lost here of how to get it to look exactly how I want. In closing: I know I could use a Cube map for a skybox, but the app I'm making is a 360 type view with no flooring, much like outter-space. So to get the effect I'm currently wanting a Sphere or Geo-Sphere is what I'm working with currently. Thx in advance, -Brandon
  8. P3D-BrandonR

    Dynamic object and Dynamic DLL ...

    Quote:Original post by Washu I wrote a great deal about DLLs a bit back in my journal. It should answer the majority of your questions... Thank you so much Washu ! Your articles did the trick ... again thanks for the pointers.
  9. Hello all, I have a question dealing with this situation I'm trying to pull off. What I'm wanting to do is have a class interface that sits between my exe, and dll. I call the DLL from the EXE dynamically and the DLL creates a new instance of the class and passes it back. The EXE side uses this new class variable throughout the EXE, just simply referencing it's calls which is really happening on the DLL side of things once called. At the apps end, the EXE can simply delete the variable it has referenced as the class from memory. I have some code here at the bottom just simply showing the basic idea of what I'm doing, it seems to create and reference the variable somewhat correctly on the EXE side, although it seems the functions on the DLL side are not getting called at all. Also, upon deleting the variable I have on my EXE side, created from the DLL, it of course breaks with an error (HEAP memory error). You can sorta see below how my layout is working. I have a class on the EXE side that is basically manager for the DLL, this is where its calling the CreateInterface call to the DLL side and passing back the reference to the object that called it. The other class is has created a reference to this DLL manager class, and also has a MyInterface variable that is keeps and calls the DLL Manager class to do its thing to the DLL and pass back the reference to the new object. Any help or suggestions I would greatly appreciate. I have other implementations, though not as neat and clean as this one, that do work and I can use. I just wanted to make a neater layout than the previous ones I had been using and exploring. I know I can simply make the DLL Static and just do as I please, but the whole concept here is to keep the DLL dynamic and allow for a simple Interface Class to be the connector between the two. Here is the current code I have as a Test: /////////////////////////// // Interface Class // Shared between EXE and DLL /////////////////////////// class MyInterface { public: //Base Creation and destroy functions virtual HRESULT Initialize()=0; virtual HRESULT Destroy()=0; }; /////////////////////////// // My Class // DLL Side Implementation // of Interface Class /////////////////////////// #include "myinterface.h" class MyClass : public MyInterface { public: MyClass(){}; ~MyClass(){}; HRESULT Initialize() { return S_OK;}; HRESULT Destroy() { return S_OK;}; }; /////////////////////////// // DLL main CPP ////////////////////////// #include "myclass.h" #define DLLEXPORT extern "C" _declspec(dllexport) DLLEXPORT void* CreateMyClass() { return static_cast< void* > (new MyClass()); } /////////////////////////// // EXE main CPP ////////////////////////// #include "myinterface.h" MyInterface* SomeClass::DoCreate() { //Attempt create MyInterface across to DLL. typedef void* (*LPFNDLLCALL)(); LPFNDLLCALL lpfnDllCall; lpfnDllCall = (LPFNDLLCALL)GetProcAddress(_hModDLL, "CreateMyClass"); if (!lpfnDllCall) { return NULL; } return (MyInterface*)lpfnDllCall(); } void SomeOtherClass::SomeOtherFunction() { SomeClass* _someClass = new SomeClass(); MyInterface* _myInterface = _someClass->DoCreate(); //code continues ... delete _myInterface; }
  10. I know this is a pretty bland topic but I'm a little confused and need some direction. I have in place a nicely done Resource Manager if you will, keeps track of how many references an object (such as a texture) has and knows when it should be deleted or freed. The question I have is, I've read and seen in engines where they have a memory manager in place as well. That deals with actually holding bits of pre-determined memory allocated in say certain size blocks and things like that. I geuss what I'm asking is having something like that kind of memory manager really required ? If so is there some links or references to some better studies on this topic ? I have 4 books that contain it but I'm trying to get more feedback and ways of doing it so to speak so I can learn every angle of it. Sorry to be so n00bish in this question, it's the one basic system I have left to really get a grasp on. -Brandon
  11. P3D-BrandonR

    DX Font Character Spacing ...

    Thx so much Haggag ! That did the trick. Brandon
  12. Hello all, I can't seem to find a definative answer to this topic. Break-down on what I'm doing is I'm using ID3DXFont with DX 9 and attempting to make my own GUI Textbox control. I know I could simply just use the DX common gui control one, but what fun is that ? I like learning how things work so thought I would write all my stuff from scratch. I've got it coming along nicely now, just lacking the part where I need to get the character spacing between each character ID3DXFont draws on screen, so I know the correct spot to stick the Carrot when the control has focus. I have managed to locate some nice examples and howtos, but can't seem to make them work correctly. For example: http://www.geocities.com/foetsch/bmpfonts/bmpfonts.htm That has seemed to help the most. Only problem is it doesn't seem to get the correct font size or (sizes) for that matter that the ID3DXFont is using after creation. So I tried this little trick. ID3DXFont g_pFont; //After creation and all then this... hDC = g_pFont->GetDC(); g_pFont->GetTextMetricsA(&tm); if (!GetCharABCWidths(hDC, 32, 255, abc)) { ... //Code Continues on } The TextMetrics returned straight from the ID3DXFont object seems to be a little closer than previous attempts, yet still way off. I can't seem to figure out the proper way of dealing with this situation. Am I really going about this the right way ? Anyways, thanks all in advance ! Brandon
  13. P3D-BrandonR

    CVS question ...

    Thanks so much guys for the suggestion. I have 2 dedicated linux boxes atm. I would like to get a windows box setup, but dont have one atm. I've used Perforce in the past for work as well. Love Perforce, just too expensive for me, but if they have free 2 accounts I may look at that then. Thx so much for the responses guys, again. Brandon
  14. P3D-BrandonR

    CVS question ...

    Sorry, Didn't know where this question was appropriate. But I have my engine source and files going good now and want to try to get it on a CVS install. I remember having headaches before trying to set one up, was wondering if anyone had some handy tutorials or links on getting it setup and working. Thx in advance, Brandon
  15. Hello all, and good morning \ night. I have a question in the way of implementing this feature I am on atm. I have done alot of reading but keep hanging myself up on which way would be the most efficient in achieving this goal. Situation: I have a class object that is a button, cButton for example. This button class, in theory should store a function pointer to it's parent class and link to the parent's class custom function for OnClick() for instance. The parent class, Form1 for example, has a cButton object bound in it and a custom function called OnButton1Click(). In the Constructor of Form1 we set the properties for Button1 object, and set our custom function, OnButton1Click(), as Button1's OnClick() function. I hope I haven't lost anyone yet, it's early in the morning sorry. Anyways, I have seen many ways of doing Method Function Pointers using templates, STL, Boost. I'm just really confused and wondering which would be the most efficient for my needs. Currently I'm not using any additional libraries other than basic c++ and some STL. So I don't see how adding Boost just for this would be bennificial. But any suggestions or examples would greatly be appreciated. Thx so much in advance, Brandon
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!