Skip to content

Commit

Permalink
fixed crash of using glew at linux, STATIC link by including glew.c i…
Browse files Browse the repository at this point in the history
…nto GLee2glew.c
  • Loading branch information
ruanzongcai committed Oct 30, 2020
1 parent 2f89948 commit f94eab9
Show file tree
Hide file tree
Showing 10 changed files with 22,264 additions and 22,411 deletions.
2 changes: 1 addition & 1 deletion build.linux
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ cd v3d_main
sh ./build.redhat $*

cd ../

echo 'bin/vaa3d'

38 changes: 33 additions & 5 deletions v3d_main/3drenderer/GLee2glew.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Peng, H, Ruan, Z., Atasoy, D., and Sternson, S. (2010) Automatic reconstruction
/*
* GLee2glew.h
*
* Created by RuanZongcai on 2020-2-7.
* Created by Ruan Zongcai on 2020-2-7.
*
* Translate GLee to GLEW because glee had stopped updating for a long time.
*/
Expand All @@ -56,7 +56,34 @@ In the Qt part just call into the framework written OpenGL code through regular
Since the actual OpenGL code makes no references to Qt, then it doesn't have to include Qt headers, avoiding problems.
************************************************************************************************************/

#define GLEW_STATIC ////STATIC link by including glew.c

//@2020-5-10 RZC: for crash using glew & Qt4 at linux
//@2020-10-31 RZC: fixed crash by USING (glewExperimental=true) BEFORE glewInit() AT LINUX

#if 0// ! defined( USE_Qt5 )

#include <QtGui> ////for error: #error qdatastream.h must be included before any header file that defines Status
////STATIC link by including GLee_r.c into GLee2glew.c
#undef GL_ARB_vertex_buffer_object
#include "GLee_r.h"
#include <GL/glu.h> ////for error: ‘gluErrorString’ was not declared in this scope

#if ! (defined(_WIN32) || defined(_WIN64))// old EXT only for WINDOWS
#define glBlendEquationEXT glBlendEquation
#define glBlendColorEXT glBlendColor
#define glTexImage3DEXT glTexImage3D
#define glTexSubImage3DEXT glTexSubImage3D
//#define glGenBuffersARB glGenBuffers
//#define glBindBufferARB glBindBuffer
//#define glDeleteBuffersARB glDeleteBuffers
//#define glMapBufferARB glMapBuffer
//#define glUnmapBufferARB glUnmapBuffer
//#define glBufferDataARB glBufferData
#endif

#else

#define GLEW_STATIC ////STATIC link by including glew.c into GLee2glew.c
#include <glew/GL/glew.h>


Expand All @@ -67,7 +94,8 @@ Since the actual OpenGL code makes no references to Qt, then it doesn't have to
#define GLEE_VERSION_1_2 GLEW_VERSION_1_2

//#define GLeeInit() (glewInit())
#define GLeeInit glewInit
//// MUST USING (glewExperimental=true) BEFORE glewInit() AT LINUX
#define GLeeInit() ((glewExperimental=true) && (glewInit()==GLEW_OK))

#define GLEE_EXT_blend_minmax GLEW_EXT_blend_minmax
#define GLEE_EXT_blend_subtract GLEW_EXT_blend_subtract
Expand All @@ -94,5 +122,5 @@ Since the actual OpenGL code makes no references to Qt, then it doesn't have to
#define GLEE_EXT_gpu_shader4 GLEW_EXT_gpu_shader4



#endif //GLEE2GLEW_H_
#endif //USE_Qt5
#endif //GLEE2GLEW_H_
Loading

0 comments on commit f94eab9

Please sign in to comment.