|
Can you say how u load that image ?
If u can Dream... U can do it
|
|
|
|
|
I don't load the image, I create it at runtime. I don't see how loading the image has anything to do with parsing an array of bits.
|
|
|
|
|
Not sure if this makes a difference for monochrome bitmaps, but try using GetDIBits() instead.
Another thing I noticed is x%7, which I don't think can be correct since that means you're shifting 0 to 6 bits to the right, when I think it should be 0 to 7 bits. Try it with x%8. I also would have thought that the leftmost bit would be the first bit.
My current guess is (not sure though, since you mentioned you were close)
BYTE pixel = *(BYTE *)(lpBits + offset) >> (7 - x%8);
|
|
|
|
|
The x%7 was a result of me playing with the variables out of frustration, I was adjusting them hoping to get a clearer picture. Your suggestion of >> (7 - x%8); is what fixed it, that and a slight mistake I made in calculating the array size.
Thankyou )
|
|
|
|
|
Hello all
I have generated a WIN32 console app, and created a resource , and a string table which has one string. Then I copied same string to German and put the same string id there and put a German text.
After that I have done the following code
#include "stdafx.h"
#include <windows.h>
#include <winnt.h>
#include "resource.h"
int main(int argc, char* argv[])
{
TCHAR pszTest[256];
int m_lang = GetProfileInt("General","Language",0);
HMODULE hMod = GetModuleHandle(NULL);
if (m_lang == 0) {
// switch language to english
::SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_DEFAULT),SORT_DEFAULT));
}
else {
// switch language to german
::SetThreadLocale(MAKELCID(MAKELANGID(LANG_GERMAN,SUBLANG_DEFAULT),SORT_DEFAULT));
}
LoadString(hMod,IDS_MSG, pszTest, sizeof(pszTest));
DWORD dw = GetLastError();
MessageBox(NULL,pszTest,"Message",MB_OK);
return 0;
}
I get the error 1812. Can you please help me to solve this?
Basically I am trying to write a WIN32 application to support both English and German. I dont know whether I have to make this WIN32 app a unicode application !!!
And also, it would be nice if you can gimme a link which helps me to generate a multilingual WIN32 app without MFC.
Thank you
Best Regards,
|
|
|
|
|
I vaguely recalled this had to so with getting the wrong section in the resource file. I found this:
http://www.microsoft.com/globaldev/handson/dev/muiapp.mspx[^]
(I do know you don't need to use unicode since English and German use the same code page.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
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.
|
|
|
|
|