Jump to content

  • Log In with Google      Sign In   
  • Create Account

Penguin DT

Member Since 11 Apr 2007
Offline Last Active May 07 2015 03:11 AM

Topics I've Started

CapsLock, NumLock and pals in RawInput

07 May 2015 - 02:39 AM

Greetings again,


Thanks to the helping pointers from this wonderful community, I've now successfully ported all my DirectInput calls to Raw Input. However, one minor headache remains; CapsLock and NumLock buttons.


Ideally, when a person hits CapsLock or NumLock while in the game (i.e. as buttons bound to player actions), this wouldn't actually toggle CapsLock/NumLock/ScrollLock. This is simply because after a session in the game, if the key command isn't intercepted, the user will have absolutely no idea if the capslock is on or not when he/she/it returns to Windows.


In DirectInput this was easy; Just set the keyboard as DISCL_NONEXCLUSIVE|DISCL_FOREGROUND and there, no more CapsLock presses passed on to the system; Whatever was the user's preference before he/she/it started the game remained, regardless of what keys were hammered during the play session.


So, in other words, is there a way to block these keys from toggling the Caps/Num/ScrollLock states whilst in-game - without disabling the keys altogether?


As always, thank you in advance!

DirectInput vs Windows API input

02 May 2015 - 06:57 AM



While waiting for a new computer to arrive, I used the break from development duties to browse MSDN for development updates (it's been YEARS since the last time I did so). It seems Microsoft has all but abandoned DirectInput a long while ago. So, a question;


If DirectInput is kicked to the curb in the future iterations, is there a way to use Windows API to;


A) track relative mouse movement and

B) restrict the mouse to the app window without resorting to global ClipCursor trap?


I know I could do a horrible cluster-frakk of a work-around using global hooks, forced cursor re-positioning and the like, but that seems like awful lot of effort for something this simple. Especially since main motives for MS to move stuff over to Windows API has been, according to them, streamlining the codebase.


Sorry, if this question seems silly, but I just refuse to believe this task has moved from a simple few-lines-of-code into a colossal API-hacking nightmare - there just has to be something I'm missing.


Thanks you for your patience with silly questions! :D

Windows program priority

02 February 2012 - 04:05 AM

Some times a program that used to have a high CPU usage, but is now idling, prevents my current game build from hogging enough CPU processing power it needs. Ironically this doesn't bother the run-time so much, but the loading times become atrocious. While I feel this is not an issue with my program but that of the other program in question (specifically, Opera internet browser) (*), I'd love to know is there a way to tell Windows that my program needs all the juice it can get for the time being? You know, something like what the thread priorities do within the program itself, only for the program in general within Windows processes.

Any help is greatly appreciated.

(*) I deducted this from the fact that the instant I force Opera shut from Task Manager and restart my game, the issue gone.

The final word on stencil buffer and FBOs

07 January 2012 - 04:59 AM

I've been reading from all sorts of Internet articles about trying to get stencil buffer to work within Frame Buffer Objects and what I've encountered is a massive amount of conflicting information. Some articles say it doesn't work, others say it does but requires the use of Depth Buffer as well - and a couple mention potential hacks using multiple FBOs. So, what exactly is the case with Stencil Buffers and FBOs?

What I really need is an FBO with just color and stencil buffers - adding a depth buffer I do not use results a serious framerate dip. Is there a special multi-FBO work-around to do this or this a lost cause?

Any help is appreciated.

Windows OpenGL and choosing from multiple video cards

16 September 2011 - 01:15 PM


I've run into a small issue on one machine with two video cards. The other is used mainly to run web solutions simultaneously with high-end stuff running on the main NVidia card. For some reason no matter how I initialize OpenGL window, it uses the low-end video card and drivers. I assume this is because it is OpenGL compatible as well as was actually installed prior to NVidia card, thus having its drivers showing up in the registries first.

I know this is mainly user/OS side driver/config issue, but I'd love to create a user-friendly way to go around this; Simply by allowing user choose the display driver from the ones available if the default doesn't suit his/her/its needs.

So, is there a way to force OpenGL Windows application to choose a different video card / driver as opposed to the one Windows defaults it to?

I didn't manage to find any articles / topics about this, but feel free to point me to one if this has already been discussed elsewhere.