PDA

View Full Version : about wglgetprocaddress()????



arrowpig
03-01-2004, 08:04 PM
I am sure that my graphics card(geforce4 mX)supports multitexture,and i use glMultiTexCoord2iARB=PFNGLMULTITEXCOORD2IARBPROC)w glGetProcAddress("glMultiTexCoord2iARB")in a mfc project ,i get the right address,but i download a program from nVidia corp.which is a win32 console style,the same call wglGetProcAddress,which returns NULL,under DEBUG.Why?

arrowpig
03-01-2004, 08:43 PM
here i add more information!!

under DEBUG
1)the correct situation should be:
PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB;
//now glMultiTexCoord2iARB=0xcccccccc
glMultiTexCoord2iARB =(PFNGLMULTITEXCOORD2IARBPROC)wglGetProcAddress("glMultiTexCoord2iARB");
//now get the correct address!
2)the wrong situation is :
PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB;
//now glMultiTexCoord2iARB=some address (not 0xcccccccc)

glMultiTexCoord2iARB =(PFNGLMULTITEXCOORD2IARBPROC)wglGetProcAddress("glMultiTexCoord2iARB");
//now glMultiTexCoord2iARB=0x00000000

kehziah
03-02-2004, 12:45 PM
Originally posted by arrowpig:
here i add more information!!

under DEBUG
1)the correct situation should be:
PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB;
//now glMultiTexCoord2iARB=0xcccccccc
glMultiTexCoord2iARB =(PFNGLMULTITEXCOORD2IARBPROC)wglGetProcAddress("glMultiTexCoord2iARB");
//now get the correct address!
2)the wrong situation is :
PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB;
//now glMultiTexCoord2iARB=some address (not 0xcccccccc)

glMultiTexCoord2iARB =(PFNGLMULTITEXCOORD2IARBPROC)wglGetProcAddress("glMultiTexCoord2iARB");
//now glMultiTexCoord2iARB=0x00000000



seems like there is no rendering context when you try to load the function pointer.
From MSDN
When no current rendering context exists or the function fails, the return value is NULL. To get extended error information, call GetLastError.

btw : this thread should go in beginner or windows specific forum

[This message has been edited by kehziah (edited 03-02-2004).]

arrowpig
03-02-2004, 05:08 PM
Thanks, kehziah.i think the context has been created.
I copy the codes here:
PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB;
glutInitWindowSize(800, 600);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_ALPHA);
glutCreateWindow("Normal Perturbation Mapping");
glMultiTexCoord2iARB =(PFNGLMULTITEXCOORD2IARBPROC)wglGetProcAddress("glMultiTexCoord2iARB");
//////////////

rgpc
03-02-2004, 07:20 PM
As kehziah said, this should be in the beginners forum.

Check glGetString(GL_VENDOR) to make sure you are running with the nvgl rather than MS's one.




PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB;
//now glMultiTexCoord2iARB=some address (not 0xcccccccc)


The value of a newly created pointer/variable which has not been initialized is always going to be crap. It's generally going to be whatever happens to be in the memory that the variable occupies when it is created - except (I think) in some debuggers where it might set it to an arbitrary value like "0xCCCCCCCC". So looking at the value immediately after creation is pointless. You should have something like...




PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB = NULL;

arrowpig
03-04-2004, 07:07 PM
hi,rgpc,yes ,you are right.
glGetString(GL_VENDOR) return "Microsoft Corp."
But Why?
1)two different program running on the same PC,call the same glGetString(after opengl context created!),oen returns "NVIDIA Corp."
the other returns "microsoft corp."
2)this morning,i copied the the program which returns"microsoft corp." to another PC,and glGetString(GL_VENDOR) returns "NVIDIA".

Now i am confused!could you help me,Please?