Illco

Members
  • Content count

    1038
  • Joined

  • Last visited

Community Reputation

928 Good

About Illco

  • Rank
    Contributor
  1. Handling Messages

    The first to receive any messages is your application itself. This is the part you mentioned which usually does PeekMessage() or GetMessage() and then subsequently calls TranslateMessage() and DispatchMessage(). The latter leads to the operating system forwarding the message to the right window (your application may have multiple). Each window has its own WndProc() (or whatever you call it) which you must define. In its simplest form it is almost empty and simply forwards all messages to the system supplied DefWindowProc(). Normally, though, you select messages you want to receive and act on them, using something like this: switch( message ) { case WM_PAINT: paint(); break; } This is also where you could choose to forward messages to your camera; either on specific messages or on any message if you like. For more powerful applications though, you'd best avoid the message system and do things in the main application loop. You can roughly do this like so: while( true ) { bool hasMessage = PeekMessage( ..., PM_NOREMOVE ); if ( hasMessage ) { // remove it and translate/dispatch it // ... } else { // Update scene, game state, camera, etc. update(); // Render a frame render(); } Greetz, illco
  2. Quick question about ODE:

    Are you destroying and cleaning up the created contact joints after the next step of simulation? Greetz, illco.
  3. mouse drawing above the direct3D

    On important distinction I couldn't make out in your post is whether you want to draw onto the texture displayed on the block or, instead, want to draw in 2D as an overlay over the 3D scene. In the first case you will have to reckon with some transforms to unproject the texture or project the scribbles you make using the mouse. You would have to lock the texture and draw into its surface, then release the lock and use it for drawing. In the second case life is easier. You'd lock the screen buffer after rendering and add the drawings to it or store the drawings on a secondary buffer and blend it over the scene buffer. Now here is the really good part for you: you can actually obtain a device context on Direct3DSurface's -- that means you can use your knowledge from DC drawing using the Win32 API. After obtaining the top surface from a texture using GetSurfaceLevel() you can call GetDC() to get a device context for drawing. Greetz, illco
  4. question about LockVertexBuffer

    The geometry probably uses indexing; see DrawIndexedPrimitive and see if you can get the index buffer from the original object as well (besides the vertex buffer). Other options are that the vertex buffer doesn't contain triangles but contains a triangle strip or fan; this reuses vertices from the previous triangle and hence requires less storage and potentially renders more efficiently. illco
  5. Compile the source code into a static library... greetz, illco PS: there is also an ODE binaries download I believe
  6. As the LNK prefix tries to say this is not a compile error but a link error. It means that while your program is syntactically correct it does not have access to all the things you are using. In particular it is missing the implementation of the ODE functions you use, which are in a static library (probabbly ode.lib or oded.lib). You should adjust your project settings to include linking to this library. greetz, illco
  7. I think you are really mixing things up -- I'd recommend you to read up on C++. In particular you are mixing types and identifiers as well as mixing function declarations with function uses (call). dWorldID dWorldCreate(); is the declaration of the function in ODE's API -- it just says there is some function called dWorldCreate() which will return something of type dWorldID. This line does not execute anything. dWorldID worldID = dWorldCreate() does several things. It declares a variable worldID of type dWorldID and secondarily assigns the result of the call to dWorldCreate() to it. void dWorldSetGravity (dWorldID , dreal x, dreal y, dreal z); is also the declaration and not the use of this function. To use it with the created world you should write dWorldSetGravity( worldID, 0.0, -1.0, 0.0 ); i.e. provide values for the specified formal parameters. But really I'd recommend you to touch up on C++ in general and then go back on getting to work with ODE. It will make things much easier and more insightful. greetz, illco
  8. Assuming this is C++, your example is incorrect language use (syntaxis). The latter example of dWorldID abc = dCreateWorld() suffers from the same typo you found in your previous post -- it should read dWorldCreate(). The thing that should work is: #include <ode.h> // . . . // dWorldID worldID = dWorldCreate(); illco
  9. Class Inheritence in C++

    That depends on what the list holds. Let's assume we have some smart object instance: SmartObject object; Now we access it in various ways: // This will call Object::Update(); Object plain = object; plain.Update(); // This will call SmartObject::Update(): Object & reference = object; reference.Update(); // This will call SmartObject::Update(): Object * pointer = &object; pointer->Update(); So if the list holds Object instances it will not work; i.e. if the list is for example std::vector<Object>. You would have to use std::vector<Object*> for example. Greetz, Illco (ok way too late but i hope it clears something up for someone sometime)
  10. If you have two positions p and q in the same space (such as world space), you can calculate the distance between them. This is done by taking the length of the vector obtained by subtracting them or d = | p - q |. Now assum p is the point to check and q is the circle center point. If the distance d is less than the circle radius, it is within the circle and otherwise it is not: the formula is |p-q|<r. Calculating |p-q| involves an expensive square root so often times the following equivalent formula is used: |p-q|^2 < r^2. Search online for circle-point test. Make a drawing and name the elements. Greetz, Illco
  11. Game Architecture Design Book

    You are also probably suffering from mixing things up. Game architecture is generally considered to be the study of how to build op a good game (i.e. gameplay, storytelling, etc) while you are looking for pointers into designing the game's software part. Yes, that involves software architecture but game architecture just isn't the right term for 'software architecture in the context of games'. Greetz, illco.
  12. Might it be that a (null-terminated) string is stored as the address of the first character? This makes accessing any other characters a (albeit small) calculation which is something that is done at runtime and not at compile time. PS: it is just a totally wild guess; I'm not much into these things so I might just have said something stupid. (hmz the storage pointer thing might not hold for literals...) Greetz, Illco
  13. storing pointers in a vector

    And 0x0000005 is an access violation, which usually means accessing a null pointer. Even when the function returns such a pointer, pushing it into the vector is totally valid (i.e. vector.push_back( NULL )). Therefore i suspect the problem is when you try to access the pointers stored in the vector later on. Greetz, illco
  14. Did you perhaps build the library in debug mode? If so, many superfluous debug information is included. Try building in release mode. You can adjust the configuration through the Project > Configuration... menu. Greetz, illco
  15. 3D Game Dev Quick Question

    At this point I wouldn't bother writing your own exporter or using your own custom file formats. A lot of material is available in this area and it would mean more gruntwork to do before you can do the thing you want. Suggestion: go with the .x format and find an importer (i.e. file loader) compatible with OpenGL. Though I use DirectX I'm confident such a package will exist (anyone?). Some other note: in 3D Studio Max there is just one timeline running from zero to virtual infinity. However, on a model you may want various looping and single-play animations (walking cycle, jumping). The trick is to self-assign parts of the timeline for single animations i.e. say for yourself that frames 0-19 contain the walking cycle and frames 20-39 contain the jumping animation frames. Make sure keyframes exist at 0, 19, 20 and 39 (at least). When exporting you can usually indicate which range of frames contains which animation and provide a name for each of them. In 3D Studio Max playing the timeline will execute the whole series of animations in sequence but in your own application the animations can be selected and played seperately. Once you get the hang of it you can even do animation blending: combining the walking cycle with the jump animation will yield a character walking in mid air. For reference have a look at the Cally Demo (Cal3D). It shows some nice features of keyframed bone animation. Greetz, Illco