|
|
Sorry,
I am using NT-based Operating systems. I.E. NT 4.0, Win2k, XP (home & Pro)
Dan Willis
|
|
|
|
|
groover4life wrote:
So in essence what you are saying is; Instead of using the WM_TIMER message, create a thread that just performs a basic loop, getting the data and updating the display, and the update rate will be what ever the CPU slice is for that particular thread?
wait, wait, wait... Use the loop in the thjread for data mainpulation only, and pump custom messages out of the thread to the UI thread and handle the redraw and stuff in the UI thread as a message handler. I've had very bad experiences when trying to access stuff outside of my own little thread, but the PostMessage thing works very well. NT should get you pretty accurate down to around 10ms or so, so that is about a 100Hz refresh. (You'll need to do a Sleep(10) or whatever to delay the thread.) Make sure you aren't doing very time consuming stuff here either, as that will begin to affect your performance. Remember, NT is not an RT OS, so you are at the mercy of other higher priority things on the PC. There are some articles around here about using multimedia timers for better precision, but I haven't used any of them yet.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Nitron,
This seems like a viable solution to my performance issue. I believe I will take this approach, then go back into the OpenGL code and see what I can do to optimize there. At least I don't need it to be real time as Windows is not a RTOS, but it should give me the refresh rate which I need.
Also, Do you think it will hurt having to access my document object to dump the data into? I don't have to manipulate the data alot.
do you think this will also help my CPU HOG issue as well? I may have some more questions once I design and implement this method (will take me most of the afternoon as the application is pretty complex in nature).
Thank you so much for the suggestions and comments. Keep 'em coming! Whoo Hooo!
Dan Willis
|
|
|
|
|
groover4life wrote:
create a thread that just performs a basic loop, getting the data and updating the display, and the update rate will be what ever the CPU slice is for that particular thread?
My idea is this one: One thread updates the data periodically (using an infinite loop with a call to SleepEx in it, to allow the OS to activate another thread, especially important with Win9X OSs), another thread displays these data periodically too (with a timer for example), but asynchronously with the first one. Data protection is then required between the two threads, for example by using a mutex.
It enables to smooth the CPU consumption.
groover4life wrote:
What kind of tricks can I use in OpenGL??
There are plenty technics, you should perhaps refer to the OpenGL Red and Blue Books. You may also find some rules to follow on this page[^]
FYI, I call resident textures bitmaps you may "upload" in the video memory of the video card. Using this instead of standard RAM may fasten a lot the rendering, according to the capacity of the video card and the use of textures by the application.
groover4life wrote:
I always test, but in this case I did not write this code base. I was only left to deal with it
What I meant was that you should be careful the end users of your application may have a computer less powerful than yours, so you should probably have to envisage this case.
HTH,
K.
I hurt so bad inside
I wish you could see the world through my eyes
It stays the same
I just wanna laugh again
|
|
|
|
|
KaЯl wrote:
I always test, but in this case I did not write this code base. I was only left to deal with it
What I meant was that you should be careful the end users of your application may have a computer less powerful than yours, so you should probably have to envisage this case.
LOL! Thanks! But I doubt that my company's clients will have a machine slower than a P-3 450 which is what I'm using for my development.
Dan Willis
|
|
|
|
|
When dealing with OpenGL, GPU is often more important than CPU
Following the video card, the framerate may vary considerably (i've still experienced a variation from 1.5 fps to 50 fps !)
I hurt so bad inside
I wish you could see the world through my eyes
It stays the same
I just wanna laugh again
|
|
|
|
|
Hi,
I need to draw some text rotated 90º in the screen, for that, what I did is to transform the normal font, and call ExTextOut...
...But I have a problem, with multiline text... with DrawString was now problem give a rect and make the text fit there... but it seems that DrawString doesn't work for rotated text, and does ExTextout support this ?
Thanks in advance, Greetings
Braulio
|
|
|
|
|
Try here[^].
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I have a CFormView class and I'd like to automatically resize the window when the user turns off the toolbar or status bar. In other words, I don't want the blank area of the form view (usually hidden by the toolbar or status bar) to show up when the user toggles the status of either bar.
I haven't seen any source that does this, so any help would greatly be appreciated.
Thanks!
Jonah Bishop
Visit JGB Productions
http://www4.ncsu.edu/~jgbishop
|
|
|
|
|
Use SetWindowPos()
i.e.:
WINDOWPLACEMENT wp;
GetWindowPlacement(&wp);
wp.rcNormalPosition.left = rectNewRect.left ;
wp.rcNormalPosition.right = rectNewRect.right ;
wp.rcNormalPosition.bottom = rectNewRect.bottom ;
wp.rcNormalPosition.top = rectNewRect.top ;
wp.showCmd = SW_SHOWNORMAL;
SetWindowPlacement(&wp);
or something similar...
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I see how I would use that, but how do I figure out the new window size when hiding or (more importantly) showing the toolbar or status bar? Is there a call to get the view size (with the toolbar) and also get just the toolbar size (to subtract or add to the view size)?
Thanks!
Jonah Bishop
Visit JGB Productions
http://www4.ncsu.edu/~jgbishop
|
|
|
|
|
int x_size = GetSystemMetrics(SM_CXSCREEN);
int y_size = GetSystemMetrics(SM_CYSCREEN);
int x_max = GetSystemMetrics(SM_CXMAXIMIZED);
int y_max = GetSystemMetrics(SM_CYMAXIMIZED);
int yToolbar = y_size - y_max;
I think...
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Oops. I should have checked a little more thoroughly here at the site...
I found the exact thing I was looking for in this article.
But thanks for your prompt replies, Nitron. They are certainly appreciated!
Jonah Bishop
Visit JGB Productions
http://www4.ncsu.edu/~jgbishop
|
|
|
|
|
I had in a C dll, that was called by VC++, the following and it worked fine:
#define DllExport __declspec( dllexport )
DllExport void __cdecl Fusion_Method(int *nalg, int *score, int *fusion_score)
{
I wanted to call this dll in a VB program and am told I need to do _stdcall. I searched the web but dont see how to modify the above to make it stdcall instead of __cdecl. Please help!
Appreciate your help,
ns
|
|
|
|
|
Just replace __cdecl with __stdcall in the declaration of FusionMethod . That's all you need to do (hopefully).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Good try. It compiled fine. But the VB callling program stubbornly still says it doesnt know anything about the function from the dll.....
Thanks so much for helping though...
Appreciate your help,
ns
|
|
|
|
|
Am I doing this right?
#define DllExport __stdcall( dllexport )
//#define DllExport __cdecl( dllexport )
//DllExport void __cdecl Fusion_Method(int *nalg, int *score, int *fusion_score)
DllExport void __stdcall Fusion_Method(int *nalg, int *score, int *fusion_score)
This wont even compile!
Thanks though, for the input
Appreciate your help,
ns
|
|
|
|
|
Try this:
#define DllExport __declspec( dllexport )
extern "C" DllExport void __stdcall Fusion_Method(int *nalg, int *score, int *fusion_score)
...
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Compiler says:
c:\pmarmodif\fusionmethod.c(3) : error C2059: syntax error : 'string'<br /> pointing at the extern line.....
Thanks for keeping up with my issue here...
Appreciate your help,
ns
|
|
|
|
|
Ummm.. I guess fusionmethod is C++ code, so change the extension to .cpp . The fact that you're declaring the function as extern "C" does not have to do with the language you use to implement it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
The others who respond are correct, I'm only adding on here. One thing I've found when I want to use __stdcall is the need to include a line defining the function in the .def file for the project.
So if your dll project is named "ABC", open "ABC.def", and add the following line to the "EXPORTS" section (it must be on it's own line):
Fusion_Method
Now, build your dll again, and the function should be exported with the correct name.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
Thank you to all who helped. Chris - I did indeed go the .def file route and have it working though its churning out an incorrect result. However it recognises the exported function now. One question though: Dont I need to specify the arguments of Fusion_Method in the def file? Like Fusion_Method( int*a, int* b, int*c) ?
Thanks
Appreciate your help,
ns
|
|
|
|
|
You don't need to specify the arguments in the .def file. When you say "incorrect result" what do you mean? Keep in mind, that you need to take Joaquín's comments into account (by using __stdcall instead of __cdecl).
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
I had a slight error in the calling VB program which was making the numerical result incorrect. Once I removed the argument list from the def file and fixed the VB problem, it worked fine.
My next task is to find a compiler for this user who wants to be able to compile the Dll but refuses to install V Studio. SO far the gcc compiler I've looked into (I'm on windows) doesnt tell me how to compile a dll given a .c and a .def file.
Anyways, the coding problem has been resolved, so I thank you for your input.
Appreciate your help,
ns
|
|
|
|