Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gauche-glのWindows版の実行エラー2のパッチ(2015-6-13)(2015-6-14修正)
--- example9-4_orig.scm 2014-12-29 21:55:10 +0900
+++ example9-4.scm 2015-06-14 21:03:17 +0900
@@ -80,6 +80,11 @@
(glut-init-window-size 250 250)
(glut-init-window-position 100 100)
(glut-create-window (car args))
+
+ ;; When using GLEW, 'glew-init' must be called after 'glut-create-window'
+ ;; to use OpenGL extensions such as 'gl-tex-image-3d'.
+ (glew-init)
+
(init)
(glut-display-func disp)
(glut-reshape-func reshape)
--- glut-lib_orig.stub 2014-12-29 21:55:10 +0900
+++ glut-lib.stub 2015-06-14 20:58:07 +0900
@@ -57,12 +57,21 @@
(when (< argc 0) (SCM_TYPE_ERROR args "list"))
(set! argv (Scm_ListToCStringArray args TRUE NULL))
(glutInit (& argc) argv)
- (.if "defined(HAVE_GL_GLEW_H)"
- (let* ([r::GLenum (glewInit)])
- (unless (!= r GLEW_OK)
- (Scm_Error "Initializing GLEW failed."))))
+ ;; When using GLEW, 'glewInit' must be called after 'glutCreateWindow'
+ ;; to use OpenGL extensions such as 'glTexImage3D'.
+ ;; Thus, the following code was moved to a new procedure 'glew-init'.
+ ;(.if "defined(HAVE_GL_GLEW_H)"
+ ; (let* ([r::GLenum (glewInit)])
+ ; (if (!= r GLEW_OK)
+ ; (Scm_Error "Initializing GLEW failed."))))
(result (Scm_CStringArrayToList (cast (const char**) argv) argc 0))))
+(define-cproc glew-init () ::<void>
+ (.if "defined(HAVE_GL_GLEW_H)"
+ (let* ([r::GLenum (glewInit)])
+ (if (!= r GLEW_OK)
+ (Scm_Error "Initializing GLEW failed.")))))
+
(define-cproc glut-init-display-mode (mode::<fixnum>)
::<void> glutInitDisplayMode)
--- ogl2brick_orig.scm 2014-12-29 21:55:10 +0900
+++ ogl2brick.scm 2015-06-14 21:03:10 +0900
@@ -380,6 +380,10 @@
(glut-init-window-size 500 500)
(let* ((window (glut-create-window "3Dlabs Brick Shader")))
+ ;; When using GLEW, 'glew-init' must be called after 'glut-create-window'
+ ;; to use OpenGL extensions such as 'gl-create-shader-object-arb'.
+ (glew-init)
+
(unless (gl-extension-available? 'GL_ARB_shader_objects
'GL_ARB_fragment_shader
'GL_ARB_vertex_shader
--- ogl2particle_orig.scm 2014-12-29 21:55:10 +0900
+++ ogl2particle.scm 2015-06-14 21:03:31 +0900
@@ -407,6 +407,10 @@
(let* ((window (glut-create-window
"3Dlabs OpenGL Shading Language Particle System Demo")))
+ ;; When using GLEW, 'glew-init' must be called after 'glut-create-window'
+ ;; to use OpenGL extensions such as 'gl-create-shader-object-arb'.
+ (glew-init)
+
(unless (gl-extension-available? 'GL_ARB_shader_objects
'GL_ARB_fragment_shader
'GL_ARB_vertex_shader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.