Skip to main content
gamedev.net
🔒 Locked

Loading Extensions

Started by tjrr3d Apr 24, 2006 at 7:00 PM 2 replies 1.6k views
Original Post
tjrr3d
tjrr3d
I'm trying to use the point sprite extention for a particle system which works great in windows, but my instructor wants it to be in Linux. (fun fun!) I don't thing I'm loading the functions correctly. This is what I have, forgive me if its horribly wrong.

#include <dlfcn.h>

int (*glPointParameterfARB)(GLenum, const GLfloat);
int (*glPointParameterfvARB)(GLenum, const GLfloat*);

void *libHandle = dlopen("libgl.so", RTD_LAZY);

glPointParameterfARB)(GLenum, const GLfloat)dlsym(libHandle, "glPointParameterfARB");

glPointParameterfvARB)(GLenum, const GLfloat*)dlsym(libHandle, "glPointParameterfvARB");

then my calls are
float quadric[] = {1.0f, 0.0f, 0.01f};
(*glPointParameterfvARB)(GL_POINT_DISTANCE_ATTENUATION_ARB, quadric);
(*glPointParameterfARB)(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 60.0f);
(*glPointParameterfARB)(GL_POINT_SIZE_MAX_ARB, 5.0f);
(*glPointParameterfARB)(GL_Point_SIZE_MIN_ARB, 1.0f);




I get a segmentation fault everytime. If anyone knows of any other way to load extensions in linux please let me know. As of right know, I need to figure out why this doesn't work.
Cocalus
Cocalus
The simple solution is just to use GLEW and have it handle the extensions (and then you can use the same extension code in windows and linux)
deavik
deavik
Quote:
Original post by tjrr3d
I'm trying to use the point sprite extention for a particle system which works great in windows, but my instructor wants it to be in Linux. (fun fun!) I don't thing I'm loading the functions correctly. This is what I have, forgive me if its horribly wrong.

*** Source Snippet Removed ***

I get a segmentation fault everytime. If anyone knows of any other way to load extensions in linux please let me know. As of right know, I need to figure out why this doesn't work.

Use glXGetProcAddressARB. eg.

#include
#include
#define GLX_GLXEXT_LEGACY
#include

PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC) glXGetProcAddressARB((const GLubyte*) "glPointParameterfARB");


Also, I don't what you're using to link (unfamiliar with it), but since you have "libgl.so" in there it's worth pointing out that it's "libGL.so", ie. "GL" is in capital letters.
nefthy
nefthy
first you are missig the assignment operator when calling dlsym:
glPointParameterfARB = (int (*)(GLenum, const GLfloat)) dlsym(libHandle, "glPointParameterfARB");


you can also call function the way you normaly do (no need for (*...))i.e.
glPointParameterfARB(GL_POINT_DISTANCE_ATTENUATION_ARB,quadric);


but as deavik said use glXGetProcAddressARB

Topic Locked

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

Sign in to reply to this topic.