Vertex fload and opengl
Hy.
I have a struct object VERTEX vertex1 ,where VERTEX struct is :
struct VERTEX
{
const GLfloat* val[];
};
and i would to draw without specify x,y and z as property,i simply pass::
glVertex3fv(vertex1);
but i catch this error:
c:\programmazione\vcopengl\3dprojectgiugio\3dprojectgiugio\polygon.cpp(34) : error C2664: 'glVertex3fv' : cannot convert parameter 1 from 'const GLfloat *(*__w64 )[]' to 'const GLfloat *'
How pass VERTEX type as parameter?
thanks
Are we talking about C or C++?
I think C++....
Now it should work.
regards...
I think C++....
struct VERTEX{ operator GLfloat*() { return val; } const GLfloat* val;};
Now it should work.
regards...
"const GLfloat* val[]" is the same as "const GLfloat** val;". glVertex3fv takes a GLfloat* as a parameter. For your VERTEX type to work, do something like :
struct VERTEX{const GLfloat val[];};
thanks , but i catch this error:
Error 3 error C2664: 'glVertex3fv' : cannot convert parameter 1 from 'const GLfloat (*__w64 )[]' to 'const GLfloat *' c:\progetto\graphlib\graphlib\polygon.cpp 35
but this work:
struct VERTEX
{
const GLfloat val;
};
but i dont have 3 parameters , so only one!
Error 3 error C2664: 'glVertex3fv' : cannot convert parameter 1 from 'const GLfloat (*__w64 )[]' to 'const GLfloat *' c:\progetto\graphlib\graphlib\polygon.cpp 35
but this work:
struct VERTEX
{
const GLfloat val;
};
but i dont have 3 parameters , so only one!
i have disabilited the compile option for the 64 bit compatibility bu i catch always thi error:
Error 5 error C2664: 'glVertex3fv' : cannot convert parameter 1 from 'const GLfloat (*)[]' to 'const GLfloat *' c:\progetto\graphlib\graphlib\polygon.cpp 31
why?
Error 5 error C2664: 'glVertex3fv' : cannot convert parameter 1 from 'const GLfloat (*)[]' to 'const GLfloat *' c:\progetto\graphlib\graphlib\polygon.cpp 31
why?
Quote:Original post by giugioWhat is wrong with this?struct VERTEX{const GLfloat val;};
but i dont have 3 parameters , so only one!
struct VERTEX{const GLfloat val[3];};
whith this i catch this error:
Error 4 error C2664: 'glVertex3fv' : cannot convert parameter 1 from 'const GLfloat (*)[3]' to 'const GLfloat *' c:\progetto\graphlib\graphlib\polygon.cpp 31
this is the code:
glVertex3fv(&m_vertexs[0].val);
where m_vertexs is a
VERTEX * m_vertexs;
Error 4 error C2664: 'glVertex3fv' : cannot convert parameter 1 from 'const GLfloat (*)[3]' to 'const GLfloat *' c:\progetto\graphlib\graphlib\polygon.cpp 31
this is the code:
glVertex3fv(&m_vertexs[0].val);
where m_vertexs is a
VERTEX * m_vertexs;
Just pass "m_vertexs[0].val". The array will decay to a pointer to the first element. Passing &array is passing a pointer to an array, which is a different beast entirely (which is what your compiler is warning you about).
thanks a lot.
if i understand:
1)&m_vertexs[0].val
2)m_vertexs[0].val
1)is the address of the array 0 of elements
2)is the address of the first element of the array 0 of elements?
thanks
if i understand:
1)&m_vertexs[0].val
2)m_vertexs[0].val
1)is the address of the array 0 of elements
2)is the address of the first element of the array 0 of elements?
thanks
Quote:Original post by giugio
thanks a lot.
if i understand:
1)&m_vertexs[0].val
2)m_vertexs[0].val
1)is the address of the array 0 of elements
2)is the address of the first element of the array 0 of elements?
thanks
THose two statements are going to spit out the same memory address.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement