|
|
 Prize winner in Competition
"MFC/C++ May 2003"
Comments and Discussions
|
|
 |
|

|
Aside from scores of warnings about "possible loss of data", C2664 is keeping me from compiling this code in anything but VC++ 6.0. Would someone please post a method to "convert"? The code to convert, not just "oh great, it works now! Because I casted!" or "dude, you gotta cast". Thanx.
GraphCtl.cpp(1078) : error C2664: 'CGraphCtl::SetLight' : cannot convert parameter 1 from 'std::vector<_Ty>::iterator' to 'CElement *'
with
[
_Ty=CElement
]
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
GraphCtl.cpp(1099) : error C2664: 'CGraphCtl::PtInRange' : cannot convert parameter 1 from 'std::vector<_Ty>::iterator' to 'CPoint3D *'
with
[
_Ty=CPoint3D
]
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
GraphCtl.cpp(1101) : error C2664: 'CGraphCtl::Coordinate' : cannot convert parameter 1 from 'std::vector<_Ty>::iterator' to 'CPoint3D *'
with
[
_Ty=CPoint3D
]
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
GraphCtl.cpp(1118) : error C2664: 'CGraphCtl::PtInRange' : cannot convert parameter 1 from 'std::vector<_Ty>::iterator' to 'CPoint3D *'
with
[
_Ty=CPoint3D
]
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
GraphCtl.cpp(1120) : error C2664: 'CGraphCtl::Coordinate' : cannot convert parameter 1 from 'std::vector<_Ty>::iterator' to 'CPoint3D *'
with
[
_Ty=CPoint3D
]
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
GraphCtl.cpp(1145) : error C2668: 'sqrt' : ambiguous call to overloaded function
C:\Program Files\VS71\Vc7\include\math.h(626): could be 'long double sqrt(long double)'
C:\Program Files\VS71\Vc7\include\math.h(578): or 'float sqrt(float)'
C:\Program Files\VS71\Vc7\include\math.h(200): or 'double sqrt(double)'
while trying to match the argument list '(std::vector<_Ty>::size_type)'
with
[
_Ty=CPoint3D
]
Quite a mess, huh?
RedDK
|
|
|
|

|
I had the same problem trying to compile the dll in VS C++ 2005.
CElement (and other iterators alike in the erring code) is a pointer which is different to an iterator. Hence you have to dereference it first then get its address before you can pass it through. This converts the iterator value into a pointer to an object behind the iterator.
Modifying each of the erring the code similar to below will make it compile:
SetLight(&*CElement);
|
|
|
|

