|
hands are the best.
by the way, what sites (forums) do u use to submit ur software for free? (not paid sites, such as www.downlod.com etc)
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
I no longer use shareware sites - my key algorithms were never even touched until I put the software up on shareware sites. Check Favorites had a keygen within 3 days after I put it up on ~5 sites, and static keys started appearing for Delete FXP Files within 5 days or so (no keygen, though).
So, never again...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi,
How can we rotate a 2d line in 3d to get a cone or can anyone point me to any useful resource on this (Open GL).
Thanx in Advance ,
Regards,
FarPointer
|
|
|
|
|
OpenGL is very special, I think u should post ur Q on a OpenGL forum.
good luck.
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
Hi,
I couldnt Find OpenGL Forum in CodeProject you got a better idea were i can .
Regards,
FarPointer
|
|
|
|
|
This really isn't OpenGL specific but is just trigonometry. Decide on how many points you want to use in your rotation. For each point on the line you want to rotate it 360 degress around the z-axis. Decide what your delta theta is. For each point you will loop from 0 to the number of points and create a vertex as follows:
glBegin( GL_QUADS );
for each point on line
for each delta theta
x1 = x * cos(theta);
y1 = y * sin(theta);
z1 = z1;
glVertex3f( x1, y1, z1 );
glEnd();
I hope this helps you get started.
Deus caritas est
|
|
|
|
|
FarPointer wrote: How can we rotate a 2d line in 3d to get a cone or can anyone point me to any useful resource on this (Open GL).
actually, you are making it too difficult. OpenGL relative to order of operations. So assuming you want to rotate a line 30 degrees you go from this:
glBegin(GL_LINES);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(50.0f, 50.0f, 50.0f);
glEnd();
to this:
glPushMatrix();
glRotatef(30.0,0.0f,1.0f,0.0f);
glBegin(GL_LINES);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(50.0f, 50.0f, 50.0f);
glEnd();
glPopMatrix();
although the glPushMatrix() and glPopMatrix() are not required operations if you draw another primitive it is relative to the last rotate, push and pop operations restores the rotation matrix to prior to the rotate so that another primitive is relative to the original scene-view not the last rotation.
see this tutorial over at Nehe: Nehe OpenGL tutorial on Rotations[^]
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Might be a little late for this reply, but...
If you want to display a cone in wire or solid form, include glaux.h, and call either auxWireCone(radius, height) or auxSolidCone(radius, height).
If you want to construct a cone on your own, you'll need the mathematical formula for a cone and some code to draw the triangles that form the cone (GL_TRIANGLE_STRIP), and the base of the cone (if desired, also GL_TRIANGLE_STRIP or GL_TRIANGLE_FAN).
In either case, you can call glRotate before drawing the cone, to get the desired orientation of the cone.
delete this;
* poof! *
|
|
|
|
|
Does anyone know an easy way to overcome the problem with the SRT_MAX limit of scrollbars?
-- modified at 12:08 Tuesday 7th March, 2006
|
|
|
|
|
|
This is my code:
void CEditor::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)<br />
{<br />
SCROLLINFO ScrollInfo;<br />
<br />
ScrollInfo.cbSize = sizeof(SCROLLINFO);<br />
ScrollInfo.fMask = SIF_POS | SIF_RANGE;<br />
<br />
GetScrollInfo(SB_VERT, &ScrollInfo);<br />
<br />
switch(nSBCode){<br />
<br />
...<br />
<br />
case SB_THUMBPOSITION:<br />
ScrollInfo.nPos = nPos;<br />
break;<br />
<br />
case SB_THUMBTRACK:<br />
ScrollInfo.nPos = nPos;<br />
break;<br />
}<br />
<br />
SetVScroll(ScrollInfo.nPos);<br />
<br />
CWnd::OnVScroll(nSBCode, nPos, pScrollBar);<br />
}
The problem is that nPos does not become bigger than SRT_MAX. This is because nPos comes from the high-order word of the wParam of the message WM_VSCROLL. So it is just a short value that is casted to an integer. Is there another way to get the current position of the scroll box?
Thanks
|
|
|
|
|
You have to initialize the scroll bar at some point with a call to SetScrollInfo . My guess would be you want to do this in your CEditor::OnCreate handler.
The nPos value you are seeing in your OnVScroll handler varies between the values of nMin and nMax in the SCROLLINFO structure.
Software Zen: delete this;
|
|
|
|
|
Thank you for your help, but I think I have to describe the problem more detailed.
The scrollbar works fine when I move the scroll box with SB_PAGEDOWN or SB_LINEDOWN because in this case I do not need nPos. But when I react on SB_THUMBTRACK or SB_THUMBPOSITION I need nPos. So when I move the scroll box with the mouse to a position that is bigger than SRT_MAX nPos becomes zero and the scroll box jumps back to the top. Again: this is only the case if the scroll box is directly moved with the mouse. When I click on the scroll arrows everything works fine.
So what I need is a way to find out where the user has moved the scroll box when it is above SRT_MAX.
Thanks
|
|
|
|
|
When handling SB_THUMBTRACK , you need to look at the nTrackPos member of the SCROLLINFO structure, not nPos .
Software Zen: delete this;
|
|
|
|
|
Thank you very much. It works.
MSDN is such a great thing, but it happens the you do not to see the wood for the trees.
|
|
|
|
|
I need a refresher...
Are there any circumstances where using a pointer to an unsigned __int64 value could cause problems for an API expecting a PULARGE_INTEGER? For example, GetDiskFreeSpaceEx()...
If it matters...I'm using VC6 to compile an x86 EXE.
|
|
|
|
|
I had the same problem recently using GetFileSizeEx. Turns out LARGE_INTEGER is a struct.
MSDN says...
The ULARGE_INTEGER structure is actually a union. If your compiler has built-in support for 64-bit integers, use the QuadPart member to store the 64-bit integer. Otherwise, use the LowPart and HighPart members to store the 64-bit integer.
<br />
LARGE_INTEGER nTemp;<br />
::GetFileSizeEx(hFile, &nTemp);<br />
<br />
unsigned __int64 nFileSize = nTemp.QuadPart;<br />
"My dog worries about the economy. Alpo is up to 99 cents a can. That's almost seven dollars in dog money" - Wacky humour found in a business magazine
|
|
|
|
|
Yes, it's OK.
As it turns out, the LARGE_INTEGER struct is identical to unsigned __in64 as far as memory layout goes. The struct was added back in the days when 64 bit integer arithmetic wasn't readily available in the processors, and they provided the arithmetic via library functions.
Software Zen: delete this;
|
|
|
|
|
Thanks Gary.
I should've dug one extra level deeper in the definitions--the struct's QuadPart member is a ULONGLONG, which in turn is an unsigned __int64.
And since the LARGE_INTEGER is a union, then you're right, the memory layout is identical...
|
|
|
|
|
hi every1
im writing a code that needs to compare two poitner of type (void *)
i dont know how to do that; i tries to use the memcmp function but it requires a length parameter !
thanks already
|
|
|
|
|
same question[^], same answers... templates are what you need.
you cannot know what kind of object is pointed to by a void* address...
|
|
|
|
|
If you need to compare the pointer values, just compare them using normal operators. If you need to compare the things that the pointers point to you need more information about them:
int iValueA = 1;
int iValueB = 1;
void *vp1 = &iValueA;
void *vp2 = &iValueB;
void *vp3 = &iValueA;
if( vp1 == vp3 )
{
OutputDebugString( _T( "vp1 == vp3\n" ) );
}
if( vp1 == vp2 )
{
OutputDebugString( _T( "vp1 == vp2\n" ) );
}
if( *(int*)vp1 == *(int*)vp2 )
{
OutputDebugString( _T( "*vp1 == *vp2\n" ) );
} Peace!
[edit] Alright - who is the buttmonkey that voted this a 2 with no reason given? [/edit]
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hello folks,
I trying to instatiate a activex control, print template from Internet Explorer. The argv[1] parameter it's a path string to a HTML file(like these: c:\MyTemplate.htm). But it seems the type of vTemplatePath don't match and an exception is launched:
Error on line 474 atlbase.h
Expression: p!=0
I'm sorry to post this question here, but I'm a noob in C++. I'm a web programer(PHP, javascript, action script II), and I need very much of this.
Someone can help me to solve this?
Thanks a lot!
//Microsoft reference
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie55/html/beyondprintpreview.asp
//code
int main(int argc, char * argv[])
{
int i;
IOleCommandTarget* pCmdTarg;
CComPtr<iwebbrowser2> pWB;
pWB->QueryInterface(IID_IOleCommandTarget, (void**)&pCmdTarg);
VARIANT vTemplatePath;
V_VT(&vTemplatePath) = VT_BSTR;
CComVariant vPTPath = argv[1];
pCmdTarg->Exec(&CGID_MSHTML, IDM_PRINTPREVIEW, NULL, &vPTPath, NULL);
return 0;
}
|
|
|
|
|
pWB is NULL.
No Webbrowser conrol bas been created.
COM hasn't been initialized (by calling CoInitialize or friends).
Steve
|
|
|
|
|
Use:
CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (void**)&pWB);
received same error.
|
|
|
|