Archived

This topic is now archived and is closed to further replies.

Hints and tips for setting up MSVC++ for graphics programming??

This topic is 5654 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hiyas, just thought I''d start a thread on something I think about here and there. What are the best hints and tips you have for customising the MSVC++ environment to suit programming with your chosen graphics API? For instance I hate when I get a lot of windows and then find key windows like the file/class hierarchy window are covered, or if I wish to keep track of large structures in the debugger, I have to make the debug window at the bottom larger to see all of the structure which gets in the way of the code windows. Also when using the debugger I hate that every time I call a command such as new or memcpy, the debugger will go into these routines and show the inner workings. I''m not that advanced, I really don''t care what in particular isnt working in the function, I just wish to know whether it failed or succeeded and hate having to then ctrl+f10 through one of these commands every time it occurs in my code. Don''t get me wrong, it''d be nice perhaps later on once all that assembly code meant something to me (if it ever will) but right now it doesnt matter because the fault is generally/always at a higher level in my own code rather than in the lower level code. Also I notice that the auto complete feature for classes sometimes fails to work, I see the text at the bottom of the screen indicating that I have a choice of class functions/variables but the autcomplete box doesnt display as it should, I''m guessing this may be due to lack of memory as I like to have winamp, I.E. 6, a debug on the go and sometimes a few other apps working at the same time. Does anyone have any hints to help me with these things I dislike? Does anyone have any similar pet peeves that they''d like to know how to deal with or does anyone have any general advice they think would be handy for others to know? if so, please post away!! cheers, Steve AKA Mephs

Share this post


Link to post
Share on other sites
quote:
Also when using the debugger I hate that every time I call a command such as new or memcpy, the debugger will go into these routines and show the inner workings. I''m not that advanced, I really don''t care what in particular isnt working in the function, I just wish to know whether it failed or succeeded and hate having to then ctrl+f10 through one of these commands every time it occurs in my code. Don''t get me wrong, it''d be nice perhaps later on once all that assembly code meant something to me (if it ever will) but right now it doesnt matter because the fault is generally/always at a higher level in my own code rather than in the lower level code



Sounds like you are trying to step through your code with F11 (Step Into). This takes you into the inner workings of every function that gets called. Try using Step Over (F10) to avoid entering functions, and only use F11 if you need to go deeper into the stack. If you accidentally step into a function you aren''t interested in, just use Step Out (Shift + F11).

I find it helpful to avoid cramming too much functionality on one line in my code, so when I step through I can see exactly what is going on. Also, have the stack window readily available - it lets you see exactly where you are in the stack and look at the current state of every function up to where you are at the moment.

Share this post


Link to post
Share on other sites
Ahh, that then is due to not completely understanding all the terminology used in the debugger. If I had have known the difference between stepping through or stepping into functions, I would have understood that pressing a different key would solve that problem. I'm probably mistaken but there are no obvious guides anywhere as to how to use the debugger, it appears you are expected to just know how to use it, or maybe I havent delved deep enough into the docs? The problem is most games programming books only explain the basics of setting up VC++, and I'm not particularly interested in reading non games programming books to learn how to do so, as a lot of unrelated stuff will be covered and it would be a case of wading through a ton of useless information to get the bits I need.

I don't by any means have no clue as to what I'm doing as I am competent enough to create what needs to be created to make a game, using what I do know, but it would be handy to understand Visual C++ as a program a little deeper in a manner that is related to what is necessary to know as a games developer... not as a general C++ programmer.

PS thanks for the help, I'm sure that will come in handy in the future

[edited by - mephs on June 24, 2002 8:42:06 AM]

Share this post


Link to post
Share on other sites
Memory for Intellisense shouldn''t be an issue if you have some harddisk space free and haven''t messed around with your machines virtual memory settings. That said, more physical RAM is an essential item for development.

To get intellisense (autocomplete) for an API such as DirectX, go to the Project menu and select "Add to Project->Files...", now select all the header files you''re using from the API (and the others which look relevent). That should give you intellisense on most things.

Alternatively you could buy yourself a copy of the Visual Assist from www.wholetomato.com


Other tips:

1a. create a text file
1b. put a graphics API data type on each line:
GLfloat
GLdouble
GLbyte
1c. rename the text file to "usertype.dat"
1d. place the file in the same folder as MSDEV.EXE
1e. the above gives you syntax colouring for your own/gfx API types.

2. If you''re doing step by step debugging over calls to Windows API functions which return their errors to "GetLastError()" and you''re too lazy to put that in your code, go to the "quickwatch" window (the one next to the local variables) and enter the variable: "ERR,hr". Voila - the last error message in text form.

3. Similar things with your own variables and the QuickWatch window (where myvar is a variable used in your code:
3a. "myvar,hr" - get text error string from a HRESULT
3b. "myvar,wm" - show Windows message name for myvar (WM_BLAH)
3c. "myvar,s" - show as a string
3d. There are others, you can find them for yourself in MSDN

4. If you want newer DirectX SDK help integrated into MSDN so that you can press F1 in MSVC to automatically search the DirectX SDK help, download the free integration util from http://www.codejock.com/developer/article01.htm

5. For D3D under DirectX 7 there''s a secret feature:
5a. Go to the HKLM\Software\Microsoft\Direct3D key in the registry.
5b. Create a new DWORD value called DisplayStats
5c. Set DisplayStats to 1.
5d. Voila - on screen stats output (don''t think it works in DX8 tho).

There''s many more little hints and tips I can think of, but I''ll save them for some other time.


BTW: I''d actually say this topic is off topic for the graphics programming forum as its about use of a programming environment and general tips rather than graphics programming!



--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
yes, a little off topic perhaps... but I didnt want it to be mistaken by any means with general programming. As I said previously there is undoubtedly huge depth to Visual C++ as a program, but to users of directX or OpenGL a lot of that depth is kinda irrelevant. Okay DirectX is not just a graphics API but still, in the context of the question I feel better advice would be gained from having it in the graphics programming area rather than the general programming area.... or maybe I should be thinking of the general programming area as more of a general "games" programming area? I believe there is quite a large difference between ''general programming'' and ''general programming for games'' hence placement of the topic.... but anyways, mods feel free to move the topic if you like, so long as theres good advice coming in as above, I don''t mind

Share this post


Link to post
Share on other sites