|
Thanks hytleung!
Neat trick. It's 2011 and I'm using VS2010 now (back when I posted this message was using VS2005, as you noted).
Aside from sqrt((double)..., your fix made the compiler get to the last error. Only a linker error here.
And quickly finding a missing .lib reference to comsuppwd.lib, which is still prickly in this project-as-downloaded-now, the .dll is produced!
Four years older and still becoming wiser.
|
|
|
|

|
Hy guys,
I need to implement in my C# app same things that control does, just like 3d surfaces and points visualization.
How can I perform this?By wrap the *.dll?And if true why?
Thankyou a lot.
Mirko
|
|
|
|

|
I'm using it in c#. It's pretty easy. Just go to your tools bar on the left hand side, right click, select "Choose Items" and then browse to the .dll. Then a new item for this control should appear in your tools bar.
I am having problems getting it to draw surfaces correctly though.
|
|
|
|

|
Thanks man. it was a gr8 help
|
|
|
|

|
I cannot add property pages because the compiler said "windows.h already include" or similar. Anybody can help me?
Thank you.
|
|
|
|

|
I want to develope a 3D game with vc++ can anyone help
me for using opengl , is there any simple example present
on the net free to download.
If anyone in the same field can help me
ok take care
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|

|
there is one game on codeproject [ good website ]
in the OpneGL section (just scroll down the list)
but i need one like the Arked or Shooting game.
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|

|
Hi,
Actually I think there is another bug in the PlotElement function.
Indeed, I believe the loop in order to display a surface is wrong.
What about the following code?
...
// Turn on the primitive connection mode (not connected)
glBegin (GL_QUADS) ;
/* Original code
int i, npt = sqrt(theElement->m_PointList.size());
aPoint = theElement->m_PointList.begin();
for (aPoint, i=0; aPoint != theElement->m_PointList.end(); aPoint++,i++)
{
int j,k,n;
if (PtInRange(&(theElement->m_PointList[i])))
{
// i, j, k, n ・4 indices of a quad
// Counter Clockwise direction
j = i + npt; // Other vertices indices
k = j+1;
n = i+1;
*/
int i = 0 ;
int npt = theElement->m_PointList.size() ;
int nxpt = sqrt(npt);
int nypt = sqrt(npt);
int x, y ;
for (i = 0, x = 0 ; x < nxpt-1 ; x++, i++)
for (y = 0; y < nypt-1 ; y++, i++)
{
int j,k,n ;
if (PtInRange(&(theElement->m_PointList[i])))
{
// i, j, k, n ・4 indices of a quad
// Counter Clockwise direction
j = i + nxpt ; // Other vertices indices
k = j+1 ;
n = i+1 ;
...
|
|
|
|

|
Hi,
Thank you for this article. It is great!
However I think there is a small bug in the PtInAxisBox function.
Because we convert the coordinates inside the function Corrdinate,
and then we convert back inside the function PtInAxisBox. If so, this second convertion is wrong.
What about the following code?
BOOL CGraphCtl::PtInAxisBox(CPoint3D* pt)
{
float xF=dRangeX[MAX]-dRangeX[MIN];
float yF=dRangeY[MAX]-dRangeY[MIN];
float zF=dRangeZ[MAX]-dRangeZ[MIN];
CPoint3D point;
/*point.x = (pt->x+dRangeX[MIN])/xF + 0.5f;
point.y = (pt->y+dRangeY[MIN])/yF + 0.5f;
point.z = (pt->z+dRangeZ[MIN])/zF + 0.5f;*/
point.x = (pt->x + 0.5f) * xF + dRangeX[MIN] ;
point.y = (pt->y + 0.5f) * yF + dRangeY[MIN] ;
point.z = (pt->z + 0.5f) * zF + dRangeZ[MIN] ;
return (PtInRange(&point));
}
|
|
|
|

|
hi everybody,
when i draw a surface for example a trangle, just using 3 points, i just wonder why the the surface incudes the origin point (0,0,0) as a fourth point.
any ideal?
tia
Harald
|
|
|
|

|
Hi,
can you send me some exaples on your experience, because I can't draw surface
|
|
|
|

|
I met the same problem
chenzd
|
|
|
|

|
I'm having the same problem. The origin is added as a final point for all surface drawings. Anyone find a solution?
|
|
|
|

|
hello,
is it possible to rotate the graph by pressing the button to a certain possition?
for example, i want to rotate the graph by pressing a button called "xy" in a view that only shows the 2d surface (xy)
tia
Harald
|
|
|
|

|
sure you can do it with concept of windowing for that use command gluOrtho2d(define the windowsize);
aaaa
|
|
|
|

|
Hello!
Can someone help to me?
I need to make a surface from 2D data array containing the integer or double data.
I'm using this code:
////////////////////////////
void CDemoDlg::OnButton3()
{
m_Graph3D.ClearGraph();
m_Graph3D.SetCaption("Histogram");
double data,t[40];
double ar[50][255];
for(int ar_x=0;ar_x<50;ar_x++)
{
/* if(ar_x>20)
for(int ar_y=0;ar_y<255;ar_y++)
{
if(ar_y<127)
ar[ar_x][ar_y] = ar_y + rand()%3;
if(ar_y>=127)
ar[ar_x][ar_y] = 255-ar_y + rand()%3;
}
if(ar_x<=20)
*/ int ampl = (rand()%6+rand()%6+rand()%6)/3;
for(int ar_y=0;ar_y<255;ar_y++)
{
// if(ar_y<120)
ar[ar_x][ar_y] = sin(3.14*ar_y*(20+rand()%2))*ampl;
if(ar[ar_x][ar_y]<0)
ar[ar_x][ar_y]=0;
// if(ar_y>=120)
// ar[ar_x][ar_y] = sin(3.14*ar_y)*10;;
}
}
for (int i = 0; i < 50; i++)
for (int j = 0; j < 255; j++)
{
data = ar[i][j];//8 * exp(-(t[i] * t[i] + t[j] * t[j]) / 4);
m_Graph3D.AddElement();
m_Graph3D.SetElementType(i,2);
m_Graph3D.SetElementPointColor(i, RGB(0,0,100));
m_Graph3D.SetElementLineColor(i, RGB(200,50,50));
m_Graph3D.SetElementPointSize(i, 2.3);
m_Graph3D.PlotXYZ(j,data,i,i);
// m_Graph3D.SetElementType(j, 3);
}
m_Graph3D.AutoRange();
}
///////////////////////////////////
How to make the surface from this data array?
regards,
Georgi
|
|
|
|

|
Hi Friend,
this control is realy cool
|
|
|
|

|
Hey ,
I found this nice pice of software. And start to try it out,
but my problem is, that i can't register the ntgraph3d.dll to my windows 2000 system
I had read the 2d ActiveX description, for registration, but I can't solve the problem.
If I go to the folder in a command window and type regsvr32 ntgraph3d.dll
I got a windows messagebox with following message:
DllRegisterServer in ntgraph3d.dll failed.
Return code was 0x80040154
Anybody have an idea for this problem.
Best regardes
Eng
PS: Forgot: I use Visual Studio .Net 2003
|
|
|
|
|
|

|
If you ever come across a .DLL that refuses to register (i.e. regsvr32 only says registration failed), use the depends.exe utility (in your VC++ tools) to see what DLLs the problem DLL needs. The case usually is that the problem DLL needs a DLL which for some reason cannot be loaded.
/Rob
|
|
|
|

|
@ Rob
Thanks for that idea.;)
Eng
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
An ATL/STL ActiveX control based on OpenGL library for 3D data visualization
| Type | Article |
| Licence | |
| First Posted | 15 Jun 2003 |
| Views | 433,490 |
| Bookmarked | 256 times |
|
|