|
Why not call GetThreadLocale() instead of reading an obsolete ini file.
|
|
|
|
|
Because the user may want to use German even though otherwise running in the English (or any non-German) locale.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
How does GetThreadLocale() prevent you from later setting the locale hence enabling you to load language resources?
|
|
|
|
|
Because he has to somehow set it first. By definition, GetThreadLocale() get's the user's default locale. If the user want to set the program locale separately, he needs to somehow obtain/remember the user's intent. (He may also be simply wanting to test various languages without changing the user's locale.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
hi all
Currently i am doing an 3d Graphics application , which allows to calculate the center of gravity of an object. The user can control the foreces upon the object. (stuffs like that)..
Here is my problem
-------------------
My application using perspective projection. So While creating an object (for Ex: consider a rectangle) using mouse , the objects is not correctly positoned with mouse cursor. ie when the user click and drag in the window , the object size is different than what he/she just dragged.
I am using 45 degree the angle of view and depth is from 1 to 500
Any !deas ? please give it to me
warm regards
krishnan
If u can Dream... U can do it
|
|
|
|
|
Not 100% sure, but I think you can use gluProject/gluUnProject:
double modelMatrix[16];<br />
double projMatrix[16];<br />
int viewPort[4];<br />
<br />
glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);<br />
glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);<br />
glGetIntegerv(GL_VIEWPORT, viewPort);<br />
<br />
double x, y, z;<br />
<br />
gluUnProject(viewPort[0] + mousex, viewPort[1] + mousey, 0.0f, modelMatrix, projMatrix, viewPort, &x, &y, &z);<br />
Might have to play around with the Y coordinate, it may be inverted.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Thanks for the reply & code
One more thing to clarify ( currently i am thinking about it). Pls go through this.
i think you know the function gluPersPective(...,near,Far);
For a perspective projection the coordiantes are normalised. ie (-1,0) , (1,0)is equal to left to right through the Orgin .. is it ?
I want to know the units of this near and Far parameters ?
is that also normalised coordinates ?
Thanks in advance
krishnan
If u can Dream... U can do it
|
|
|
|
|
krishnadevank wrote: For a perspective projection the coordiantes are normalised. ie (-1,0) , (1,0)is equal to left to right through the Orgin .. is it ?
Yes, if your glScale is setup normally. But because of perspective, (-1, 0, 0)- (1, 0, 0) will not visually equal (0, 0, 1)-(0, 0, -1).
krishnadevank wrote: I want to know the units of this near and Far parameters ?
is that also normalised coordinates ?
OpenGL is inherently unit-less - you define what 1 means (i.e. it could be an inch, foot, meter, or an A.U.)
The near and far planes, have to do with the z-buffer, which is non-linear. Objects up close have more precision.
Google on gluPerspective, z-fighting and the depth buffer for more info. Here's some info (not a very pretty site): http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html[^] (My old computer died, otherwise I'd provide you with a better link ).
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Once again Thanks
Suppose i would setup the my projection with 45 as fov and near = 1 and far = 500.
According to my knowledge the default eye location is at Orgin and looking towards in to the screen.
so if i drawn a polygon/rectangle like this (Covering the entire screen. ) , it maynot be visible.
glBegin(GL_POLYGON);
glVertex3f(-1,1,0);
glVertex3f(1,1,0);
glVertex3f(1,-1,0);
glVertex3f(-1,-1,0);
glEnds();
For making this visible(Convering the entire screen ) how much exact translation i want to do in Z direction . ?
Here i am confused with the parameters of gluPersPective function.
What you thinks ?
If u can Dream... U can do it
|
|
|
|
|
Not sure you can ever get an exact z position, but you could try backing up on the z-axis by a small increment just outside of the near plane, like glTranslatef(0, 0, -1.001).
You might have better results switching into ortho mode, using glOrtho.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Actually first i did my program in orthographic projection . it lacks good looks. that why i decided to change it to perspective projection.
I will try your suggestion today and will inform you.
Thanks & regards
krishnan
If u can Dream... U can do it
|
|
|
|
|
Hi steve
I tried with a value -1.0 for tranlation. I think there still exists some problems.
I put a point on the screen using GL_POINT. When the point location was at (0,0) every thing loooks fine , ie the point was on the orgin(0,0,0).
then i tried with value (1,0,0) , and translation in z direction glTranslate(0,0,-1). But the result is intersting. it vanished from the screen. ( ) .
Then i checked it by resizing the window , then it became visible at some time.
There must be problem with aspect ratio i think.(the asepect ration i put was width/height).
Any thoughts ?
Thanks
krishnan
If u can Dream... U can do it
|
|
|
|
|
Source bitmap is 800*600, and I called Clone(700, 500, 900, 700, PixelFormatDontCare),method failed. After searching in msdn, I know why the call failed.
But what I really want is a new bitmap, 200*200, part of it is a copy of the source bitmap, and the other part is white color. How to get such a bitmap? Wish someone give me some ideas.
|
|
|
|
|
The steps should be as follows
1) Create a Bitmap of size 200 x 200
2) Create a Graphics FromBitmap
3) Graphics FillRectangle white
4) Graphics DrawImage with appropriate source and destination rectangles
|
|
|
|
|
Hello everyone!
Hey, I want to make a Telnet app... According to Wikipedia, to move down a column I have to send:
{ESC} [ B
But how does it work? I'm just sending it char by char: (Pseudocode)
<br />
Send(0x1B);<br />
Send('[');<br />
Send('B');<br />
But it doesn't work! Should I send it as a char[] or what? Thanks!
PS: My networking library (SDL_net) has the data parameter as void* , so I'm just type casting it like Send((void*) 0x1B); ...
Windows Calculator told me I will die at 28.
|
|
|
|
|
What kind of "Telnet app" are you trying to make, and what program is at the other end receiving the codes you send? Are you sure that the other end understands ANSI escape codes?
|
|
|
|
|
Well, for now it's just a bunch of # 's filling the screen with a little smiley face (char 0x01 ) that moves randomly across the screen... And I'm using Windows XP Telnet on the other side (I've used Win98's and PuTTY also, none works...) What am I doing wrong? Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
If you really do SDLNet_TCP_Send(socket, (void*) 0x1B, 1); , then you send whatever byte of data is at address 0x1B, not the ESC character. Try SDLNet_TCP_Send(socket, (void*) "\x1b[B", 3);
|
|
|
|
|
Hi ,
I could initialize GDI+ in MFC , my previous system is Intel P4 CPU.
I try in visual C++ .NET 2003 & try in visual C++ .NET 2005 &
every thing is good and i use GDI+ function from my application.
but when i change my system (my system is AMD 4400+ X2 CPU) i write code
for initialize GDI+ in MFC, visual C++ .net does not have error when compile
my code but my project does not call GDI+ function , for example if i call DrawLine(...)
,nothing happen in my dialog window.
another things i can not understand when i excute my code in second system that i worte with my previous system , everythings are good & my project work properly.
I use these routine for initialize and use GDI+ in MFC:
http://www.codeproject.com/vcpp/gdiplus/vc6gdiplusmacro.asp[^]
Is that relate SDK platform ???
Is that relate to my CPU type?
Is there any one can help me????
Best Regards.
MJM.
|
|
|
|
|
another important thing that i saw,
when i debug this code in OnPaint() after initiliaze properly!!!
CPaintDC dc(this); // de
Gdiplus::Graphics graphic(dc.m_hDC);
Pen aPen(RGB(0,255,0));
graphic.DrawLine(&aPen,0,0,100,100);
//CDialog::OnPaint();
when i insert breakpoint at graphic.DrawLine(&aPen,0,0,100,100) when run into this
function debugger did not go to gdiplus library ! these mean can not work properly.
but when i compile my previous code , in breakpoint, ask me where gdiplusgraphics.h that
i think it is in SDK platform.
Best Regards.
MJM
|
|
|
|
|
My question doesn't really fit into any forum, but I hope to find the right audience here
I've got a MFC app that I want to split into components using COM. The menus and toolbars are created by querying XML from the components, so the components doesn't need to know which framework/toolkit is beeing used to display the UI.
But for UI elements like MDI child windows, dialogs and panes I don't know how to make them framework and language independent.
Say I want to display a modal dialog using Java, how could this been done if the app is written with MFC? (I know that this might look odd ) The MFC message loop doesn't know anything about the dialog.
I would like to be able to use MFC, .NET/WinForms, WPF and maybe Java to build the components. I would prefer a clean interface rather than any HWND hacks.
For example Office 2007 (maybe 2003) allows Add-Ins to create task panes with custom controls on it. AFAIK the task pane hosts an ActiveX control.
I guess the base app needs to offer interfaces for panes and child windows and maybe for dialogs, because otherwise it would be impossible to dock the panes to the main frame.
Maybe it would be better to drop the idea of beeing able to use Java (atleast for the UI) and write all components with the MFC and use the interop features with WinForms and WPF? But the disadvantage then would be that all component developers would need to be familiar with MFC.
There is a great article here on CP about interop/mixing MFC/WinForms/WPF (http://www.codeproject.com/managedcpp/HostMFC.asp[^]), but I'm not looking for a single mixed app.
The MFC base app should be replaceable with a WinForms or WPF app without having to modify/recompile the components.
Does anyone here use different frameworks and languages to build components for his app?
Thanks André
|
|
|
|
|
This will sound mean, but why are you wasting your time making this so complicated.
Forget Java NOW. It's a waste of time.
Sounds like your requirements point to a full blown .NET application. Just use pure .NET and don't look back.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
hi
how i can create a usercontrol like visual basic (contain more one control)
like a date time piker
Louai Haimour
|
|
|
|
|
What compiler are you using ? You can derive a class from a control class and put whatever child controls you want on there.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
dear Christian
thank you for your help
i use microsoft visual c++ 6 and i am a newer in this
if you can explane to me step by step >> thanks for you time
|
|
|
|
|