|
Hi,i want to ask..how can v load the 3d images in opengl?
Regards
NooR
|
|
|
|
|
Read an OpenGL book - I think you need to get more familiar with the library if you are asking questions like this - do you mean render an image, load a 3D object from a file?
A cynic is a man who, when he smells flowers, looks around for a coffin. -H.L. Mencken
|
|
|
|
|
_I am using Visual Studio C++ .NET 2003, and I have problem when using cout. Here is my code:
#include <iostream>
using namespace std;
class A
{
private:
unsigned int m_nCount;
public:
A()
{
m_nCount = 0;
}
~A(){}
int Test()
{
m_nCount++;
return m_nCount;
}
};
void main()
{
A a;
cout << a.Test() << a.Test() << a.Test() << endl;
}
_ I expected that the output must be "123" but it was "321". I don't know what to do. Is my code wrong or that's a bug of VS C++ 2003. I need your help, thanks in anvance!!!
|
|
|
|
|
fatherhood of this problem is that Test func first called for third parameter of cout . I found this by change your code :
(First MyFunc called then Test function )
<br />
<br />
class A<br />
{<br />
private:<br />
unsigned int m_nCount;<br />
<br />
public:<br />
A()<br />
{<br />
m_nCount = 0;<br />
}<br />
<br />
~A(){}<br />
<br />
int Test()<br />
{<br />
m_nCount++;<br />
return m_nCount;<br />
}<br />
<br />
int MyFunc()<br />
{<br />
m_nCount++;<br />
return m_nCount;<br />
}<br />
<br />
};<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
A a;<br />
<br />
cout << a.Test() << a.Test() << a.MyFunc() << endl;<br />
<br />
}<br />
<br />
-- modified at 3:37 Saturday 22nd July, 2006
|
|
|
|
|
_ I debugged your modified code and found as you said, MyFnc() was called before Test(). But if MyFnc() was called first, I expected that the result must be "123" but it was still "321". Because when MyFnc() is called, the return value is 1 and 2 calls of Test() later returns 2 and 3.
_ When I modified my code as follow, the result was "123", MyFnc() still got called first. It is very strange???
#include <iostream>
using namespace std;
class A
{
private:
unsigned int m_nCount;
public:
A()
{
m_nCount = 0;
}
~A(){}
int Test(unsigned int i)
{
return i;
}
int MyFnc(unsigned int i)
{
return i;
}
};
void main()
{
A a;
cout << a.Test(1) << a.Test(2) << a.MyFnc(3) << endl;
}
_ When I tested "cout << 1 << 2 << 3 << endl;", the output was "123".
_ I think the call order is right to left and the return values are put to the stack. When cout outputs, it pops the stack to get the inverse order.
|
|
|
|
|
You said :
"
_ I debugged your modified code and found as you said, MyFnc() was called before Test(). But if MyFnc() was called first, I expected that the result must be "123" but it was still "321". Because when MyFnc() is called, the return value is 1 and 2 calls of Test() later returns 2 and 3."
The command before exec is : cout << a.Test() << a.Test() << a.Test() << endln ;
in Step 1 command is equivalent --> cout << a.Test() << a.Test() << "1" << endln ;
in next step command is equivalent ---> cout << a.Test() << "2" << "1" << endln ;
and in last step is ---> cout << "3" << "2" << "1" << endln ;
Now why you expect you see "123" in output . It is reasonable you see "123" in output .
|
|
|
|
|
if you add endl at the end of each a.Test(),you will get the right result:123
it's really strange!
|
|
|
|
|
First note that the problem has nothing to do with "cout":
----------------------------------------------------------
//#include <iostream>
//using namespace std;
#include <stdio.h>
class A
{
private:
unsigned int m_nCount;
public:
A()
{
m_nCount = 0;
}
~A(){}
int Test(char ch)
{
// cout << ch << endl;
printf("%c\n", ch);
m_nCount++;
return m_nCount;
}
};
void main()
{
A a;
printf("%d%d%d\n", a.Test('a'), a.Test('b'), a.Test('c'));
// cout << a.Test('a') << a.Test('b') << a.Test('c') << endl;
}
----------------------------------------------------------
Output is:
c
b
a
321
The same output is produced if "cout" is used. Note the "a", "b" and "c"s - this shows what's happening: The expressions are being evaluated from right to left.
There is nothing going wrong, see here:
http://www.kuzbass.ru/docs/isocpp/expr.html
Here's a quote:
"-4- Except where noted, the order of evaluation of operands of individual operators and subexpressions of individual expressions, and the order in which side effects take place, is unspecified."
Steve
|
|
|
|
|
_ OK, I think that I have something misunderstood in my mind. I used to think that cout evaluates from the left to right but it turns out it doesn't. Thanks everybody for help
|
|
|
|
|
Don't do that. When you put multiple side-effects in the same function call (operator<< is just a function call, after all) you're getting into compiler-specific behavior.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Hello, everyone !
I encounter a problem. When I set the VC++ (7.0) "Optimization: Maximize Speed(O2)", my program can't work correctly. But when I changed the Optimization to other, for example to "Minimize Size (O1)" or disable, my program can
work correctly.
But for some reason, I must use the (O2) option.
I want to know by which way , can I find the bug in source ?
Thanks a lot!
Best Regards,
|
|
|
|
|
Hello guys.
I'm sorry. I'm not sure I'm in right board section.
I tried to search what I'm going to ask. but failed..
I’m going to develop a dynamic library over several platforms; they are Windows, Mac and Linux.
I expect the forms of output would be ‘.dll’ , ‘ .dylib’ and ‘ .so” .
They must be built from same source codes.
But unfortunately I have neither Macintosh nor Linux machine.
So I have to build that all kinds of libraries in Windows XP system.
And I know it is very difficult to build an application for Macintosh using the Windows system. (and vice versa)
But what I'm trying to do is for just 'dynamic library' using ANSI C.
I think the cross-compiling for 'library' is easier than for 'applications'.
am I right?
And one of what I've found is 'gcc'of MinGW.
I'm wondering if it is really possible to build the three kinds of output of dynamic library from same source code using gcc of MinGW?
If not , how can I do that??
Thanks~
-- modified at 1:04 Saturday 22nd July, 2006
|
|
|
|
|
How to forbid the user to terminate my program.(in taskmgr).
Can I accomplish that to promote the process privilege.Thanks for your help.
|
|
|
|
|
Why would you want to do that? Are you writing malicious applications?
If you're writing a normal application, make it so good that no-one would want to exit it.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
You can't. This is by design of windows.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
If its an important application that needs to be running 365 days of the year, it should be firstly be running on a dedicated server. The less user interaction the more chance it wont be closed by accident. You can then start by overridding the usual suspects: OnClose, OnOK, OnCancel. Although as previous replies have said, a user could still terminate the application via task manager. - Maybe writing the application as a desktop application is the wrong avenue to take in this instance and writing the program as a windows service would be more fitting. However, even though this would give you some benefits ( e.g from people logging onto the machine and mistakingly terminating the program ) you can still not guarantee that your program could not be stopped.
If you really want to make sure that this application is not closed, you could write a heartbeat/pulse utility which periodically checks to make sure that your app is still running, and if its not re-start it! - then ofcourse some of the emphasis then shifts to the heartbeat/utility app. If this gets closed, then your back to step 1. - You could make the same heartbeat/pulse app distributed, in that it could be present on multiple servers, with all of them checking in with the server your 'important' app is running on.
Just a few ramblings.
|
|
|
|
|
you can create another process to monitor the main process, once the main process had been terminated, the other process create it immediately. and also the main process monitor the other process to keep it running.once it has been terminated create it immediately.
i think this method may satisfy your needs.
|
|
|
|
|
If this was easy to do every virus/trojan writer would be doing so already.
Steve
|
|
|
|
|
A good answer
|
|
|
|
|
Hook the terminate process API in kernel32.dll. Then when user right-click on the process list of Task Manager to kill process (tree), it takes no action.
Maxwell Chen
|
|
|
|
|
Hi fellows,
Does anybody here knows how can I change the color of a selected text within a Textbox? I'm using MFC's CEdit.
Any comment will be really appreciated. Thanks in advance.
Regards,
FG.
A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
|
|
|
|
|
Do you mean you want to change the color of the highlight that shows what text is selected, or do you mean you want to select text, and then change its color?
I don't think that the basic Edit control is capable of multi-colored text. I think you need something more advanced like the RichEdit Control.
|
|
|
|
|
In general, for a specific control, it is not possible. However you can change the selection-highlight colour for just your application by hooking the GetSysColor API and returning your custom colour.
www.catch22.net/tuts/tips2.asp[^]
|
|
|
|
|
|
Hello,
I am attempting this example
http://www.codeproject.com/managedcpp/ijw_unmanaged.asp[^]
I am newbie so let me clear myself what i understood and where I got stuck.
This solution contains three project
1) C # Class Library
2) C++ Managed Library
3) C++ Unmanged Console Application
Am I correct? If so
Q. after Building 1) and 2) I get two .dlls. In this example's case they are ManagedClasses.dll and ManagedWrapper.dll. HOWEVER to build 3) I need four items, the above two .dll files, IManagedWrapper.h file AND ManagedWrapper.lib file. CAN SOMEONE PLEASE TELL ME HOW TO MAKE .lib file out of 2) ?
Q. another question i have is about how to make this projects? I mean When I create a C # library project in .NET 2005 it won't let me include System.Windows.Forms. The included Project sample with the link above somehow gets around it. Can someone explain me how? Also How is 2) (C++ Managed Library ) created? in .Net? when I tried making one.. I ended up with six default files. Do i just delete them?
Thx a lot
Sameep
|
|
|
|