PDA

View Full Version : Help:about VBO on GeForce3



foollove
04-11-2003, 05:10 PM
Hi,everyone,
I updated my driver to 43.45 which OpenGL is updated from 1.2 to 1.4.
But when I use wglGetProcAddress to retrieve the Function of VBO, they all return NULL. Can someone tell me why?

And when I come back to VAR, it doesn't work either. I am confused about these problems.
My card is GeForce3/AGP/3DNow!
Thanks a lot.

And can somebody provide a completely solution to such kind of problem with a simple example?
Thanks again.

[This message has been edited by foollove (edited 04-11-2003).]

jra101
04-11-2003, 05:12 PM
Call glGetString(GL_VENDOR) to make sure you are not getting a Microsoft pixelformat.

foollove
04-11-2003, 05:25 PM
The result is as follows:
Vendor=
NVIDIA Corporation
Renderer=
GeForce3/AGP/3DNOW!
Version=
1.4.0
Extension=
.....(I don't find any string about VBO)

Thanks for your attention.
http://www.opengl.org/discussion_boards/ubb/frown.gif

[This message has been edited by foollove (edited 04-11-2003).]

AndrewM
04-11-2003, 06:52 PM
Originally posted by foollove:
.....(I don't find any string about VBO)



You won't find it.

jra101
04-11-2003, 06:53 PM
Can you post the code you are using to retrieve the function pointers for VBO?

foollove
04-11-2003, 07:01 PM
an example from this forum which I can not find out the problem:
int IsExtensionSupported(const char *extension)
{
const char *extensions=NULL, *start, *where, *terminator;
where=strchr(extension, ' ');
if(where| |*extension=='\0')
return 0;

extensions=(const char *)glGetString(GL_EXTENSIONS);
start=extensions;

for(; ;)
{
where=strstr(start, extension);

if(!where)
break;

terminator=where+strlen(extension);

if(where==start| |*(where-1)==' ')
if(*terminator==' '| |*terminator=='\0')
return 1;

start=terminator;
}

extensions=NULL;

if(wglGetExtensionsStringARB==NULL)
wglGetExtensionsStringARB=(PFNWGLGETEXTENSIONSSTRI NGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");

if(wglGetExtensionsStringARB==NULL)
return 0;

where=strchr(extension, ' ');

if(where| |*extension=='\0')
return 0;

extensions=wglGetExtensionsStringARB(wglGetCurrent DC());
start=extensions;

for(; ;)
{
where=strstr(start, extension);

if(!where)
break;

terminator=where+strlen(extension);

if(where==start| |*(where-1)==' ')
if(*terminator==' '| |*terminator=='\0')
return 1;

start=terminator;
}

return 0;
}

Then,
glBindBufferARB=(PFNGLBINDBUFFERARBPROC)wglGetProc Address("glBindBufferARB");

Thanks all of you.



[This message has been edited by foollove (edited 04-11-2003).]

foollove
04-11-2003, 07:18 PM
I can not find VBO extension by the above method.
Whether it is not availabe on GeForce3 even with 43.45 driver http://www.opengl.org/discussion_boards/ubb/frown.gif

jra101
04-11-2003, 08:07 PM
Can you try running this demo?

www.cfxweb.net/~delphigl/files/simple_vbo.zip (http://www.cfxweb.net/~delphigl/files/simple_vbo.zip)

The binary is in DEMOS/OpenGL/bin/debug and the source is in DEMOS/OpenGL/src/simple_vbo.

Coriolis
04-11-2003, 08:40 PM
You could always open system32/nvoglnt.dll (or whatever it is called on your system if you aren't using XP / 2K) in a hex editor and search for the function names. The DLL has to store the name of the function inside itself for it to know what function to return when you pass a string into it. If it is not there, then you know that you have the wrong drivers. If it is there, you know your code is doing something wrong.

foollove
04-12-2003, 05:26 PM
Yeah, I have resolved this problem with your help. Thanks a lot.
I find if I query the extension of VBO, they all return NULL. So I have to directly wglGetProcAddress the functions and include the latest head file "glext.h".That's OK http://www.opengl.org/discussion_boards/ubb/smile.gif

But another problem here,I can not use multitexture as what I use in VAR.
void InitVBOTest()
{

float *data = new float[CtrlNum*MeshNum*8];--->each one includes vertex position, normal, 2d texture coordinates.
UpdateVARData(data);--->generate data

//////Index
glGenBuffersARB(1, &index_buffer);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, index_buffer);
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, (CtrlNum-1)*2*(MeshNum+1) * sizeof(GLuint), MeshStripIndex, GL_STATIC_DRAW_ARB);

glGenBuffersARB(1, &static_vertex_buffer);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, static_vertex_buffer);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, CtrlNum*MeshNum * 8 * sizeof(GLfloat), data, GL_STATIC_DRAW_ARB);

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer ( 3, GL_FLOAT, 8 * sizeof(GLfloat), BUFFER_OFFSET(0) );
glNormalPointer(GL_FLOAT,8 * sizeof(GLfloat), BUFFER_OFFSET(3));

////////Mutitexture here glClientActiveTextureARB( GL_TEXTURE0_ARB );
glEnableClientState(GL_TEXTURE_COORD_ARRAY );
glTexCoordPointer(2, GL_FLOAT, 8 * sizeof(GLfloat), BUFFER_OFFSET(6));

glClientActiveTextureARB( GL_TEXTURE1_ARB );
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
glTexCoordPointer(2, GL_FLOAT, 8 * sizeof(GLfloat), BUFFER_OFFSET(6));

//Tex1
glActiveTextureARB ( GL_TEXTURE0_ARB );
glEnable( GL_TEXTURE_2D );
glBindTexture(GL_TEXTURE_2D, SunTexNo );
//Tex2
glActiveTextureARB ( GL_TEXTURE1_ARB );
glEnable( GL_TEXTURE_2D );
glBindTexture(GL_TEXTURE_2D, SkyTexNo);
}

void VBORender()
{
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, index_buffer);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, static_vertex_buffer);
glDrawElements(GL_QUAD_STRIP, (CtrlNum-1)*2*(MeshNum+1), GL_UNSIGNED_INT, 0);
}

