[fpc-pascal] GLext in Free Pascal does not work?

Michalis Kamburelis michalis.kambi at gmail.com
Thu Feb 21 00:10:05 CET 2008


Jakub Marian wrote:
> Hello, I've been trying to solve the problem with the unit GLext for some
> time and I am getting mad. I need to use vertex shaders written in GLSL, but
> I am a novice in that field so I may be doing domething wrong. I have glext
> in my "uses". I tried just to call glCreateProgramObjectARB but I've got
> access violation in my program. So I looked into source of glext and there
> are some functions which look like I could use them. So I tried
> glext_LoadExtension('GL_version_1_4'). Same problem - access violation. So I
> tried glext_ExtensionSupported with some parameters. Access violation. I am
> really getting mad, I have no idea what to do. 
> 
> I am really opened to any suggestions :-)
> 

glCreateProgramObjectARB is part of GL_ARB_shader_objects extension (see 
OpenGL extension registry on opengl.org). So what you want to call is
   Load_GL_ARB_shader_objects
or (equivalent)
   glext_LoadExtension('GL_ARB_shader_objects')
They both return boolean value, if true --- then your OpenGL supports 
this extension, and glCreateProgramObjectARB entry point is initialized 
to non-nil and you can call it without any access violations.

glext_LoadExtension('GL_version_1_4') loads OpenGL features that are 
standard in OpenGL 1.4, this has nothing to do with 
glCreateProgramObjectARB ("ARB" suffix says this is an extension).

OpenGL 2.0 introduced shaders as standard, so you may want to call 
Load_GL_version_2_0 and then use glCreateProgram instead of 
glCreateProgramObjectARB. But for now, using extension is a little safer 
(more chance that given OpenGL implementation will support it).

Oh, and if you have downloaded my engine mentioned in previous mail --- 
see kambi_vrml_game_engine/opengl/glshaders.pas, this is my unit for 
handling OpenGL shaders, see TGLSLProgram class.

Michalis



More information about the fpc-pascal mailing list