• Advertisement

Archived

This topic is now archived and is closed to further replies.

nv_vertex_array_range probs

This topic is 5753 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Huhu, I've got some trouble with getting the function pointer for wglFreeMemoryNV from the DLL under Win2k. The type is the following: typedef void (APIENTRY PFNWGLFREEMEMORYNV)(void *pointer); PFNWGLFREEMEMORYNV wglFreeMemoryNV; And the wglGetProcAddress line: wglFreeMemoryNV = (PFNWGLFREEMEMORYNV)wglGetProcAddress("wglFreeMemoryNV"); I get the error: error C2066: Typumwandlung in Funktionstyp nicht erlaubt (in english: "type cast in function type not allowed" or something like that) Another prob: What a type is "sizei"? It's used by VertexArrayRangeNV and wglAllocateMemoryNV. [edited by - The_Fallen on April 20, 2002 3:00:47 PM]

Share this post


Link to post
Share on other sites
Advertisement
How about

typedef void (APIENTRY* PFNWGLFREEMEMORYNV)(void *pointer);

sizei is a cross-platform define for 32-bit int, I believe.

Share this post


Link to post
Share on other sites
Argh, I'm so stupid...
Thx, now it works fine!

OK, problem solved, next problem:

Here is my method for creating the VAR:

  
void COpenGL::CreateVertexArray(CVertexArray *vaArray, int iCount)
{
vaScene = (CVertexArray*)m_ExtGL.wglAllocateMemoryNV(sizeof(vaArray) * iCount, 0, 0, 1);
memcpy(vaScene, vaArray, sizeof(vaArray) * iCount);
m_ExtGL.VertexArrayRangeNV(sizeof(vaArray) * iCount, vaScene);
glVertexPointer(3, GL_FLOAT, sizeof(CVertexArray), &vaScene->x);
glTexCoordPointer(2, GL_FLOAT, sizeof(CVertexArray), &vaScene->u);
}


vaScene is a pointer to CVertexArray and CVertexArray is a struct, that holds the vertex information. m_ExtGL is my class for wrapping the ogl extensions.
My game crashes while executing the VertexArrayRangeNV method. Any idea why?

[edited by - The_Fallen on April 20, 2002 4:59:41 PM]

[edited by - The_Fallen on April 20, 2002 5:00:39 PM]

Share this post


Link to post
Share on other sites
Maybe that''s because sizeof(vaArray) is the size of CVertexArray * which is 4 bytes rather than the size of CVertexArray? use sizeof(*vaArray).

Share this post


Link to post
Share on other sites
Are you sure vaScene isn''t NULL? And where exactly does it crash? What''s the exact error messsage?

Share this post


Link to post
Share on other sites
I initialize vaScene with NULL and test after wglAllocateMemoryNV, whether it''s still NULL and it is not!
It crashes while executing VertexArrayRangeNV. The error message is:
Hmm, perhaps you are right, it says:
"Die Anweising in 0x00000000 verweist auf Speicher in 0x00000000. Der Vorgang read konnte nicht auf dem Speicher durchgeführt werden."
In English: "The command in 0x00000000 points to memory in 0x0000000. The read command could not be executed in memory."
Any idea? Is he not able to allocate the memory?

Share this post


Link to post
Share on other sites
Did you assign the function pointer to glVertexArrayRangeNV() ? The error looks as if it was NULL. It's an extension command, so you have to initialize it with wglGetProcAddress("glVertexArrayRangeNV")


[edited by - Yann L on April 21, 2002 6:16:36 AM]

Share this post


Link to post
Share on other sites
Damn, I used:
VertexArrayRangeNV = (PFNVERTEXARRAYRANGENV)wglGetProcAddress("VertexArrayRangeNV");
That couldn''t work...
Thx a lot!

Share this post


Link to post
Share on other sites
quote:
Original post by The_Fallen
typedef void (APIENTRY PFNWGLFREEMEMORYNV)(void *pointer);
PFNWGLFREEMEMORYNV wglFreeMemoryNV;

And the wglGetProcAddress line:
wglFreeMemoryNV = (PFNWGLFREEMEMORYNV)wglGetProcAddress("wglFreeMemoryNV");


you have to define a pointer to a function:
typedef void APIENTRY (*PFNGLFREEMEMORYNV)(void*);

quote:
Original post by The_Fallen
Another prob:
What a type is "sizei"? It''s used by VertexArrayRangeNV and wglAllocateMemoryNV.



the ''real'' typename is GLsizei and is an integer describing the size of something. i think it is defined as int or unsigned int.

Share this post


Link to post
Share on other sites
How about

VertexArrayRangeNV = (PFNVERTEXARRAYRANGENV)wglGetProcAddress("glVertexArrayRangeNV");

Share this post


Link to post
Share on other sites
Yes, of course, that was the problem! I thought I''ve already said that it works now...
But again thx to IndirectX for helping a stupid idiot with this fu**ing problem!

Share this post


Link to post
Share on other sites

  • Advertisement