• Content count

  • Joined

  • Last visited

Community Reputation

251 Neutral

About Jansic

  • Rank

Personal Information

  1. Memory Leak?

    [quote name='Zichu' timestamp='1342104198' post='4958417'] Anyway, wouldn't it be easier to just call the clear function to clear all of the elements in the vector? I tried it and I'm not getting the debug assertion. [/quote] I suspect the problem is in the calling function - it's probably looping over the length of the array and calling removeEmitter for each index - which won't work correctly because erasing an element from the vector will make it shorter, shifting the other elements up by one.. Jans.
  2. DX11 Swapchain->Present locks up

    SwapChain::Present exhibits asynchronous behaviour and queues blit/flip operations rather than performing them immediately. Depending on your swap mode (you seem to be using blit rather than flip) the rate at which the queue gets processed with vsync disabled will vary, as will the maximum length of the queue. You're submitting frames at roughly 200/s and they're being consumed by the device at about 70/s; so it's most likely that you're saturating the presentation queue and the Present function is then blocking until there's some free space. It looks like you might be able to use DXGI_PRESENT_DO_NOT_WAIT though that may be specific to DX11 threaded model, rather than behaving like DX9's do not wait flag. Jans.
  3. Bubblegum Engine error

    0xFEEEFEEE is the fill MSVC uses when something is freed. i.e. it's trying to delete something that has already been deleted. A quick glance at the code shows the AGame pointer is deleted both outside the class (in main) and in the destructor for the MainEngine class - which is probably the issue... Jans.
  4. Problem with virtual function

    You've sliced class2 by copying it into a class1 in the vector. I presume this wasn't your intention as now you're holding a class1 not a class2 which will give you only the base classes methods. Jans.
  5. Not entirely related but your timing code also times 'n' iterations of a 7-case switch statement: Invert the implementation to make one switch that contains one-loop-per-case to get cleaner results. Jans.
  6. Closest point on ray to AABB?

    [quote name='Spa8nky' timestamp='1311940818' post='4842104'] Can some please explain how I can obtain the distance between the closest AABB face and a plane? In other words the distance between the closest point on the AABB to the plane. [/quote] Surely for a convex shape like a cube it'll be one of of the corners (the points on the face will never meet the plane independently of the corners) - So just do point-to-viewplane distances for all 8 corners (and choose the smallest positive distance)? However.... Returning to the transparency sorting - do your objects overlap or inter-penetrate? If they do, you'll not make it work using neither centres nor nearest-points. Jans.
  7. Loop rectangles?

    [quote name='Freemountain' timestamp='1311937859' post='4842087'] [quote name='boogyman19946' timestamp='1311908886' post='4841973'] Oh wait, I figured out what you're trying to find. You're trying to find the positioning of the tiles right? [/quote] Yea, i want the rectangles to loop, just like the sprites.. [/quote] I'm not quite sure what you mean, but it looks like you want the rectangles to grow to cover all the different kinds of tiles. Maybe if you initialise the rectangles outside the loop to 'empty' then using Rectangle.Union to get what you want? mazeBounds = new Rectangle(); ... mazeBounds = [b]Rectangle.Union([/b]mazeBounds, new Rectangle((int)tilePos.X, (int)tilePos.Y, 32, 32)[b])[/b]; Jans.
  8. Counting number of class instances

    [quote name='Si_con' timestamp='1311757263' post='4841015'] [code] const A<int> a = A<int>(0,0); #endif [/code] This output: 2 [/quote] Since your constant object is in the header, multiple inclusions of the header will give you a copy of that object in each translation unit. I suspect you've included 'A.h' in multiple cpp files (2, probably). Jans.
  9. [quote name='SteveDeFacto' timestamp='1309917993' post='4831594'] When I do this all I hear is hash. [/quote] Have you checked that your OpenAL setup is correct. This code generates a mono 32-bit signed integer buffer, but I believe OpenAL only offers 8 and 16 bit integer formats. Are you giving OpenAL data in a format it understands? Jans.
  10. [quote name='King Joffrey' timestamp='1309859311' post='4831277'] Summing L and R is a simple L + R. The division by 2 is erroneous as it implies that it will gain compensate the output by halving the amplitude, which it wont (for reasons I posted above). [/quote] Which is exactly right, though you probably want something that preserves the channel difference too. However, this wasn't a question of halving the volume or making a signal with the correct gain; just one of reducing a stereo stream into a mono one within the bounds of the storage - for which it's a reasonable quick-fix. Jans.
  11. [quote name='SteveDeFacto' timestamp='1309850732' post='4831239'] For some reason it sounds like hash when I mix them like that. However, I can play either channel alone without a problem... [/quote] The algorithm posted will generally do the right thing; as long as the summation of the two channels doesn't overflow - you might need to cast the samples to larger types first. However doing stereo-to-mono dowmixing like this will reduce overall signal energy and pathalogical audio streams can produce either very quiet or very strange results when mixed. You might get better results by choosing the loudest of the two channels. Jans.
  12. bit class problem

    It's probably because the switch/case statement is missing 'break's after each case and falling through. However, what's wrong with just using an uint8_t and shifting bits into and out of it??? Jans.
  13. On APIs.

    I think the 'to-the-metal' terminology is horrendously misleading - no game developers should be programming the GPUs directly at the hardware level. I spend my working days writing GPU microcode for my employer. Worrying about cache coherency and page-break frequency when reading vertex data and scheduling multiple processing cores while feeding DMA distribution buffers is my job - I really wouldn't want to wish these tasks on anybody whose intention is to just write a game. Not least because of the internal knowledge of the chips developers would need to achieve this... That's why we write drivers and compilers and choose standard APIs to present it. Thinner API's would be a good thing from the CPU point of view, but you'd be surprised at the amount of distance you still have between the developer and the hardware.
  14. Templates and GCC

    Quote:Original post by phresnel $ cat lazy.cc template <typename T> void does_it () { (&T())->pardon_but_gcc_does_not(); } The contents of the function is entirely template parameter dependent. Add non-dependent unresolved class like 'Moo moo;' and it should fail without being instantiated. edit: Ignore all that. I mis-read the 'template parameters' part of the original reply post. Back to the original post, it's more likely that the MS compiler has picked up the 'missing' class in its preprocessing that GCC didn't. Liberal sprinklings of #pragma once and precompiled headers can make this hard to find. Jans.
  15. triangle mesh terrain artefacts

    Quote:Original post by EIRIKMEDKOMPIS to me it seems that the normals are calculated properly, and the problem lies in the interpolation between vertices. i dont know for sure though. what can i do to avoid this? Unfortunately this is to be expected with this kind of triangulation. The quads (pairs of triangles) can only 'bend' in one direction so can't follow the curvature of the landscape in all directions. Some points will have concave bends on convex slopes and vice-versa. There's not a lot you can do about it using vertex normals; you can tesselate more finely, smooth your landscape points or switch to lightmaps. Jans.