|
我自己定义了一个Mesh类,定义如下:
#include "Mesh.h" 其中包括了glext.h和wglext.h
#include "Scene.h"
编译的错误总是说我类型转换的问题,请高手指教?
PFNGLBINDBUFFERARBPROC glBindBufferARB = NULL;
PFNGLBINDBUFFERARBPROC glGenBuffersARB = NULL;
PFNGLBINDBUFFERARBPROC glBufferDataARB = NULL;
PFNGLBINDBUFFERARBPROC glDeleteBuffersARB = NULL;
bool LVBO_mesh::InitGL()
{
glGenBuffersARB = (PFNGLGENBUFFERSARBPROC) wglGetProcAddress("glGenBuffersARB");
glBufferDataARB = (PFNGLBUFFERDATAARBPROC) wglGetProcAddress("glBufferDataARB");
glBindBufferARB = (PFNGLBINDBUFFERARBPROC) wglGetProcAddress("glBindBufferARB");
glGenBuffersARB(1, &_VBOv);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _VBOv);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, _vertnum * sizeof(float) * 3, _vert, GL_STATIC_DRAW_ARB);
glGenBuffersARB(1, &_VBOn);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _VBOn);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, _vertnum * sizeof(float) * 3, _normal, GL_STATIC_DRAW_ARB);
glGenBuffersARB(1, &_VBOt);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _VBOt);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, _vertnum * sizeof(float) * 2, _tvvert, GL_STATIC_DRAW_ARB);
return true;
}
/************************************************************************/
/* 采用VBO模式绘制下的析构函数 */
/************************************************************************/
LVBO_mesh::~LVBO_mesh ()
{
glDeleteBuffersARB = (PFNGLBINDBUFFERARBPROC) wglGetProcAddress("glDeleteBuffersARB");
glDeleteBuffersARB(1, &_VBOv);
glDeleteBuffersARB(1, &_VBOn);
glDeleteBuffersARB(1, &_VBOt);
}
/************************************************************************/
/* 采用VBO模式绘制 */
/************************************************************************/
void LVBO_mesh :: Display()
{
switch(rstate)
{
case RENDER_FACE:
glPolygonMode(GL_FRONT, GL_FILL);
_mat->SetGL();
break;
case RENDER_EDGE:
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glPolygonMode(GL_FRONT, GL_LINE);
glColor3f(0.8f, 0.8f, 0.8f);
break;
}
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _VBOv);
glVertexPointer(3, GL_FLOAT, 0, _vert);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _VBOn);
glNormalPointer(GL_FLOAT, 0, _normal);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _VBOt);
glTexCoordPointer(2, GL_FLOAT, 0, _tvvert);
glDrawElements (GL_TRIANGLES, _facenum * 3, GL_UNSIGNED_INT, _faces);
GLERR();
}
编译总是报这几个扩展函数出错?请教?为什么?
Deleting intermediate files and output files for project 'Large - Win32 Debug'.
--------------------Configuration: Large - Win32 Debug--------------------
Compiling...
MainFrame.cpp
Map.cpp
Camera.cpp
Mesh.cpp
f:\code\large\mesh.cpp(123) : error C2440: '=' : cannot convert from 'void (__stdcall *)(int,unsigned int *)' to 'void (__stdcall *)(unsigned int,unsigned int)'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
f:\code\large\mesh.cpp(124) : error C2440: '=' : cannot convert from 'void (__stdcall *)(unsigned int,int,const void *,unsigned int)' to 'void (__stdcall *)(unsigned int,unsigned int)'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
f:\code\large\mesh.cpp(127) : error C2664: 'void (unsigned int,unsigned int)' : cannot convert parameter 2 from 'unsigned int *' to 'unsigned int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
f:\code\large\mesh.cpp(129) : error C2197: 'void (__stdcall *)(unsigned int,unsigned int)' : too many actual parameters
f:\code\large\mesh.cpp(131) : error C2664: 'void (unsigned int,unsigned int)' : cannot convert parameter 2 from 'unsigned int *' to 'unsigned int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
f:\code\large\mesh.cpp(133) : error C2197: 'void (__stdcall *)(unsigned int,unsigned int)' : too many actual parameters
f:\code\large\mesh.cpp(135) : error C2664: 'void (unsigned int,unsigned int)' : cannot convert parameter 2 from 'unsigned int *' to 'unsigned int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
f:\code\large\mesh.cpp(137) : error C2197: 'void (__stdcall *)(unsigned int,unsigned int)' : too many actual parameters
f:\code\large\mesh.cpp(148) : error C2664: 'void (unsigned int,unsigned int)' : cannot convert parameter 2 from 'unsigned int *' to 'unsigned int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
f:\code\large\mesh.cpp(149) : error C2664: 'void (unsigned int,unsigned int)' : cannot convert parameter 2 from 'unsigned int *' to 'unsigned int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
f:\code\large\mesh.cpp(150) : error C2664: 'void (unsigned int,unsigned int)' : cannot convert parameter 2 from 'unsigned int *' to 'unsigned int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Scene.cpp
Error executing cl.exe.
Creating browse info file...
Large.exe - 11 error(s), 0 warning(s)
|
|