Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-02

GLext in Free Pascal does not work?

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jakub Marian

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 :-)

Thank you

Jakub Marian

View this message in context: http://www.nabble.com/GLext-in-Free-Pascal-does-not-work--tp15599350p15599350.html Sent from the Free Pascal - General mailing list .

Reply by email

Michalis Kamburelis
to Jakub Marian
Jakub Marian wrote 12 lines
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

Reply by email

Jakub Marian
to Michalis Kamburelis

Well, glext_LoadExtension('GL_version_1_4') was just an example, of course that I tried Load_GL_version_2_0 and some other functions. But I get "access violation" when I try to call ANY function from glext. I would understand it if I got just false as a return value of a function... But the program goes down with Access violation message written into command line window. For example if I call Load_GL_version_2_0, I get:

An unhandled exception occurred at $100279D9 :
EAccessViolation : Access violation
$100279D9
$0040769D

P.S. I will take a and decide if I can find the source of problem.

Tank you very much for your reply.

Jakub Marian

View this message in context: http://www.nabble.com/GLext-in-Free-Pascal-does-not-work--tp15599350p15601377.html Sent from the Free Pascal - General mailing list .

Reply by email

Michalis Kamburelis
to Jakub Marian
Jakub Marian wrote 12 lines
Well, glext_LoadExtension('GL_version_1_4') was just an example, of course that I tried Load_GL_version_2_0 and some other functions. But I get "access violation" when I try to call ANY function from glext. I would understand it if I got just false as a return value of a function... But the program goes down with Access violation message written into command line window. For example if I call Load_GL_version_2_0, I get: An unhandled exception occurred at $100279D9 : EAccessViolation : Access violation $100279D9 $0040769D

Ah, are you on x86_64 ? Then you're affected by
[http://bugs.freepascal.org/view.php?id=10508], it's fixed in SVN.

Michalis

Reply by email