PDA

View Full Version : Linux: GLSL Crashed



Adler
02-06-2005, 06:59 AM
Hello,

I am working on my Diplomathesis. I wrote a bigger Application in GL with GLSL for WIN32, but I've to Export it to Linux.

If I use the glprocs.* from the GLSDK, I've got an Error Message and the programm halted. I tried different Extension Loaders like GLEW or GLFW but they crashed too!

My Enviroment:
Debian Linux 2.6.8-2-k7 i686 GNU/Linux (Sarge)
Grafic Device: RADEON 9800 SE Generic
GL Version String: 1.3.4769 (X4.3.0-8.8.25)
Driver: FireGL (fglrx 8,8,25-1)

I use the GL Headers from the ATI Drivers.

I wrote a simple BrickShader Code from the GLSL book with the Problem. I uploaded the Source and the binary on :

GLSL (http://wohnheim.fh-wedel.de/~simon/GLSL)

In that case I used GLEW (not included). The Programm crashed here with an Segmentation fault. With glprocs.c I've got an "Breakpoint Reached" Error (which I've never saw before).

I am VERY greatful for any Advice or Source!

Thanks a lot!

Adler

Peter_dup1
02-06-2005, 05:20 PM
I don't use GLEW, so I set up the function pointers myself, and it worked fine. I just declared the following at the top of brick.cpp (after the include);

PFNGLGETUNIFORMLOCATIONARBPROC _glGetUniformLocationARB = 0;
PFNGLGETOBJECTPARAMETERIVARBPROC _glGetObjectParameterivARB = 0;
PFNGLGETINFOLOGARBPROC _glGetInfoLogARB = 0;
PFNGLCREATESHADEROBJECTARBPROC _glCreateShaderObjectARB = 0;
PFNGLSHADERSOURCEARBPROC _glShaderSourceARB = 0;
PFNGLCOMPILESHADERARBPROC _glCompileShaderARB = 0;
PFNGLATTACHOBJECTARBPROC _glAttachObjectARB = 0;
PFNGLLINKPROGRAMARBPROC _glLinkProgramARB = 0;
PFNGLUSEPROGRAMOBJECTARBPROC _glUseProgramObjectARB = 0;
PFNGLUNIFORM2FARBPROC _glUniform2fARB = 0;
PFNGLUNIFORM3FARBPROC _glUniform3fARB = 0;
PFNGLCREATEPROGRAMOBJECTARBPROC _glCreateProgramObjectARB = 0;

then in the main function, added;

_glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) glXGetProcAddressARB((const GLubyte*) "glGetUniformLocationARB");
_glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) glXGetProcAddressARB((const GLubyte*) "glGetObjectParameterivARB");
_glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC) glXGetProcAddressARB((const GLubyte*) "glGetInfoLogARB");
_glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) glXGetProcAddressARB((const GLubyte*) "glCreateShaderObjectARB");
_glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) glXGetProcAddressARB((const GLubyte*) "glShaderSourceARB");
_glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) glXGetProcAddressARB((const GLubyte*) "glCompileShaderARB");
_glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) glXGetProcAddressARB((const GLubyte*) "glGetObjectParameterivARB");
_glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) glXGetProcAddressARB((const GLubyte*) "glCreateProgramObjectARB");
_glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) glXGetProcAddressARB((const GLubyte*) "glAttachObjectARB");
_glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) glXGetProcAddressARB((const GLubyte*) "glLinkProgramARB");
_glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) glXGetProcAddressARB((const GLubyte*) "glUseProgramObjectARB");
_glUniform2fARB = (PFNGLUNIFORM2FARBPROC) glXGetProcAddressARB((const GLubyte*) "glUniform2fARB");
_glUniform3fARB = (PFNGLUNIFORM3FARBPROC) glXGetProcAddressARB((const GLubyte*) "glUniform3fARB");

after the glutCreateWindow call. Of course, you have to put '_' in front of the function calls in the rest of the code so they use the pointers. Gives me a nice brick teapot!

Peter

Adler
02-07-2005, 02:15 AM
Originally posted by Peter:
[..]Gives me a nice brick teapot!
THANKS!!
Thats the way it works. You make my DAY!!

Adler