Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Mar 2007
Offline Last Active Today, 04:30 AM

#5166011 Having a problem getting data from .obj file to render (index / Vertex buffer...

Posted by Amr0 on 10 July 2014 - 08:05 AM

Also, check my dx9 c++ obj loader sample if you'd like: click

#5162352 Visual Programming

Posted by Amr0 on 23 June 2014 - 10:12 AM

I love visual programming, and I think it can be a very empowering tool in certain cases, like empowering artists to create rather complex logic and complex shaders when designing levels and assets. But I don't think it would be easy to use it for general programming. One idea that comes to mind about how this can be achieved is by exposing the majority of the API of an operating system, like the Windows API, to the nodes system and allowing users to create a program using those node.


Anyway, I worked for a while on such a system for creating hardware shaders, but it is still not finished, and I put it on hold. I am intending to pick it up again. Here is a screeny :)



#5157506 Ungoogleable game names

Posted by Amr0 on 02 June 2014 - 04:21 AM

Just to add an example, there was a few years ago footage on gametrailers of a AAA first person shooter called "They"... and I remember thinking immediately about its ungoogability. The game is no longer in development by the way.

#5121964 3D Lines with directx

Posted by Amr0 on 07 January 2014 - 12:56 PM

Volumetric lines?


#5121696 scripting and unity3D

Posted by Amr0 on 06 January 2014 - 01:51 PM

Given your username and your excitement about the tutorials having a stealth project, I think I can guess what kind of project you'll be working on, taffer...

#5079805 Win32 Window Resizing Issue

Posted by Amr0 on 23 July 2013 - 03:30 AM

Why are you terminating the process manually on WM_DESTROY? You're already returning from WinMain() when the window gets destroyed.


Anyway, what Khatharr said. If you set the background brush in your window class to a specific brush, it will automatically be used to draw inside the window when it gets resized. For example, use GetStockObject( BLACK_BRUSH ) or GetStockObject( WHITE_BRUSH ).

#5065174 [Win32] Addresses

Posted by Amr0 on 27 May 2013 - 01:54 AM

No, Windows does not offer you access to the address of the internal variables it uses to implement the functionality of the various controls. That's a good thing, as some of these may correspond directly to internal variables, while others are probably inferred and are calculated based on other variables. Even strings are returned by copying rather than by addresses. You can always just retrieve the value at the beginning of a function and cache it for the rest of the function.

#5061464 C++ 2d Game engine

Posted by Amr0 on 13 May 2013 - 02:46 AM

Look into HGE. I haven't used it myself, but it seems like what you need, and it seems to be good.

#5059730 why should direct2d program delete WNDCLASSEX's hbrBackground statement

Posted by Amr0 on 06 May 2013 - 07:15 AM

The background brush of the window class is used by the default message processor to repaint the background in response to WM_ERASEBKGND. If you are doing all your painting in WM_PAINT, or continuously in the render loop, then yes, you will not need a background brush. Note that if you use GetStockObject( BLACK_BRUSH ) to set the brush of the window class, then you won't need to delete the brush, because stock objects are shared between apps.


but why in almost every example, direct2d always renders in WM_PAINT and direct3d renders when no message processing


Well, it depends on how you want your application to behave, it has nothing to do with the application using D2D or D3D. If you want the application to render continuously, then you do all the rendering in the message loop when there are no messages. This is used when the contents displayed by the application is dynamic and changes frequently. If the contents change only when the user does something to change it (like painting programs for example), then the application will update its display only when needed, and in response to WM_PAINT.

#5059675 laser/electric effect

Posted by Amr0 on 06 May 2013 - 02:10 AM

They are also called volumetric lines sometimes. There was an NVidia paper about them, and I had written a C++ DX9 sample based on it. The sample is here, and the paper is in the Nvidia SDK here (search for volume lines).

#5057418 Capturing Win32 Mouse Repeat Events

Posted by Amr0 on 28 April 2013 - 02:01 AM

Windows will only send a single message when a mouse button is pressed and held, but it will send multiple (repeat) WM_KEYDOWN messages when a key on the keyboard is pressed and held. So yes, your scrollbar widget will have to use timers (or some other mechanism for performing an action with a certain frequency) to mimic the standard scrollbar behavior. But using Windows' timers is not difficult at all, so I don't see why you would want to avoid them.

#5057050 Coloured Light Maps

Posted by Amr0 on 26 April 2013 - 01:03 PM

You are multiplying red by green, so it's 0.

#5053423 Multiline comments - why the extra stars?

Posted by Amr0 on 15 April 2013 - 06:55 AM

(2) Separating comment from non-comment code at a glance is something you need to train your brain to do.  You could train it to ignore the greyed-out text set in an italic typeface, but then you better make sure your printouts, online listings, diff viewer, every coworker's workstation, and all the other tools that you use for that 80% of software development called maintenance also use the same scheme.  Or you could train it to see stars at the beginning of lines, which always just works.


// Then what's the advantage of using /* instead of using // if there is going to be

// something at the beginning of each line anyway? In fact, using // will allow

// you to use /* to disable blocks of code*/ quickly without the comments

// inside the disabled block getting in your way.

#5051124 What windows messages should a well behaved app support?

Posted by Amr0 on 08 April 2013 - 02:20 AM

Precisely those messages needed to do its job - no more, no less.

Why even answer if that's all you have to say?


Actually his answer sums up a strategy which is important in order to not introduce unwanted quirks. The less messages that a window handles, the less likely it is to misbehave. DefWindowProc() does A LOT of things to implement standard behavior of windows, and it expects to receive certain messages with certain data in a certain order. If your window messes with the order (by calling certain functions in its message handler which cause certain events which will in turn send certain messages before they return, or by not passing certain messages to DefWindowProc()), then there is a chance your window will break one of the standard behaviors implemented by DefWindowProc().


So yes, only process the messages that you need to process.

#5049965 DirectX Window drops to 30fps when it is not the foreground window in Win7

Posted by Amr0 on 04 April 2013 - 09:11 AM

I've just tested with a couple of the samples that come with the DX SDK, and I've noticed similar behavior as well! I've become interested in knowing why, though I can't say I hate this behavior - for me knowing that a game will not eat up all my CPU and GPU power even though it's in the background is a good thing. I suspect it's the doing of the nvidia driver (I have a 9800GT, Win7).