Can someone pick out the problem, thanks again. http://www.opengl.org/discussion_boards/ubb/smile.gif

[This message has been edited by foollove (edited 04-12-2003).]

foollove
04-12-2003, 08:11 PM
Nobody encounter such kind of problem? http://www.opengl.org/discussion_boards/ubb/frown.gif

jra101
04-12-2003, 08:41 PM
Where is your texture coordinate data stored? From your code you are telling the driver that the texture coordinates are stored in the same buffer as your vertices, and that they start 6 bytes into the vertices array.

SThomas
04-12-2003, 09:52 PM
you have to remember that the last parameter to gl*Pointer() is a byte offset when using vertex buffers. so

glNormalPointer(GL_FLOAT,8 * sizeof(GLfloat), BUFFER_OFFSET(3));

should be



glNormalPointer(GL_FLOAT,8 * sizeof(GLfloat), BUFFER_OFFSET(3*sizeof(GLfloat)));

and similarly for the other gl*Pointer calls.

also, i don't know if the glClientActiveTexture() call below is actually commented out in your code, or if there was just a formatting problem when you put it on the message board. but i assume you want the call in there.



////////Mutitexture here glClientActiveTextureARB( GL_TEXTURE0_ARB );

foollove
04-12-2003, 10:48 PM
To SThomas & jra101,
thank a lot. You have found the problem for me. http://www.opengl.org/discussion_boards/ubb/smile.gif
The texture coordinates are stored with vertex coordinates together. So we must pay attention to the offset of them in the array.
SThomas has noticed the problem.

#define BUFFER_OFFSET(i) ((char*)NULL +(i)*sizeof(float))
instead of
#define BUFFER_OFFSET(i) ((char*)NULL +(i))--->wrong

When programing, I often encounter all kinds of problems. But fortunately I meet many friends here. http://www.opengl.org/discussion_boards/ubb/smile.gif