• Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About Omaha

  • Rank
  1. Quote:Original post by deadstarI think I need sleep. I've scanned over that function over 20 times :/ Haha. Been there.
  2. 3D explosion effect

    Well, explosion sprites are a dime a dozen these days, so grab one (or a few) of those and get them into your desired image format and loaded into your game. From there, well, it's just a matter of finding the point of impact and producing an explosion effect there. Depending on how your collision detection works you can probably calculate the point of impact, or hopefully at least get close enough to where the player won't notice the effect in the completely wrong place. As for your "shield impact" question, decades of sci-fi film have taught us that shields are invisible spheroids around spaceships, so you could either render a few faces of an invisible sphere with some kind of translucent sparky texture, or have neat little ripple effects occur wherever something is striking them. No matter what you do, though, the real onus is on your special effects--the code behind it is just a matter of calculating the point of intersection between two objects, which is hopefully extractable from your collision detector, and then initiating an effect there.
  3. What does your message processing loop look like? Also, you typically return 0 from a window procedure when you implement custom handling for a message. DefWindowProc() is used when you want to pass-through a message or if you want to make sure some boilerplate behavior still happens. Try not handling WM_QUIT in the same batch as WM_DESTROY; PostQuitMessage() will send WM_QUIT and it looks like you might be getting into some trouble with that bunch of calls. You can tell when you get WM_QUIT, in this case when the user has closed your window, when GetMessage() returns 0 in your message processing loop. Are you checking for that value?
  4. Having never written a fully functional multipass renderer of my own, I'm just speaking from personal theory here but hopefully it would work. I think you can do it either way; either have the renderer do one pass and render everything, then do a second pass for everything that needs it, and a third pass, and so on, but you would of course need to keep track of how many passes each shader/material needs, and then per object, skip rendering for passes that weren't needed. Alternatively, you could do all the passes for one object when rendering that one object, but this would be more expensive because then you kind of throw out the caching effect of sorting by shader/material as you're running through multiple state changes per object, instead of doing multiple objects per state change. The upside though is that this method might be a little easier to implement in the short run. As for the effect on depth sorting, secondary rendering passes typically do not write to the Z buffer, so it won't invalidate your sorting. So the first pass writes all of your depth data and the first color pass. The subsequent passes only write color data. With respect to texture coordinates, remember you're doing multiple rendering passes because your material/shader has more stages than can be rendered in one shot. If a stage has texture coordinates of some kind, store the texture coordinates in some data structure representing that stage; the material itself doesn't need to know about juggling data for multiple passes, it just needs to be able to describe each of its stages. Then, when it comes time to do a rendering pass for that material, you point to the texture coordinates for each stage that will be part of that pass. On the next pass, you point to the texture coordinates for the stages that will be rendered in the new pass.
  5. All the rest of you SimShaders are just imitating...
  6. What's wrong with it is nothing, I was just asking out of curiosity to see if I had missed an analogue to CloseWindow() while paging through MSDN.
  7. Is there a more elegant way to maximize a window from code than: PostMessage(HWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0); I might have the arguments in the wrong order, but the gist is there.
  8. Memory tracker

    stdio.h, stdlib.h, etc., as well as the *printf family of functions are all perfectly legal C++.
  9. texture mapping question

    A niggle for this is that you're using a literal 3 for the internal format parameter (arg #3) which is kind of a deprecated way of doing things. You should use the symbolic constants for formatting (GL_RGBA, GL_RGB (which should be ==3), GL_RED, etc.) throughout. I'm not sure how rearranging those lines of code would cause you to get a monochromatic image unless you uploaded the texture data before binding. Or, if that 3 had been a 1 previously.
  10. Template RTTI question

    Template classes are used to create actual classes at compile time. So, there isn't really a "class b" in your program, but rather many different "class b"s; one for each type that you give it as a template parameter. So, if you know what types you're instantiating at compile time, maybe you could do some kind of monstrosity using if typeid(objectA)==typeid(b<std::string>) or whatnot. In fact, I don't even know if that would work, I don't really use the oft overlooked typeid operator. Runtime type inferences are alot more suited to something like Java, but that's not really the point here. That being said, getting access to types at runtime is not exactly one of C++'s strong points, so I think one of the quick 'n dirty ways to do what you're wanting to do is to tag class a and class b with some field that identifies which each one is.
  11. Win32 Context Device

    How are you getting the HDC? If you're using GetDC() you should be able to keep the HDC for the duration of the program, provided the video mode doesn't change, or anything drastic like that. I think if you are using the BeginPaint() function in a WM_PAINT handler it's only valid for that particular refresh. Are you sure you aren't releasing the HDC prematurely? Also, you mention a back buffer--are you calling SwapBuffers() after each stream of drawing commands is complete?
  12. Best way to do this....

    If you've read the books then you know the basics. The next step is using the basics to make what it is you want to make. Sit down and figure out what kind of a game you want to make. Then try to break it down into what you know and what you don't know. What you do know, try to start breaking it down into parts that will work together as units to form the whole. Try to break down what you don't know into what you might know and what you need to know. There are no right or wrong answers at this stage in the game. It all boils down to what you want to do. From there it's how to do it.
  13. Actually it's not so much doing two separate things as it is doing it one way and not the other. Basically, when in windowed mode, if the user hits the maximize button then the game will switch to fullscreen mode, but I don't want that to happen if the title bar is double clicked.
  14. According to MSDN, getting the actual origin of a WM_SYSCOMMAND message can be done by examining the high 12 bits of the WPARAM of the given message. In the past I've used this to differentiate between someone trying to maximize by double clicking the title bar, or clicking the maximize button of the window, and doing a different maximize process depending on the cause. The low four bits differ depending on which method is employed. MSDN Source: MSDN says nothing about those low four bits other than they are "reserved for the system," which makes me think my little trick isn't exactly an endorsed way of doing things. Should I seek a new method or is luck on my side?
  15. HELP - Clear to Colour

    Let's back up a bit: Forget about the graphics and review your programming basics. If this is your first milestone and you're dumbstruck, you're in deeper trouble than you're going to get yourself out of asking people on a forum to do YOUR work for you. Saying you decided to skip a few days at work and meetings and then asking the guys across the hall to "help you catch up" will get you about two weeks into the professional world. Give me "dude just help me out" all you want, and try to rephrase the question as many different ways as you can--DO YOUR OWN HOMEWORK.