void **p;//offcourse it only compiles :) glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER,p);//Ups->Illegal Operation, Oh my, what have you done ? //I also tryed float **=new float*[size];//where size can be whatever //->cannot convert from float ** to void **So far I saw that this is the only OpenGL func that needs GLvoid** params ! I`m in despair right now so if you can please help me. Thanks in advance
🔒 Locked
glGetPointerv
Advertisement
Original Post
I`m trying to use this function but with no succes it seems
glGetPointerv (GLenum pname, GLvoid* *params);
The only way it works is as follows->
You want a pointer, so define a pointer. Then pass the address of that pointer.
GLfloat *p;
glGetPointerv(GL_WHATEVER_ARRAY_POINTER, (GLvoid **)&p);
Well... it compiles flawlessly(it`s booleanic anyways) but when I try to retrieve data from the pointer... breakpoint and exception happens(offcourse).
//I allocate 100 pieces... although after
GLfloat *texels=new GLfloat[100];
glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER,(GLvoid**)&texels);//this fucntion
for(int y=0;y<100;y++)//the pointer points to 0x000000
{
GLfloat n=texels[y];//Illegal operation ,I`m trying to retreive data that doesn`t exist
}
}
Well, to begin with, you''re leaking memory. The block of memory you allocate is lost when glGetPointerv assigns a new value to texels. Just pass the address of the pointer, and let OpenGL set it''s value.
When glGetPointerv returns, texels points to the array passed to glTexCoordPointer. Is this pointer properly set?
When glGetPointerv returns, texels points to the array passed to glTexCoordPointer. Is this pointer properly set?
quote:
Original post by cippyboy
Well I generate texcoords with glTexGen and that`s why I want the texcoords to be taken out...
Then use the feedback buffer instead.
quote:
what would be the use of the function if you wore to get something you already have ?
Because sometimes you may not know where it is. Just because you set the pointer in one part of the program doesn't mean it's automatically available everywhere. You can query every state in OpenGL, so why should the vertex array pointers be an exception?
[edited by - Brother Bob on January 12, 2004 4:33:08 AM]
quote:
Original post by cippyboy
Well I generate texcoords with glTexGen and thats why I want the texcoords to be taken out... Im not passing any glTexCoordPointer... what would be the use of the function if you wore to get something you already have ?
What you are trying to do won''t work. You can only get data you set with gl*Pointer. If you use glTexGen texture coordinates are calculated when vertex is processed and ant before. Why not calculate tex coords by yourself (since you use glTexGen it''s usualy just a matrix multiplication)
You should never let your fears become the boundaries of your dreams.
Did you even try to search for some documentation on it? Clicky.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement