Skip to main content
gamedev.net
🔒 Locked

GLsync type

Started by zmg2b6 Jul 2, 2010 at 8:05 AM 2 replies 4k views
Original Post
zmg2b6
zmg2b6
This is from the gl3.h header file, I'm trying to get this into some C# code but I'm not sure what the C# equivalent of the GLsync type would be?

I'm not exactly sure what the C++ typedef for the GLsync type is actually doing, if someone could explain?

#ifndef ARB_synctypedef int64_t GLint64;typedef uint64_t GLuint64;typedef struct __GLsync *GLsync;#endif// GL_ARB_syncGLAPI GLboolean APIENTRY glIsSync (GLsync sync);GLAPI void APIENTRY glDeleteSync (GLsync sync);


Here is my equivalent delegate function in C#, right now I just have the GLsync type as a struct:

public delegate GLBoolean glIsSync(GLSync sync);
swiftcoder
swiftcoder
Quote:
Original post by zmg2b6
I'm not exactly sure what the C++ typedef for the GLsync type is actually doing, if someone could explain?
It is declaring GLsync to be a pointer to a struct.

I don't know what the C# equivalent would be, but I imagine that passing it a struct rather than a pointer is not quite right.
Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]
zmg2b6
zmg2b6
Ok great, I'll use the C# System.IntPtr type, and look in the docs for that extension to see what the struct layout is supposed to be.

I didn't realize you could define a struct like this and not define any fields for the struct? Is it done like this to be platform independant, so you're supposed to define the struct in your own implementation code?
swiftcoder
swiftcoder
Quote:
Original post by zmg2b6
I didn't realize you could define a struct like this and not define any fields for the struct? Is it done like this to be platform independant, so you're supposed to define the struct in your own implementation code?
You shouldn't ever have to deal with the struct layout - OpenGL will hand you a pointer, and you just store the pointer and pass it back to OpenGL.
Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.