|
ACK never mind - You showed the bitmap ID in the resource
Well, I can't imagine why it would draw different!
The bitmap is 10x15 and you can tell the shade of black is different? Good eye!
What if you make a new bitmap, filled with black, and substitute it in the resource. Does that
show as black or gray?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I haven't tried that. It will take a while to do though. This app is running on a flight simulator, so I can only try this when the simulator is not in use, so it may be next week before I can get back to you.
Thanks for all your assistance!
John P.
|
|
|
|
|
Hi to all of you,
I am a new programmer on OpenGL.
I am currently working on an application where I have a Debian Linux PC with two usb industrial cameras,acquiring images at a rate of 25fps. Each image data is sent by sockets to a windows PC. The format of the received buffer at the windows PC side is buffer[0]='top left image pixel', buffer[640*480]='bottom right image pixel'. I want know to proccess these buffers an display a video on an OpenGL window at a similar frame rate, or even lower,i.e. even 5-10 frames per second will do for me.
I am using Dev-C++ on the windows PC.
Can anynone advised me with an appropriate approach?
Cheers,
DoctorDoctor
|
|
|
|
|
...from system32 even if it is copied to the directory the application starts from? I just dealt with a customer over a bug due to this very issue. Two DLLs with the same name were on the system. One DLL was loaded by one application and then the other application loaded the first application's DLL instead of its own. Result? Confusing "ordinal/export not found" messages and the second application refused to start.
The Windows loader should be smarter than that. I'd love to hear the rationale behind why Windows can't run a quick check for the DLL in the application's directory BEFORE looking for a cached DLL of the same name elsewhere. Caching systems, by definition, must reflect the equivalent non-cached system 1-to-1.
Non-cached DLL search order[^]
|
|
|
|
|
I suppose that's why MS tacks version numbers on to runtime DLL names
Sorry for your lost time debugging!
Unique DLL names are a good idea
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
dontknowitall wrote: I'd love to hear the rationale behind why Windows can't run a quick check for the DLL in the application's directory BEFORE looking for a cached DLL of the same name elsewhere.
Wouldn't that sort of defeat the purpose of cached DLLs? After all, RAM is much faster than the HDD.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: Wouldn't that sort of defeat the purpose of cached DLLs? After all, RAM is much faster than the HDD.
No - it wouldn't defeat the purpose. The point of caching DLLs is to reduce the amount of RAM used. If two applications happen to have a DLL of the same name and one is running and the other is started, the second application will attempt to use the first application's DLL. Checking for a file's existence in the application's directory before looking at the loaded DLL cache takes almost no time (and could potentially be done in RAM altogether because the file system caches information like that in RAM).
A cache, by definition, should return the same exact result as the method used to generate the cached information. To deviate from the definition will cause bugs to appear. Windows does not do this and therefore has "bugs". LoadLibrary() documents this weird behavior but that doesn't make the behavior right/correct.
|
|
|
|
|
It's been this way since the beginning. IMO a part of the whole DLL hell thing.
It's one of those backward compatible things that couldn't be changed and we have to live with it.
The caching works fine. It is IMO appropriate to look for an already-loaded DLL before going to
disk to get it.
The problem is, it's done by NAME ONLY. I think it should look at name and VERSION at least.
But it doesn't. Complain to Microsoft...good luck
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thank you for posting, I don't knew about that behaviour. On the overall, I agree with you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi,
Does anybody know a macro to check if only one bit is set in a word value ?
Thx
|
|
|
|
|
paper67 wrote: Does anybody know a macro to check if only one bit is set in a word value ?
No macro is required. Just use the bitwise AND operator. For example, to check if the sixth bit is on:
WORD w;
if (w & 0x0020)
...
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Something like this, assuming of course that the first bit has index 1, not 0.
template <typename T>
bool IsBitSet(T number, T bit)
{
if(bit == 0 || bit > sizeof(T))
{
ASSERT(0);
return false;
}
return number & (1 << (bit - 1));
}
--
Time you enjoy wasting is not wasted time - Bertrand Russel
|
|
|
|
|
Never considered to write such a amount of code to check for a single bit.
Are you a romance writer?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
The miracles of readability and generality.
--
Time you enjoy wasting is not wasted time - Bertrand Russel
|
|
|
|
|
There was the C language , a true miracle of conciseness...But it was a long, long time ago
I agree on generality, a bit less on readability
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Are you serious?
Compare
if(IsBitSet(flags, 5)) ... to
ASSERT(some check that flags is big enough for 1 to be shifted 4 steps to the left);
if(flags & (1 << 4)) ... Which one do you think conveys most meaning?
I don't for a second distrust your ability to understand what the second one does, syntactically, but the first one has a level of semantics that the second lacks completely, and that alone is A Good Thing™.
--
Time you enjoy wasting is not wasted time - Bertrand Russel
|
|
|
|
|
Johann Gerell wrote: Are you serious?
Of course.
Knowing a bit of bits ( ) then you have to admit that semantics has to be found also in the second expression.
Working at bit level may be done with conciseness and elegance: Why making complex what may be simple?
(just my point of view, of course...)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I use a lot of bitflags, and my preference is to use enums as
Johann Gerell wrote: if(IsBitSet(flags, 5)) ...
whilst readable does not indicate what bit 5 is. I prefer to define in the appropriate namespace
<br />
enum {FLAG1 = 0x01, FLAG2= 0x02, FLAG3 = 0x04, FLAG4 = 0x08, FLAG5 = 0x10 }; etc<br />
with informative names for FLAG1 etc.
then test flags as
if (flags & FLAG2)
I also often include an inline function
void ModifyFlags(DWORD add, DWORD remove) {flags = (flags & ~remove)|add;}
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
#define IsBitSet(_val,_bit) (((_val) & (1 << (_bit)))==(1 << (_bit)))
|
|
|
|
|
paper67 wrote: Does anybody know a macro to check if only one bit is set in a word value ?
... if on the other hand you are asking how to check if only one bit is set in a word value (not the state of a given bit) ...
If only one bit is set then the value will be a power of 2.
To check if a value is a power of 2 you can use:
#define ISPOW2(x) ( ((x)&((x)-1)) == 0 )
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hi,
I forgot to mention that I do not know the position of the bit within the WORD value.
So, I want to check a WORD if it contains a one bit value (bit flag) without knowing its position.
Thx.
|
|
|
|
|
The following counts how many bits are set.
INT howManyBits(WORD w)
{
WORD wSingleBit=1;
INT iCount=0;
while (wSingleBit)
{
if ( wSingleBit & w ) iCount++;
wSingleBit <<= 1;
}
return iCount;
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi:
I am building a client program in VC++ 6.0 using WINSOCK to connect to the server. I have a very small program that testing WINSOCK. My program contains include statement for WINSOCK2.h. Here is the code to initialize WINSOCK.
WSADATA wsaData;
int iResult;
iResult = WSAStartup(0x0202, &wsaData);
if (iResult != 0) {
printf("WSAStartup failed: %d\n", iResult);
}
Errors:
Linking...
testwin1Dlg.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8
Debug/testwin1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
testwin1.exe - 2 error(s), 0 warning(s)
Additional Comment:
I looked in WINSOCK.H and WINSOCK2.H and both has WSAStartup. In WINSOCK.H, it was PASCAL version. In WINSOCK2.H, it was either C or C++ version. Both version has the same signature (calling argurment).
Can this be an issue? if yes, how can I eliminate the PASCAL version (WINSOCK.H)? Note that, I never include WINSOCK.H.
Thanks
Bill
|
|
|
|
|
jocblack wrote: testwin1Dlg.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8
So are you linking with the correct library.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Under Additional Dependencies for your Linker, add "ws2_32.lib" I think it was. Anytime you use functions that aren't compiled from inside your solution/project you need to include the .h AND the .lib file. The only other way is to load the DLL at runtime, but I don't have experience with that.
Good luck
|
|
|
|