mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
Eliminate GLP() macro (so we can write glEnable instead of GLP(Enable) again).
This commit is contained in:
parent
5a88e20894
commit
6454ddddc5
@ -405,8 +405,6 @@ get_extra_extensions() {
|
|||||||
// not defined.
|
// not defined.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void *AndroidGraphicsStateGuardian::
|
void *AndroidGraphicsStateGuardian::
|
||||||
do_get_extension_func(const char *prefix, const char *name) {
|
do_get_extension_func(const char *name) {
|
||||||
string fullname = string(prefix) + string(name);
|
return (void *)eglGetProcAddress(name);
|
||||||
|
|
||||||
return (void *)eglGetProcAddress(fullname.c_str());
|
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ protected:
|
|||||||
|
|
||||||
virtual void query_gl_version();
|
virtual void query_gl_version();
|
||||||
virtual void get_extra_extensions();
|
virtual void get_extra_extensions();
|
||||||
virtual void *do_get_extension_func(const char *prefix, const char *name);
|
virtual void *do_get_extension_func(const char *name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _egl_version_major, _egl_version_minor;
|
int _egl_version_major, _egl_version_minor;
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void query_gl_version();
|
virtual void query_gl_version();
|
||||||
virtual void *do_get_extension_func(const char *prefix, const char *name);
|
virtual void *do_get_extension_func(const char *name);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static TypeHandle get_class_type() {
|
static TypeHandle get_class_type() {
|
||||||
|
@ -276,10 +276,9 @@ query_gl_version() {
|
|||||||
// not defined.
|
// not defined.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void *CocoaGraphicsStateGuardian::
|
void *CocoaGraphicsStateGuardian::
|
||||||
do_get_extension_func(const char *prefix, const char *name) {
|
do_get_extension_func(const char *name) {
|
||||||
char* fullname = (char*) malloc(strlen(prefix) + strlen(name) + 2);
|
char* fullname = (char*) malloc(strlen(name) + 2);
|
||||||
strcpy(fullname + 1, prefix);
|
strcpy(fullname + 1, name);
|
||||||
strcpy(fullname + 1 + strlen(prefix), name);
|
|
||||||
fullname[0] = '_';
|
fullname[0] = '_';
|
||||||
|
|
||||||
// Believe it or not, but this is actually the
|
// Believe it or not, but this is actually the
|
||||||
@ -292,7 +291,7 @@ do_get_extension_func(const char *prefix, const char *name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cocoadisplay_cat.warning() <<
|
cocoadisplay_cat.warning() <<
|
||||||
"do_get_extension_func failed for " << prefix << name << "!\n";
|
"do_get_extension_func failed for " << fullname << "!\n";
|
||||||
|
|
||||||
free(fullname);
|
free(fullname);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -405,6 +405,13 @@ ConfigVariableBool framebuffer_stereo
|
|||||||
PRC_DESC("True if FM_stereo should be added to the default framebuffer "
|
PRC_DESC("True if FM_stereo should be added to the default framebuffer "
|
||||||
"properties, which requests a stereo-capable display, if "
|
"properties, which requests a stereo-capable display, if "
|
||||||
"supported by the graphics driver."));
|
"supported by the graphics driver."));
|
||||||
|
ConfigVariableBool framebuffer_srgb
|
||||||
|
("framebuffer-srgb", false,
|
||||||
|
PRC_DESC("Set this to request an sRGB framebuffer, which will "
|
||||||
|
"convert all values to linear space before blending. This "
|
||||||
|
"means that the output will be properly gamma-corrected, as "
|
||||||
|
"long as all the input textures are either converted from "
|
||||||
|
"original sRGB to linear or sRGB textures are used."));
|
||||||
|
|
||||||
ConfigVariableInt depth_bits
|
ConfigVariableInt depth_bits
|
||||||
("depth-bits", 0,
|
("depth-bits", 0,
|
||||||
|
@ -92,6 +92,7 @@ extern EXPCL_PANDA_DISPLAY ConfigVariableBool framebuffer_alpha;
|
|||||||
extern EXPCL_PANDA_DISPLAY ConfigVariableBool framebuffer_stencil;
|
extern EXPCL_PANDA_DISPLAY ConfigVariableBool framebuffer_stencil;
|
||||||
extern EXPCL_PANDA_DISPLAY ConfigVariableBool framebuffer_accum;
|
extern EXPCL_PANDA_DISPLAY ConfigVariableBool framebuffer_accum;
|
||||||
extern EXPCL_PANDA_DISPLAY ConfigVariableBool framebuffer_stereo;
|
extern EXPCL_PANDA_DISPLAY ConfigVariableBool framebuffer_stereo;
|
||||||
|
extern EXPCL_PANDA_DISPLAY ConfigVariableBool framebuffer_srgb;
|
||||||
extern EXPCL_PANDA_DISPLAY ConfigVariableInt depth_bits;
|
extern EXPCL_PANDA_DISPLAY ConfigVariableInt depth_bits;
|
||||||
extern EXPCL_PANDA_DISPLAY ConfigVariableInt color_bits;
|
extern EXPCL_PANDA_DISPLAY ConfigVariableInt color_bits;
|
||||||
extern EXPCL_PANDA_DISPLAY ConfigVariableInt alpha_bits;
|
extern EXPCL_PANDA_DISPLAY ConfigVariableInt alpha_bits;
|
||||||
|
@ -390,8 +390,6 @@ get_extra_extensions() {
|
|||||||
// not defined.
|
// not defined.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void *eglGraphicsStateGuardian::
|
void *eglGraphicsStateGuardian::
|
||||||
do_get_extension_func(const char *prefix, const char *name) {
|
do_get_extension_func(const char *name) {
|
||||||
string fullname = string(prefix) + string(name);
|
return (void *)eglGetProcAddress(name);
|
||||||
|
|
||||||
return (void *)eglGetProcAddress(fullname.c_str());
|
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ protected:
|
|||||||
|
|
||||||
virtual void query_gl_version();
|
virtual void query_gl_version();
|
||||||
virtual void get_extra_extensions();
|
virtual void get_extra_extensions();
|
||||||
virtual void *do_get_extension_func(const char *prefix, const char *name);
|
virtual void *do_get_extension_func(const char *name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _egl_version_major, _egl_version_minor;
|
int _egl_version_major, _egl_version_minor;
|
||||||
|
@ -46,7 +46,7 @@ get_display_list(GLuint &index, const CLP(GeomMunger) *munger,
|
|||||||
DisplayList &dl = _display_lists[(CLP(GeomMunger) *)munger];
|
DisplayList &dl = _display_lists[(CLP(GeomMunger) *)munger];
|
||||||
bool list_current = (dl._modified == modified);
|
bool list_current = (dl._modified == modified);
|
||||||
if (dl._index == 0) {
|
if (dl._index == 0) {
|
||||||
dl._index = GLP(GenLists)(1);
|
dl._index = glGenLists(1);
|
||||||
list_current = false;
|
list_current = false;
|
||||||
if (munger != (CLP(GeomMunger) *)NULL) {
|
if (munger != (CLP(GeomMunger) *)NULL) {
|
||||||
((CLP(GeomMunger) *)munger)->_geom_contexts.insert(this);
|
((CLP(GeomMunger) *)munger)->_geom_contexts.insert(this);
|
||||||
@ -87,7 +87,7 @@ release_display_lists() {
|
|||||||
GLCAT.debug()
|
GLCAT.debug()
|
||||||
<< "releasing index " << (int)dl._index << "\n";
|
<< "releasing index " << (int)dl._index << "\n";
|
||||||
}
|
}
|
||||||
GLP(DeleteLists)(dl._index, 1);
|
glDeleteLists(dl._index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_display_lists.clear();
|
_display_lists.clear();
|
||||||
|
@ -638,7 +638,7 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot,
|
|||||||
|
|
||||||
#ifndef OPENGLES
|
#ifndef OPENGLES
|
||||||
GLint depth_size = 0;
|
GLint depth_size = 0;
|
||||||
GLP(GetTexLevelParameteriv)(target, 0, GL_TEXTURE_DEPTH_SIZE, &depth_size);
|
glGetTexLevelParameteriv(target, 0, GL_TEXTURE_DEPTH_SIZE, &depth_size);
|
||||||
_fb_properties.set_depth_bits(depth_size);
|
_fb_properties.set_depth_bits(depth_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -649,7 +649,7 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot,
|
|||||||
|
|
||||||
#ifndef OPENGLES
|
#ifndef OPENGLES
|
||||||
GLint stencil_size = 0;
|
GLint stencil_size = 0;
|
||||||
GLP(GetTexLevelParameteriv)(target, 0, GL_TEXTURE_STENCIL_SIZE, &stencil_size);
|
glGetTexLevelParameteriv(target, 0, GL_TEXTURE_STENCIL_SIZE, &stencil_size);
|
||||||
_fb_properties.set_stencil_bits(stencil_size);
|
_fb_properties.set_stencil_bits(stencil_size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -662,10 +662,10 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot,
|
|||||||
#ifndef OPENGLES
|
#ifndef OPENGLES
|
||||||
if (attachpoint == GL_COLOR_ATTACHMENT0_EXT) {
|
if (attachpoint == GL_COLOR_ATTACHMENT0_EXT) {
|
||||||
GLint red_size = 0, green_size = 0, blue_size = 0, alpha_size = 0;
|
GLint red_size = 0, green_size = 0, blue_size = 0, alpha_size = 0;
|
||||||
GLP(GetTexLevelParameteriv)(target, 0, GL_TEXTURE_RED_SIZE, &red_size);
|
glGetTexLevelParameteriv(target, 0, GL_TEXTURE_RED_SIZE, &red_size);
|
||||||
GLP(GetTexLevelParameteriv)(target, 0, GL_TEXTURE_GREEN_SIZE, &green_size);
|
glGetTexLevelParameteriv(target, 0, GL_TEXTURE_GREEN_SIZE, &green_size);
|
||||||
GLP(GetTexLevelParameteriv)(target, 0, GL_TEXTURE_BLUE_SIZE, &blue_size);
|
glGetTexLevelParameteriv(target, 0, GL_TEXTURE_BLUE_SIZE, &blue_size);
|
||||||
GLP(GetTexLevelParameteriv)(target, 0, GL_TEXTURE_ALPHA_SIZE, &alpha_size);
|
glGetTexLevelParameteriv(target, 0, GL_TEXTURE_ALPHA_SIZE, &alpha_size);
|
||||||
|
|
||||||
_fb_properties.set_color_bits(red_size + green_size + blue_size);
|
_fb_properties.set_color_bits(red_size + green_size + blue_size);
|
||||||
_fb_properties.set_alpha_bits(alpha_size);
|
_fb_properties.set_alpha_bits(alpha_size);
|
||||||
@ -1049,9 +1049,9 @@ generate_mipmaps() {
|
|||||||
CLP(TextureContext) *gtc = DCAST(CLP(TextureContext), tc);
|
CLP(TextureContext) *gtc = DCAST(CLP(TextureContext), tc);
|
||||||
glgsg->update_texture(tc, true);
|
glgsg->update_texture(tc, true);
|
||||||
GLenum target = glgsg->get_texture_target(tex->get_texture_type());
|
GLenum target = glgsg->get_texture_target(tex->get_texture_type());
|
||||||
GLP(BindTexture)(target, gtc->_index);
|
glBindTexture(target, gtc->_index);
|
||||||
glgsg->_glGenerateMipmap(target);
|
glgsg->_glGenerateMipmap(target);
|
||||||
GLP(BindTexture)(target, 0);
|
glBindTexture(target, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
report_my_gl_errors();
|
report_my_gl_errors();
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
INLINE bool CLP(GraphicsStateGuardian)::
|
INLINE bool CLP(GraphicsStateGuardian)::
|
||||||
report_errors(int line, const char *source_file) {
|
report_errors(int line, const char *source_file) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
GLenum error_code = GLP(GetError)();
|
GLenum error_code = glGetError();
|
||||||
if (error_code != GL_NO_ERROR) {
|
if (error_code != GL_NO_ERROR) {
|
||||||
int error_count = 0;
|
int error_count = 0;
|
||||||
return report_errors_loop(line, source_file, error_code, error_count);
|
return report_errors_loop(line, source_file, error_code, error_count);
|
||||||
@ -46,7 +46,7 @@ INLINE void CLP(GraphicsStateGuardian)::
|
|||||||
report_my_errors(int line, const char *source_file) {
|
report_my_errors(int line, const char *source_file) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (_track_errors) {
|
if (_track_errors) {
|
||||||
GLenum error_code = GLP(GetError)();
|
GLenum error_code = glGetError();
|
||||||
if (error_code != GL_NO_ERROR) {
|
if (error_code != GL_NO_ERROR) {
|
||||||
if (!report_errors_loop(line, source_file, error_code, _error_count)) {
|
if (!report_errors_loop(line, source_file, error_code, _error_count)) {
|
||||||
panic_deactivate();
|
panic_deactivate();
|
||||||
@ -69,7 +69,7 @@ report_my_errors(int line, const char *source_file) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE bool CLP(GraphicsStateGuardian)::
|
INLINE bool CLP(GraphicsStateGuardian)::
|
||||||
clear_errors(int line, const char *source_file) {
|
clear_errors(int line, const char *source_file) {
|
||||||
GLenum error_code = GLP(GetError)();
|
GLenum error_code = glGetError();
|
||||||
if (error_code != GL_NO_ERROR) {
|
if (error_code != GL_NO_ERROR) {
|
||||||
int error_count = 0;
|
int error_count = 0;
|
||||||
return report_errors_loop(line, source_file, error_code, error_count);
|
return report_errors_loop(line, source_file, error_code, error_count);
|
||||||
@ -92,7 +92,7 @@ clear_errors(int line, const char *source_file) {
|
|||||||
INLINE void CLP(GraphicsStateGuardian)::
|
INLINE void CLP(GraphicsStateGuardian)::
|
||||||
clear_my_errors(int line, const char *source_file) {
|
clear_my_errors(int line, const char *source_file) {
|
||||||
if (_track_errors) {
|
if (_track_errors) {
|
||||||
GLenum error_code = GLP(GetError)();
|
GLenum error_code = glGetError();
|
||||||
if (error_code != GL_NO_ERROR) {
|
if (error_code != GL_NO_ERROR) {
|
||||||
int error_count = 0;
|
int error_count = 0;
|
||||||
report_errors_loop(line, source_file, error_code, error_count);
|
report_errors_loop(line, source_file, error_code, error_count);
|
||||||
@ -162,7 +162,7 @@ INLINE void CLP(GraphicsStateGuardian)::
|
|||||||
maybe_gl_finish() const {
|
maybe_gl_finish() const {
|
||||||
#ifdef DO_PSTATS
|
#ifdef DO_PSTATS
|
||||||
if (CLP(finish)) {
|
if (CLP(finish)) {
|
||||||
GLP(Finish)();
|
glFinish();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -231,12 +231,12 @@ enable_multisample_antialias(bool val) {
|
|||||||
// Turn off antialias multisample.
|
// Turn off antialias multisample.
|
||||||
_multisample_mode &= ~MM_antialias;
|
_multisample_mode &= ~MM_antialias;
|
||||||
if (_multisample_mode == 0) {
|
if (_multisample_mode == 0) {
|
||||||
GLP(Disable)(GL_MULTISAMPLE);
|
glDisable(GL_MULTISAMPLE);
|
||||||
}
|
}
|
||||||
} else if ((_multisample_mode & MM_antialias) == 0 && val) {
|
} else if ((_multisample_mode & MM_antialias) == 0 && val) {
|
||||||
// Turn on antialias multisample.
|
// Turn on antialias multisample.
|
||||||
if (_multisample_mode == 0) {
|
if (_multisample_mode == 0) {
|
||||||
GLP(Enable)(GL_MULTISAMPLE);
|
glEnable(GL_MULTISAMPLE);
|
||||||
}
|
}
|
||||||
_multisample_mode |= MM_antialias;
|
_multisample_mode |= MM_antialias;
|
||||||
}
|
}
|
||||||
@ -258,16 +258,16 @@ enable_multisample_alpha_one(bool val) {
|
|||||||
if ((_multisample_mode & MM_alpha_one) != 0 && !val) {
|
if ((_multisample_mode & MM_alpha_one) != 0 && !val) {
|
||||||
// Turn off sample_alpha_to_one multisample.
|
// Turn off sample_alpha_to_one multisample.
|
||||||
_multisample_mode &= ~MM_alpha_one;
|
_multisample_mode &= ~MM_alpha_one;
|
||||||
GLP(Disable)(GL_SAMPLE_ALPHA_TO_ONE);
|
glDisable(GL_SAMPLE_ALPHA_TO_ONE);
|
||||||
if (_multisample_mode == 0) {
|
if (_multisample_mode == 0) {
|
||||||
GLP(Disable)(GL_MULTISAMPLE);
|
glDisable(GL_MULTISAMPLE);
|
||||||
}
|
}
|
||||||
} else if ((_multisample_mode & MM_alpha_one) == 0 && val) {
|
} else if ((_multisample_mode & MM_alpha_one) == 0 && val) {
|
||||||
// Turn on sample_alpha_to_one multisample.
|
// Turn on sample_alpha_to_one multisample.
|
||||||
if (_multisample_mode == 0) {
|
if (_multisample_mode == 0) {
|
||||||
GLP(Enable)(GL_MULTISAMPLE);
|
glEnable(GL_MULTISAMPLE);
|
||||||
}
|
}
|
||||||
GLP(Enable)(GL_SAMPLE_ALPHA_TO_ONE);
|
glEnable(GL_SAMPLE_ALPHA_TO_ONE);
|
||||||
_multisample_mode |= MM_alpha_one;
|
_multisample_mode |= MM_alpha_one;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,16 +288,16 @@ enable_multisample_alpha_mask(bool val) {
|
|||||||
if ((_multisample_mode & MM_alpha_mask) != 0 && !val) {
|
if ((_multisample_mode & MM_alpha_mask) != 0 && !val) {
|
||||||
// Turn off sample_alpha_to_mask multisample.
|
// Turn off sample_alpha_to_mask multisample.
|
||||||
_multisample_mode &= ~MM_alpha_mask;
|
_multisample_mode &= ~MM_alpha_mask;
|
||||||
GLP(Disable)(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
||||||
if (_multisample_mode == 0) {
|
if (_multisample_mode == 0) {
|
||||||
GLP(Disable)(GL_MULTISAMPLE);
|
glDisable(GL_MULTISAMPLE);
|
||||||
}
|
}
|
||||||
} else if ((_multisample_mode & MM_alpha_mask) == 0 && val) {
|
} else if ((_multisample_mode & MM_alpha_mask) == 0 && val) {
|
||||||
// Turn on sample_alpha_to_mask multisample.
|
// Turn on sample_alpha_to_mask multisample.
|
||||||
if (_multisample_mode == 0) {
|
if (_multisample_mode == 0) {
|
||||||
GLP(Enable)(GL_MULTISAMPLE);
|
glEnable(GL_MULTISAMPLE);
|
||||||
}
|
}
|
||||||
GLP(Enable)(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
||||||
_multisample_mode |= MM_alpha_mask;
|
_multisample_mode |= MM_alpha_mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -316,9 +316,9 @@ enable_line_smooth(bool val) {
|
|||||||
_state_mask.clear_bit(TransparencyAttrib::get_class_slot());
|
_state_mask.clear_bit(TransparencyAttrib::get_class_slot());
|
||||||
_line_smooth_enabled = val;
|
_line_smooth_enabled = val;
|
||||||
if (val) {
|
if (val) {
|
||||||
GLP(Enable)(GL_LINE_SMOOTH);
|
glEnable(GL_LINE_SMOOTH);
|
||||||
} else {
|
} else {
|
||||||
GLP(Disable)(GL_LINE_SMOOTH);
|
glDisable(GL_LINE_SMOOTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -336,9 +336,9 @@ enable_point_smooth(bool val) {
|
|||||||
_state_mask.clear_bit(TransparencyAttrib::get_class_slot());
|
_state_mask.clear_bit(TransparencyAttrib::get_class_slot());
|
||||||
_point_smooth_enabled = val;
|
_point_smooth_enabled = val;
|
||||||
if (val) {
|
if (val) {
|
||||||
GLP(Enable)(GL_POINT_SMOOTH);
|
glEnable(GL_POINT_SMOOTH);
|
||||||
} else {
|
} else {
|
||||||
GLP(Disable)(GL_POINT_SMOOTH);
|
glDisable(GL_POINT_SMOOTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -355,9 +355,9 @@ enable_polygon_smooth(bool val) {
|
|||||||
if (_polygon_smooth_enabled != val) {
|
if (_polygon_smooth_enabled != val) {
|
||||||
_polygon_smooth_enabled = val;
|
_polygon_smooth_enabled = val;
|
||||||
if (val) {
|
if (val) {
|
||||||
GLP(Enable)(GL_POLYGON_SMOOTH);
|
glEnable(GL_POLYGON_SMOOTH);
|
||||||
} else {
|
} else {
|
||||||
GLP(Disable)(GL_POLYGON_SMOOTH);
|
glDisable(GL_POLYGON_SMOOTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // OPENGLES
|
#endif // OPENGLES
|
||||||
@ -448,13 +448,13 @@ enable_stencil_test(bool val) {
|
|||||||
GLCAT.spam()
|
GLCAT.spam()
|
||||||
<< "glEnable(GL_STENCIL_TEST)" << endl;
|
<< "glEnable(GL_STENCIL_TEST)" << endl;
|
||||||
#endif
|
#endif
|
||||||
GLP(Enable)(GL_STENCIL_TEST);
|
glEnable(GL_STENCIL_TEST);
|
||||||
} else {
|
} else {
|
||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
GLCAT.spam()
|
GLCAT.spam()
|
||||||
<< "glDisable(GL_STENCIL_TEST)" << endl;
|
<< "glDisable(GL_STENCIL_TEST)" << endl;
|
||||||
#endif
|
#endif
|
||||||
GLP(Disable)(GL_STENCIL_TEST);
|
glDisable(GL_STENCIL_TEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -473,13 +473,13 @@ enable_blend(bool val) {
|
|||||||
GLCAT.spam()
|
GLCAT.spam()
|
||||||
<< "glEnable(GL_BLEND)" << endl;
|
<< "glEnable(GL_BLEND)" << endl;
|
||||||
#endif
|
#endif
|
||||||
GLP(Enable)(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
} else {
|
} else {
|
||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
GLCAT.spam()
|
GLCAT.spam()
|
||||||
<< "glDisable(GL_BLEND)" << endl;
|
<< "glDisable(GL_BLEND)" << endl;
|
||||||
#endif
|
#endif
|
||||||
GLP(Disable)(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -498,13 +498,13 @@ enable_depth_test(bool val) {
|
|||||||
GLCAT.spam()
|
GLCAT.spam()
|
||||||
<< "glEnable(GL_DEPTH_TEST)" << endl;
|
<< "glEnable(GL_DEPTH_TEST)" << endl;
|
||||||
#endif
|
#endif
|
||||||
GLP(Enable)(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
} else {
|
} else {
|
||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
GLCAT.spam()
|
GLCAT.spam()
|
||||||
<< "glDisable(GL_DEPTH_TEST)" << endl;
|
<< "glDisable(GL_DEPTH_TEST)" << endl;
|
||||||
#endif
|
#endif
|
||||||
GLP(Disable)(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -524,13 +524,13 @@ enable_fog(bool val) {
|
|||||||
GLCAT.spam()
|
GLCAT.spam()
|
||||||
<< "glEnable(GL_FOG)" << endl;
|
<< "glEnable(GL_FOG)" << endl;
|
||||||
#endif
|
#endif
|
||||||
GLP(Enable)(GL_FOG);
|
glEnable(GL_FOG);
|
||||||
} else {
|
} else {
|
||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
GLCAT.spam()
|
GLCAT.spam()
|
||||||
<< "glDisable(GL_FOG)" << endl;
|
<< "glDisable(GL_FOG)" << endl;
|
||||||
#endif
|
#endif
|
||||||
GLP(Disable)(GL_FOG);
|
glDisable(GL_FOG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -551,13 +551,13 @@ enable_alpha_test(bool val) {
|
|||||||
GLCAT.spam()
|
GLCAT.spam()
|
||||||
<< "glEnable(GL_ALPHA_TEST)" << endl;
|
<< "glEnable(GL_ALPHA_TEST)" << endl;
|
||||||
#endif
|
#endif
|
||||||
GLP(Enable)(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
} else {
|
} else {
|
||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
GLCAT.spam()
|
GLCAT.spam()
|
||||||
<< "glDisable(GL_ALPHA_TEST)" << endl;
|
<< "glDisable(GL_ALPHA_TEST)" << endl;
|
||||||
#endif
|
#endif
|
||||||
GLP(Disable)(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // OPENGLES_2
|
#endif // OPENGLES_2
|
||||||
@ -578,17 +578,17 @@ enable_polygon_offset(bool val) {
|
|||||||
GLCAT.spam()
|
GLCAT.spam()
|
||||||
<< "glEnable(GL_POLYGON_OFFSET_*)" << endl;
|
<< "glEnable(GL_POLYGON_OFFSET_*)" << endl;
|
||||||
#endif
|
#endif
|
||||||
GLP(Enable)(GL_POLYGON_OFFSET_FILL);
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||||
//GLP(Enable)(GL_POLYGON_OFFSET_LINE); // not widely supported anyway
|
//glEnable(GL_POLYGON_OFFSET_LINE); // not widely supported anyway
|
||||||
//GLP(Enable)(GL_POLYGON_OFFSET_POINT);
|
//glEnable(GL_POLYGON_OFFSET_POINT);
|
||||||
} else {
|
} else {
|
||||||
#ifdef GSG_VERBOSE
|
#ifdef GSG_VERBOSE
|
||||||
GLCAT.spam()
|
GLCAT.spam()
|
||||||
<< "glDisable(GL_POLYGON_OFFSET_*)" << endl;
|
<< "glDisable(GL_POLYGON_OFFSET_*)" << endl;
|
||||||
#endif
|
#endif
|
||||||
GLP(Disable)(GL_POLYGON_OFFSET_FILL);
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
//GLP(Disable)(GL_POLYGON_OFFSET_LINE); // not widely supported anyway
|
//glDisable(GL_POLYGON_OFFSET_LINE); // not widely supported anyway
|
||||||
//GLP(Disable)(GL_POLYGON_OFFSET_POINT);
|
//glDisable(GL_POLYGON_OFFSET_POINT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -603,10 +603,10 @@ INLINE void CLP(GraphicsStateGuardian)::
|
|||||||
call_glFogfv(GLenum pname, const LColor &color) {
|
call_glFogfv(GLenum pname, const LColor &color) {
|
||||||
#ifndef OPENGLES_2
|
#ifndef OPENGLES_2
|
||||||
#ifndef STDFLOAT_DOUBLE
|
#ifndef STDFLOAT_DOUBLE
|
||||||
GLP(Fogfv)(pname, color.get_data());
|
glFogfv(pname, color.get_data());
|
||||||
#else // STDFLOAT_DOUBLE
|
#else // STDFLOAT_DOUBLE
|
||||||
LColorf fcolor = LCAST(float, color);
|
LColorf fcolor = LCAST(float, color);
|
||||||
GLP(Fogfv)(pname, fcolor.get_data());
|
glFogfv(pname, fcolor.get_data());
|
||||||
#endif // STDFLOAT_DOUBLE
|
#endif // STDFLOAT_DOUBLE
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -621,10 +621,10 @@ INLINE void CLP(GraphicsStateGuardian)::
|
|||||||
call_glMaterialfv(GLenum face, GLenum pname, const LColor &color) {
|
call_glMaterialfv(GLenum face, GLenum pname, const LColor &color) {
|
||||||
#ifndef OPENGLES_2
|
#ifndef OPENGLES_2
|
||||||
#ifndef STDFLOAT_DOUBLE
|
#ifndef STDFLOAT_DOUBLE
|
||||||
GLP(Materialfv)(face, pname, color.get_data());
|
glMaterialfv(face, pname, color.get_data());
|
||||||
#else // STDFLOAT_DOUBLE
|
#else // STDFLOAT_DOUBLE
|
||||||
LColorf fcolor = LCAST(float, color);
|
LColorf fcolor = LCAST(float, color);
|
||||||
GLP(Materialfv)(face, pname, fcolor.get_data());
|
glMaterialfv(face, pname, fcolor.get_data());
|
||||||
#endif // STDFLOAT_DOUBLE
|
#endif // STDFLOAT_DOUBLE
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -639,10 +639,10 @@ INLINE void CLP(GraphicsStateGuardian)::
|
|||||||
call_glLightfv(GLenum light, GLenum pname, const LVecBase4 &value) {
|
call_glLightfv(GLenum light, GLenum pname, const LVecBase4 &value) {
|
||||||
#ifndef OPENGLES_2
|
#ifndef OPENGLES_2
|
||||||
#ifndef STDFLOAT_DOUBLE
|
#ifndef STDFLOAT_DOUBLE
|
||||||
GLP(Lightfv)(light, pname, value.get_data());
|
glLightfv(light, pname, value.get_data());
|
||||||
#else // STDFLOAT_DOUBLE
|
#else // STDFLOAT_DOUBLE
|
||||||
LVecBase4f fvalue = LCAST(float, value);
|
LVecBase4f fvalue = LCAST(float, value);
|
||||||
GLP(Lightfv)(light, pname, fvalue.get_data());
|
glLightfv(light, pname, fvalue.get_data());
|
||||||
#endif // STDFLOAT_DOUBLE
|
#endif // STDFLOAT_DOUBLE
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -657,10 +657,10 @@ INLINE void CLP(GraphicsStateGuardian)::
|
|||||||
call_glLightfv(GLenum light, GLenum pname, const LVecBase3 &value) {
|
call_glLightfv(GLenum light, GLenum pname, const LVecBase3 &value) {
|
||||||
#ifndef OPENGLES_2
|
#ifndef OPENGLES_2
|
||||||
#ifndef STDFLOAT_DOUBLE
|
#ifndef STDFLOAT_DOUBLE
|
||||||
GLP(Lightfv)(light, pname, value.get_data());
|
glLightfv(light, pname, value.get_data());
|
||||||
#else // STDFLOAT_DOUBLE
|
#else // STDFLOAT_DOUBLE
|
||||||
LVecBase3f fvalue = LCAST(float, value);
|
LVecBase3f fvalue = LCAST(float, value);
|
||||||
GLP(Lightfv)(light, pname, fvalue.get_data());
|
glLightfv(light, pname, fvalue.get_data());
|
||||||
#endif // STDFLOAT_DOUBLE
|
#endif // STDFLOAT_DOUBLE
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -675,10 +675,10 @@ INLINE void CLP(GraphicsStateGuardian)::
|
|||||||
call_glLightModelfv(GLenum pname, const LVecBase4 &value) {
|
call_glLightModelfv(GLenum pname, const LVecBase4 &value) {
|
||||||
#ifndef OPENGLES_2
|
#ifndef OPENGLES_2
|
||||||
#ifndef STDFLOAT_DOUBLE
|
#ifndef STDFLOAT_DOUBLE
|
||||||
GLP(LightModelfv)(pname, value.get_data());
|
glLightModelfv(pname, value.get_data());
|
||||||
#else // STDFLOAT_DOUBLE
|
#else // STDFLOAT_DOUBLE
|
||||||
LVecBase4f fvalue = LCAST(float, value);
|
LVecBase4f fvalue = LCAST(float, value);
|
||||||
GLP(LightModelfv)(pname, fvalue.get_data());
|
glLightModelfv(pname, fvalue.get_data());
|
||||||
#endif // STDFLOAT_DOUBLE
|
#endif // STDFLOAT_DOUBLE
|
||||||
#endif // OPENGLES_2
|
#endif // OPENGLES_2
|
||||||
}
|
}
|
||||||
@ -693,10 +693,10 @@ INLINE void CLP(GraphicsStateGuardian)::
|
|||||||
call_glTexEnvfv(GLenum target, GLenum pname, const LVecBase4 &value) {
|
call_glTexEnvfv(GLenum target, GLenum pname, const LVecBase4 &value) {
|
||||||
#ifndef OPENGLES_2
|
#ifndef OPENGLES_2
|
||||||
#ifndef STDFLOAT_DOUBLE
|
#ifndef STDFLOAT_DOUBLE
|
||||||
GLP(TexEnvfv)(target, pname, value.get_data());
|
glTexEnvfv(target, pname, value.get_data());
|
||||||
#else // STDFLOAT_DOUBLE
|
#else // STDFLOAT_DOUBLE
|
||||||
LVecBase4f fvalue = LCAST(float, value);
|
LVecBase4f fvalue = LCAST(float, value);
|
||||||
GLP(TexEnvfv)(target, pname, fvalue.get_data());
|
glTexEnvfv(target, pname, fvalue.get_data());
|
||||||
#endif // STDFLOAT_DOUBLE
|
#endif // STDFLOAT_DOUBLE
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -710,10 +710,10 @@ call_glTexEnvfv(GLenum target, GLenum pname, const LVecBase4 &value) {
|
|||||||
INLINE void CLP(GraphicsStateGuardian)::
|
INLINE void CLP(GraphicsStateGuardian)::
|
||||||
call_glTexParameterfv(GLenum target, GLenum pname, const LVecBase4 &value) {
|
call_glTexParameterfv(GLenum target, GLenum pname, const LVecBase4 &value) {
|
||||||
#ifndef STDFLOAT_DOUBLE
|
#ifndef STDFLOAT_DOUBLE
|
||||||
GLP(TexParameterfv)(target, pname, value.get_data());
|
glTexParameterfv(target, pname, value.get_data());
|
||||||
#else // STDFLOAT_DOUBLE
|
#else // STDFLOAT_DOUBLE
|
||||||
LVecBase4f fvalue = LCAST(float, value);
|
LVecBase4f fvalue = LCAST(float, value);
|
||||||
GLP(TexParameterfv)(target, pname, fvalue.get_data());
|
glTexParameterfv(target, pname, fvalue.get_data());
|
||||||
#endif // STDFLOAT_DOUBLE
|
#endif // STDFLOAT_DOUBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -345,8 +345,8 @@ protected:
|
|||||||
bool has_extension(const string &extension) const;
|
bool has_extension(const string &extension) const;
|
||||||
INLINE bool is_at_least_gl_version(int major_version, int minor_version) const;
|
INLINE bool is_at_least_gl_version(int major_version, int minor_version) const;
|
||||||
INLINE bool is_at_least_gles_version(int major_version, int minor_version) const;
|
INLINE bool is_at_least_gles_version(int major_version, int minor_version) const;
|
||||||
void *get_extension_func(const char *prefix, const char *name);
|
void *get_extension_func(const char *name);
|
||||||
virtual void *do_get_extension_func(const char *prefix, const char *name);
|
virtual void *do_get_extension_func(const char *name);
|
||||||
|
|
||||||
virtual void reissue_transforms();
|
virtual void reissue_transforms();
|
||||||
virtual void enable_lighting(bool enable);
|
virtual void enable_lighting(bool enable);
|
||||||
|
@ -75,7 +75,7 @@ is_answer_ready() const {
|
|||||||
void CLP(OcclusionQueryContext)::
|
void CLP(OcclusionQueryContext)::
|
||||||
waiting_for_answer() {
|
waiting_for_answer() {
|
||||||
PStatTimer timer(GraphicsStateGuardian::_wait_occlusion_pcollector);
|
PStatTimer timer(GraphicsStateGuardian::_wait_occlusion_pcollector);
|
||||||
GLP(Flush)();
|
glFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1365,21 +1365,21 @@ disable_shader_texture_bindings(GSG *gsg) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifndef OPENGLES
|
#ifndef OPENGLES
|
||||||
GLP(BindTexture)(GL_TEXTURE_1D, 0);
|
glBindTexture(GL_TEXTURE_1D, 0);
|
||||||
#endif // OPENGLES
|
#endif // OPENGLES
|
||||||
GLP(BindTexture)(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
#ifndef OPENGLES_1
|
#ifndef OPENGLES_1
|
||||||
if (gsg->_supports_3d_texture) {
|
if (gsg->_supports_3d_texture) {
|
||||||
GLP(BindTexture)(GL_TEXTURE_3D, 0);
|
glBindTexture(GL_TEXTURE_3D, 0);
|
||||||
}
|
}
|
||||||
#endif // OPENGLES_1
|
#endif // OPENGLES_1
|
||||||
#ifndef OPENGLES
|
#ifndef OPENGLES
|
||||||
if (gsg->_supports_2d_texture_array) {
|
if (gsg->_supports_2d_texture_array) {
|
||||||
GLP(BindTexture)(GL_TEXTURE_2D_ARRAY_EXT, 0);
|
glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (gsg->_supports_cube_map) {
|
if (gsg->_supports_cube_map) {
|
||||||
GLP(BindTexture)(GL_TEXTURE_CUBE_MAP, 0);
|
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
|
||||||
}
|
}
|
||||||
// This is probably faster - but maybe not as safe?
|
// This is probably faster - but maybe not as safe?
|
||||||
// cgGLDisableTextureParameter(p);
|
// cgGLDisableTextureParameter(p);
|
||||||
@ -1490,6 +1490,11 @@ update_shader_texture_bindings(CLP(ShaderContext) *prev, GSG *gsg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(HAVE_CG) && !defined(OPENGLES)
|
||||||
|
cg_report_errors();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef OPENGLES
|
||||||
// Now bind all the 'image units'; a bit of an esoteric OpenGL feature right now.
|
// Now bind all the 'image units'; a bit of an esoteric OpenGL feature right now.
|
||||||
int num_image_units = min(_glsl_img_inputs.size(), (size_t)gsg->_max_image_units);
|
int num_image_units = min(_glsl_img_inputs.size(), (size_t)gsg->_max_image_units);
|
||||||
|
|
||||||
@ -1511,6 +1516,7 @@ update_shader_texture_bindings(CLP(ShaderContext) *prev, GSG *gsg) {
|
|||||||
CLP(TextureContext) *gtc = DCAST(CLP(TextureContext), tex->prepare_now(view, gsg->_prepared_objects, gsg));
|
CLP(TextureContext) *gtc = DCAST(CLP(TextureContext), tex->prepare_now(view, gsg->_prepared_objects, gsg));
|
||||||
if (gtc != (TextureContext*)NULL) {
|
if (gtc != (TextureContext*)NULL) {
|
||||||
gl_tex = gtc->_index;
|
gl_tex = gtc->_index;
|
||||||
|
gsg->update_texture(gtc, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1523,6 +1529,7 @@ update_shader_texture_bindings(CLP(ShaderContext) *prev, GSG *gsg) {
|
|||||||
if (gl_tex == 0) {
|
if (gl_tex == 0) {
|
||||||
gsg->_glBindImageTexture(i, 0, 0, GL_FALSE, 0, GL_READ_ONLY, GL_R8);
|
gsg->_glBindImageTexture(i, 0, 0, GL_FALSE, 0, GL_READ_ONLY, GL_R8);
|
||||||
} else {
|
} else {
|
||||||
|
//TODO: automatically convert to sized type instead of plain GL_RGBA
|
||||||
GLint internal_format = gsg->get_internal_image_format(tex);
|
GLint internal_format = gsg->get_internal_image_format(tex);
|
||||||
gsg->_glBindImageTexture(i, gl_tex, 0, GL_TRUE, 0, GL_READ_WRITE, internal_format);
|
gsg->_glBindImageTexture(i, gl_tex, 0, GL_TRUE, 0, GL_READ_WRITE, internal_format);
|
||||||
}
|
}
|
||||||
@ -1534,9 +1541,6 @@ update_shader_texture_bindings(CLP(ShaderContext) *prev, GSG *gsg) {
|
|||||||
delete[] multi_img;
|
delete[] multi_img;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_CG) && !defined(OPENGLES)
|
|
||||||
cg_report_errors();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gsg->report_my_gl_errors();
|
gsg->report_my_gl_errors();
|
||||||
|
@ -49,11 +49,11 @@ evict_lru() {
|
|||||||
void CLP(TextureContext)::
|
void CLP(TextureContext)::
|
||||||
reset_data() {
|
reset_data() {
|
||||||
// Free the texture resources.
|
// Free the texture resources.
|
||||||
GLP(DeleteTextures)(1, &_index);
|
glDeleteTextures(1, &_index);
|
||||||
|
|
||||||
// We still need a valid index number, though, in case we want to
|
// We still need a valid index number, though, in case we want to
|
||||||
// re-load the texture later.
|
// re-load the texture later.
|
||||||
GLP(GenTextures)(1, &_index);
|
glGenTextures(1, &_index);
|
||||||
|
|
||||||
_already_applied = false;
|
_already_applied = false;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
ConfigVariableBool CLP(cheap_textures)
|
ConfigVariableBool CLP(cheap_textures)
|
||||||
("gl-cheap-textures", false,
|
("gl-cheap-textures", false,
|
||||||
PRC_DESC("Configure this true to GLP(Hint) the textures into the cheapest "
|
PRC_DESC("Configure this true to glHint the textures into the cheapest "
|
||||||
"possible mode."));
|
"possible mode."));
|
||||||
|
|
||||||
ConfigVariableBool CLP(ignore_clamp)
|
ConfigVariableBool CLP(ignore_clamp)
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
// some such), define the following symbols and #include this header
|
// some such), define the following symbols and #include this header
|
||||||
// file.
|
// file.
|
||||||
|
|
||||||
// #define GLP(name): returns name prefixed by the gl prefix, e.g. gl##name
|
|
||||||
// #define CLP(name): returns name prefixed by the class prefix, e.g. GL##name
|
// #define CLP(name): returns name prefixed by the class prefix, e.g. GL##name
|
||||||
// #define CLASSPREFIX_QUOTED: the quoted prefix of CLP, e.g. "GL"
|
// #define CLASSPREFIX_QUOTED: the quoted prefix of CLP, e.g. "GL"
|
||||||
// #define CONFIGOBJ: a Configrc object, e.g. config_glgsg
|
// #define CONFIGOBJ: a Configrc object, e.g. config_glgsg
|
||||||
@ -43,4 +42,3 @@
|
|||||||
#include "glImmediateModeSender_src.h"
|
#include "glImmediateModeSender_src.h"
|
||||||
#include "glGraphicsBuffer_src.h"
|
#include "glGraphicsBuffer_src.h"
|
||||||
#include "glGraphicsStateGuardian_src.h"
|
#include "glGraphicsStateGuardian_src.h"
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ get_properties(FrameBufferProperties &properties, XVisualInfo *visual) {
|
|||||||
red_size, green_size, blue_size,
|
red_size, green_size, blue_size,
|
||||||
alpha_size, ared_size, agreen_size, ablue_size, aalpha_size,
|
alpha_size, ared_size, agreen_size, ablue_size, aalpha_size,
|
||||||
depth_size, stencil_size;
|
depth_size, stencil_size;
|
||||||
|
|
||||||
glXGetConfig(_display, visual, GLX_USE_GL, &use_gl);
|
glXGetConfig(_display, visual, GLX_USE_GL, &use_gl);
|
||||||
glXGetConfig(_display, visual, GLX_RGBA, &render_mode);
|
glXGetConfig(_display, visual, GLX_RGBA, &render_mode);
|
||||||
glXGetConfig(_display, visual, GLX_DOUBLEBUFFER, &double_buffer);
|
glXGetConfig(_display, visual, GLX_DOUBLEBUFFER, &double_buffer);
|
||||||
@ -131,7 +131,7 @@ get_properties(FrameBufferProperties &properties, XVisualInfo *visual) {
|
|||||||
properties.set_depth_bits(depth_size);
|
properties.set_depth_bits(depth_size);
|
||||||
properties.set_alpha_bits(alpha_size);
|
properties.set_alpha_bits(alpha_size);
|
||||||
properties.set_accum_bits(ared_size+agreen_size+ablue_size+aalpha_size);
|
properties.set_accum_bits(ared_size+agreen_size+ablue_size+aalpha_size);
|
||||||
|
|
||||||
// Set both hardware and software bits, indicating not-yet-known.
|
// Set both hardware and software bits, indicating not-yet-known.
|
||||||
properties.set_force_software(1);
|
properties.set_force_software(1);
|
||||||
properties.set_force_hardware(1);
|
properties.set_force_hardware(1);
|
||||||
@ -154,7 +154,7 @@ get_properties_advanced(FrameBufferProperties &properties,
|
|||||||
int render_type, double_buffer, stereo, red_size, green_size, blue_size,
|
int render_type, double_buffer, stereo, red_size, green_size, blue_size,
|
||||||
alpha_size, ared_size, agreen_size, ablue_size, aalpha_size,
|
alpha_size, ared_size, agreen_size, ablue_size, aalpha_size,
|
||||||
depth_size, stencil_size, samples, drawable_type, caveat;
|
depth_size, stencil_size, samples, drawable_type, caveat;
|
||||||
|
|
||||||
_glXGetFBConfigAttrib(_display, config, GLX_RENDER_TYPE, &render_type);
|
_glXGetFBConfigAttrib(_display, config, GLX_RENDER_TYPE, &render_type);
|
||||||
_glXGetFBConfigAttrib(_display, config, GLX_DOUBLEBUFFER, &double_buffer);
|
_glXGetFBConfigAttrib(_display, config, GLX_DOUBLEBUFFER, &double_buffer);
|
||||||
_glXGetFBConfigAttrib(_display, config, GLX_STEREO, &stereo);
|
_glXGetFBConfigAttrib(_display, config, GLX_STEREO, &stereo);
|
||||||
@ -171,47 +171,49 @@ get_properties_advanced(FrameBufferProperties &properties,
|
|||||||
_glXGetFBConfigAttrib(_display, config, GLX_SAMPLES, &samples);
|
_glXGetFBConfigAttrib(_display, config, GLX_SAMPLES, &samples);
|
||||||
_glXGetFBConfigAttrib(_display, config, GLX_DRAWABLE_TYPE, &drawable_type);
|
_glXGetFBConfigAttrib(_display, config, GLX_DRAWABLE_TYPE, &drawable_type);
|
||||||
_glXGetFBConfigAttrib(_display, config, GLX_CONFIG_CAVEAT, &caveat);
|
_glXGetFBConfigAttrib(_display, config, GLX_CONFIG_CAVEAT, &caveat);
|
||||||
|
|
||||||
context_has_pbuffer = false;
|
context_has_pbuffer = false;
|
||||||
if ((drawable_type & GLX_PBUFFER_BIT)!=0) {
|
if ((drawable_type & GLX_PBUFFER_BIT)!=0) {
|
||||||
context_has_pbuffer = true;
|
context_has_pbuffer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
context_has_pixmap = false;
|
context_has_pixmap = false;
|
||||||
if ((drawable_type & GLX_PIXMAP_BIT)!=0) {
|
if ((drawable_type & GLX_PIXMAP_BIT)!=0) {
|
||||||
context_has_pixmap = true;
|
context_has_pixmap = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
slow = false;
|
slow = false;
|
||||||
if (caveat == GLX_SLOW_CONFIG) {
|
if (caveat == GLX_SLOW_CONFIG) {
|
||||||
slow = true;
|
slow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((drawable_type & GLX_WINDOW_BIT)==0) {
|
if ((drawable_type & GLX_WINDOW_BIT)==0) {
|
||||||
// We insist on having a context that will support an onscreen window.
|
// We insist on having a context that will support an onscreen window.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (double_buffer) {
|
if (double_buffer) {
|
||||||
properties.set_back_buffers(1);
|
properties.set_back_buffers(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stereo) {
|
if (stereo) {
|
||||||
properties.set_stereo(1);
|
properties.set_stereo(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((render_type & GLX_RGBA_BIT)!=0) {
|
if ((render_type & GLX_RGBA_BIT)!=0) {
|
||||||
properties.set_rgb_color(1);
|
properties.set_rgb_color(true);
|
||||||
}
|
}
|
||||||
if ((render_type & GLX_COLOR_INDEX_BIT)!=0) {
|
if ((render_type & GLX_COLOR_INDEX_BIT)!=0) {
|
||||||
properties.set_indexed_color(1);
|
properties.set_indexed_color(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
properties.set_color_bits(red_size+green_size+blue_size);
|
properties.set_color_bits(red_size+green_size+blue_size);
|
||||||
properties.set_stencil_bits(stencil_size);
|
properties.set_stencil_bits(stencil_size);
|
||||||
properties.set_depth_bits(depth_size);
|
properties.set_depth_bits(depth_size);
|
||||||
properties.set_alpha_bits(alpha_size);
|
properties.set_alpha_bits(alpha_size);
|
||||||
properties.set_accum_bits(ared_size+agreen_size+ablue_size+aalpha_size);
|
properties.set_accum_bits(ared_size+agreen_size+ablue_size+aalpha_size);
|
||||||
properties.set_multisamples(samples);
|
properties.set_multisamples(samples);
|
||||||
|
|
||||||
// Set both hardware and software bits, indicating not-yet-known.
|
// Set both hardware and software bits, indicating not-yet-known.
|
||||||
properties.set_force_software(1);
|
properties.set_force_software(1);
|
||||||
properties.set_force_hardware(1);
|
properties.set_force_hardware(1);
|
||||||
@ -298,11 +300,11 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
|||||||
attrib_list[n++] = GLX_DRAWABLE_TYPE;
|
attrib_list[n++] = GLX_DRAWABLE_TYPE;
|
||||||
attrib_list[n++] = GLX_DONT_CARE;
|
attrib_list[n++] = GLX_DONT_CARE;
|
||||||
attrib_list[n] = (int)None;
|
attrib_list[n] = (int)None;
|
||||||
|
|
||||||
int num_configs = 0;
|
int num_configs = 0;
|
||||||
GLXFBConfig *configs =
|
GLXFBConfig *configs =
|
||||||
_glXChooseFBConfig(_display, _screen, attrib_list, &num_configs);
|
_glXChooseFBConfig(_display, _screen, attrib_list, &num_configs);
|
||||||
|
|
||||||
if (configs != 0) {
|
if (configs != 0) {
|
||||||
bool context_has_pbuffer, context_has_pixmap, slow;
|
bool context_has_pbuffer, context_has_pixmap, slow;
|
||||||
int quality, i;
|
int quality, i;
|
||||||
@ -325,7 +327,7 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
|||||||
if (need_pixmap && !context_has_pixmap) {
|
if (need_pixmap && !context_has_pixmap) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quality > best_quality) {
|
if (quality > best_quality) {
|
||||||
best_quality = quality;
|
best_quality = quality;
|
||||||
best_result = i;
|
best_result = i;
|
||||||
@ -336,7 +338,7 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
|||||||
|
|
||||||
if (best_quality > 0) {
|
if (best_quality > 0) {
|
||||||
_fbconfig = configs[best_result];
|
_fbconfig = configs[best_result];
|
||||||
_context =
|
_context =
|
||||||
_glXCreateNewContext(_display, _fbconfig, GLX_RGBA_TYPE, _share_context,
|
_glXCreateNewContext(_display, _fbconfig, GLX_RGBA_TYPE, _share_context,
|
||||||
GL_TRUE);
|
GL_TRUE);
|
||||||
if (_context) {
|
if (_context) {
|
||||||
@ -401,7 +403,7 @@ reset() {
|
|||||||
|
|
||||||
if (_supports_swap_control) {
|
if (_supports_swap_control) {
|
||||||
_glXSwapIntervalSGI =
|
_glXSwapIntervalSGI =
|
||||||
(PFNGLXSWAPINTERVALSGIPROC)get_extension_func("glX", "SwapIntervalSGI");
|
(PFNGLXSWAPINTERVALSGIPROC)get_extension_func("glXSwapIntervalSGI");
|
||||||
if (_glXSwapIntervalSGI == NULL) {
|
if (_glXSwapIntervalSGI == NULL) {
|
||||||
glxdisplay_cat.error()
|
glxdisplay_cat.error()
|
||||||
<< "Driver claims to support GLX_SGI_swap_control extension, but does not define all functions.\n";
|
<< "Driver claims to support GLX_SGI_swap_control extension, but does not define all functions.\n";
|
||||||
@ -419,18 +421,18 @@ reset() {
|
|||||||
if (glx_is_at_least_version(1, 3)) {
|
if (glx_is_at_least_version(1, 3)) {
|
||||||
// If we have glx 1.3 or better, we have the FBConfig interface.
|
// If we have glx 1.3 or better, we have the FBConfig interface.
|
||||||
_supports_fbconfig = true;
|
_supports_fbconfig = true;
|
||||||
|
|
||||||
_glXChooseFBConfig =
|
_glXChooseFBConfig =
|
||||||
(PFNGLXCHOOSEFBCONFIGPROC)get_extension_func("glX", "ChooseFBConfig");
|
(PFNGLXCHOOSEFBCONFIGPROC)get_extension_func("glXChooseFBConfig");
|
||||||
_glXCreateNewContext =
|
_glXCreateNewContext =
|
||||||
(PFNGLXCREATENEWCONTEXTPROC)get_extension_func("glX", "CreateNewContext");
|
(PFNGLXCREATENEWCONTEXTPROC)get_extension_func("glXCreateNewContext");
|
||||||
_glXGetVisualFromFBConfig =
|
_glXGetVisualFromFBConfig =
|
||||||
(PFNGLXGETVISUALFROMFBCONFIGPROC)get_extension_func("glX", "GetVisualFromFBConfig");
|
(PFNGLXGETVISUALFROMFBCONFIGPROC)get_extension_func("glXGetVisualFromFBConfig");
|
||||||
_glXGetFBConfigAttrib =
|
_glXGetFBConfigAttrib =
|
||||||
(PFNGLXGETFBCONFIGATTRIBPROC)get_extension_func("glX", "GetFBConfigAttrib");
|
(PFNGLXGETFBCONFIGATTRIBPROC)get_extension_func("glXGetFBConfigAttrib");
|
||||||
_glXCreatePixmap =
|
_glXCreatePixmap =
|
||||||
(PFNGLXCREATEPIXMAPPROC)get_extension_func("glX", "CreatePixmap");
|
(PFNGLXCREATEPIXMAPPROC)get_extension_func("glXCreatePixmap");
|
||||||
|
|
||||||
if (_glXChooseFBConfig == NULL ||
|
if (_glXChooseFBConfig == NULL ||
|
||||||
_glXCreateNewContext == NULL ||
|
_glXCreateNewContext == NULL ||
|
||||||
_glXGetVisualFromFBConfig == NULL ||
|
_glXGetVisualFromFBConfig == NULL ||
|
||||||
@ -445,18 +447,18 @@ reset() {
|
|||||||
// the same, but the function names are different--we just remap
|
// the same, but the function names are different--we just remap
|
||||||
// them to the same function pointers.
|
// them to the same function pointers.
|
||||||
_supports_fbconfig = true;
|
_supports_fbconfig = true;
|
||||||
|
|
||||||
_glXChooseFBConfig =
|
_glXChooseFBConfig =
|
||||||
(PFNGLXCHOOSEFBCONFIGPROC)get_extension_func("glX", "ChooseFBConfigSGIX");
|
(PFNGLXCHOOSEFBCONFIGPROC)get_extension_func("glXChooseFBConfigSGIX");
|
||||||
_glXCreateNewContext =
|
_glXCreateNewContext =
|
||||||
(PFNGLXCREATENEWCONTEXTPROC)get_extension_func("glX", "CreateContextWithConfigSGIX");
|
(PFNGLXCREATENEWCONTEXTPROC)get_extension_func("glXCreateContextWithConfigSGIX");
|
||||||
_glXGetVisualFromFBConfig =
|
_glXGetVisualFromFBConfig =
|
||||||
(PFNGLXGETVISUALFROMFBCONFIGPROC)get_extension_func("glX", "GetVisualFromFBConfigSGIX");
|
(PFNGLXGETVISUALFROMFBCONFIGPROC)get_extension_func("glXGetVisualFromFBConfigSGIX");
|
||||||
_glXGetFBConfigAttrib =
|
_glXGetFBConfigAttrib =
|
||||||
(PFNGLXGETFBCONFIGATTRIBPROC)get_extension_func("glX", "GetFBConfigAttribSGIX");
|
(PFNGLXGETFBCONFIGATTRIBPROC)get_extension_func("glXGetFBConfigAttribSGIX");
|
||||||
_glXCreatePixmap =
|
_glXCreatePixmap =
|
||||||
(PFNGLXCREATEPIXMAPPROC)get_extension_func("glX", "CreateGLXPixmapWithConfigSGIX");
|
(PFNGLXCREATEPIXMAPPROC)get_extension_func("glXCreateGLXPixmapWithConfigSGIX");
|
||||||
|
|
||||||
if (_glXChooseFBConfig == NULL ||
|
if (_glXChooseFBConfig == NULL ||
|
||||||
_glXCreateNewContext == NULL ||
|
_glXCreateNewContext == NULL ||
|
||||||
_glXGetVisualFromFBConfig == NULL ||
|
_glXGetVisualFromFBConfig == NULL ||
|
||||||
@ -467,36 +469,36 @@ reset() {
|
|||||||
_supports_fbconfig = false;
|
_supports_fbconfig = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glx_is_at_least_version(1, 3)) {
|
if (glx_is_at_least_version(1, 3)) {
|
||||||
// If we have glx 1.3 or better, we have the PBuffer interface.
|
// If we have glx 1.3 or better, we have the PBuffer interface.
|
||||||
_supports_pbuffer = true;
|
_supports_pbuffer = true;
|
||||||
_uses_sgix_pbuffer = false;
|
_uses_sgix_pbuffer = false;
|
||||||
|
|
||||||
_glXCreatePbuffer =
|
_glXCreatePbuffer =
|
||||||
(PFNGLXCREATEPBUFFERPROC)get_extension_func("glX", "CreatePbuffer");
|
(PFNGLXCREATEPBUFFERPROC)get_extension_func("glXCreatePbuffer");
|
||||||
_glXCreateGLXPbufferSGIX = NULL;
|
_glXCreateGLXPbufferSGIX = NULL;
|
||||||
_glXDestroyPbuffer =
|
_glXDestroyPbuffer =
|
||||||
(PFNGLXDESTROYPBUFFERPROC)get_extension_func("glX", "DestroyPbuffer");
|
(PFNGLXDESTROYPBUFFERPROC)get_extension_func("glXDestroyPbuffer");
|
||||||
if (_glXCreatePbuffer == NULL ||
|
if (_glXCreatePbuffer == NULL ||
|
||||||
_glXDestroyPbuffer == NULL) {
|
_glXDestroyPbuffer == NULL) {
|
||||||
glxdisplay_cat.error()
|
glxdisplay_cat.error()
|
||||||
<< "Driver claims to support GLX_pbuffer extension, but does not define all functions.\n";
|
<< "Driver claims to support GLX_pbuffer extension, but does not define all functions.\n";
|
||||||
_supports_pbuffer = false;
|
_supports_pbuffer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (has_extension("GLX_SGIX_pbuffer")) {
|
} else if (has_extension("GLX_SGIX_pbuffer")) {
|
||||||
// Or maybe we have the old SGIX extension for PBuffers.
|
// Or maybe we have the old SGIX extension for PBuffers.
|
||||||
_uses_sgix_pbuffer = true;
|
_uses_sgix_pbuffer = true;
|
||||||
|
|
||||||
// CreatePbuffer has a different form between SGIX and 1.3,
|
// CreatePbuffer has a different form between SGIX and 1.3,
|
||||||
// however, so we must treat it specially. But we can use the
|
// however, so we must treat it specially. But we can use the
|
||||||
// same function pointer for DestroyPbuffer.
|
// same function pointer for DestroyPbuffer.
|
||||||
_glXCreatePbuffer = NULL;
|
_glXCreatePbuffer = NULL;
|
||||||
_glXCreateGLXPbufferSGIX =
|
_glXCreateGLXPbufferSGIX =
|
||||||
(PFNGLXCREATEGLXPBUFFERSGIXPROC)get_extension_func("glX", "CreateGLXPbufferSGIX");
|
(PFNGLXCREATEGLXPBUFFERSGIXPROC)get_extension_func("glXCreateGLXPbufferSGIX");
|
||||||
_glXDestroyPbuffer =
|
_glXDestroyPbuffer =
|
||||||
(PFNGLXDESTROYPBUFFERPROC)get_extension_func("glX", "DestroyGLXPbufferSGIX");
|
(PFNGLXDESTROYPBUFFERPROC)get_extension_func("glXDestroyGLXPbufferSGIX");
|
||||||
if (_glXCreateGLXPbufferSGIX == NULL ||
|
if (_glXCreateGLXPbufferSGIX == NULL ||
|
||||||
_glXDestroyPbuffer == NULL) {
|
_glXDestroyPbuffer == NULL) {
|
||||||
glxdisplay_cat.error()
|
glxdisplay_cat.error()
|
||||||
@ -625,41 +627,39 @@ get_extra_extensions() {
|
|||||||
// not defined.
|
// not defined.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void *glxGraphicsStateGuardian::
|
void *glxGraphicsStateGuardian::
|
||||||
do_get_extension_func(const char *prefix, const char *name) {
|
do_get_extension_func(const char *name) {
|
||||||
nassertr(prefix != NULL, NULL);
|
|
||||||
nassertr(name != NULL, NULL);
|
nassertr(name != NULL, NULL);
|
||||||
string fullname = string(prefix) + string(name);
|
|
||||||
|
|
||||||
if (glx_get_proc_address) {
|
if (glx_get_proc_address) {
|
||||||
// First, check if we have glXGetProcAddress available. This will
|
// First, check if we have glXGetProcAddress available. This will
|
||||||
// be superior if we can get it.
|
// be superior if we can get it.
|
||||||
|
|
||||||
#if defined(LINK_IN_GLXGETPROCADDRESS) && defined(HAVE_GLXGETPROCADDRESS)
|
#if defined(LINK_IN_GLXGETPROCADDRESS) && defined(HAVE_GLXGETPROCADDRESS)
|
||||||
// If we are confident the system headers defined it, we can
|
// If we are confident the system headers defined it, we can
|
||||||
// call it directly. This is more reliable than trying to
|
// call it directly. This is more reliable than trying to
|
||||||
// determine its address dynamically, but it may make
|
// determine its address dynamically, but it may make
|
||||||
// libpandagl.so fail to load if the symbol isn't in the runtime
|
// libpandagl.so fail to load if the symbol isn't in the runtime
|
||||||
// library.
|
// library.
|
||||||
return (void *)glXGetProcAddress((const GLubyte *)fullname.c_str());
|
return (void *)glXGetProcAddress((const GLubyte *)name);
|
||||||
|
|
||||||
#elif defined(LINK_IN_GLXGETPROCADDRESS) && defined(HAVE_GLXGETPROCADDRESSARB)
|
#elif defined(LINK_IN_GLXGETPROCADDRESS) && defined(HAVE_GLXGETPROCADDRESSARB)
|
||||||
// The ARB extension version is OK too. Sometimes the prototype
|
// The ARB extension version is OK too. Sometimes the prototype
|
||||||
// isn't supplied for some reason.
|
// isn't supplied for some reason.
|
||||||
return (void *)glXGetProcAddressARB((const GLubyte *)fullname.c_str());
|
return (void *)glXGetProcAddressARB((const GLubyte *)name);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// Otherwise, we have to fiddle around with the dynamic runtime.
|
// Otherwise, we have to fiddle around with the dynamic runtime.
|
||||||
|
|
||||||
if (!_checked_get_proc_address) {
|
if (!_checked_get_proc_address) {
|
||||||
const char *funcName = NULL;
|
const char *funcName = NULL;
|
||||||
|
|
||||||
if (glx_is_at_least_version(1, 4)) {
|
if (glx_is_at_least_version(1, 4)) {
|
||||||
funcName = "glXGetProcAddress";
|
funcName = "glXGetProcAddress";
|
||||||
|
|
||||||
} else if (has_extension("GLX_ARB_get_proc_address")) {
|
} else if (has_extension("GLX_ARB_get_proc_address")) {
|
||||||
funcName = "glXGetProcAddressARB";
|
funcName = "glXGetProcAddressARB";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (funcName != NULL) {
|
if (funcName != NULL) {
|
||||||
_glXGetProcAddress = (PFNGLXGETPROCADDRESSPROC)get_system_func(funcName);
|
_glXGetProcAddress = (PFNGLXGETPROCADDRESSPROC)get_system_func(funcName);
|
||||||
if (_glXGetProcAddress == NULL) {
|
if (_glXGetProcAddress == NULL) {
|
||||||
@ -671,16 +671,16 @@ do_get_extension_func(const char *prefix, const char *name) {
|
|||||||
|
|
||||||
_checked_get_proc_address = true;
|
_checked_get_proc_address = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use glxGetProcAddress() if we've got it; it should be more robust.
|
// Use glxGetProcAddress() if we've got it; it should be more robust.
|
||||||
if (_glXGetProcAddress != NULL) {
|
if (_glXGetProcAddress != NULL) {
|
||||||
return (void *)_glXGetProcAddress((const GLubyte *)fullname.c_str());
|
return (void *)_glXGetProcAddress((const GLubyte *)name);
|
||||||
}
|
}
|
||||||
#endif // HAVE_GLXGETPROCADDRESS
|
#endif // HAVE_GLXGETPROCADDRESS
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, fall back to the OS-provided calls.
|
// Otherwise, fall back to the OS-provided calls.
|
||||||
return PosixGraphicsStateGuardian::do_get_extension_func(prefix, name);
|
return PosixGraphicsStateGuardian::do_get_extension_func(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -759,17 +759,17 @@ choose_temp_visual(const FrameBufferProperties &properties) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (best_quality > 0) {
|
if (best_quality > 0) {
|
||||||
_visual = _visuals + best_result;
|
_visual = _visuals + best_result;
|
||||||
_temp_context = glXCreateContext(_display, _visual, None, GL_TRUE);
|
_temp_context = glXCreateContext(_display, _visual, None, GL_TRUE);
|
||||||
if (_temp_context) {
|
if (_temp_context) {
|
||||||
_fbprops = best_props;
|
_fbprops = best_props;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glxdisplay_cat.error()
|
glxdisplay_cat.error()
|
||||||
<< "Could not find a usable pixel format.\n";
|
<< "Could not find a usable pixel format.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -828,7 +828,7 @@ destroy_temp_xwindow() {
|
|||||||
_temp_xwindow = (X11_Window)NULL;
|
_temp_xwindow = (X11_Window)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_temp_context != (GLXContext)NULL){
|
if (_temp_context != (GLXContext)NULL) {
|
||||||
glXDestroyContext(_display, _temp_context);
|
glXDestroyContext(_display, _temp_context);
|
||||||
_temp_context = (GLXContext)NULL;
|
_temp_context = (GLXContext)NULL;
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ protected:
|
|||||||
|
|
||||||
virtual void query_gl_version();
|
virtual void query_gl_version();
|
||||||
virtual void get_extra_extensions();
|
virtual void get_extra_extensions();
|
||||||
virtual void *do_get_extension_func(const char *prefix, const char *name);
|
virtual void *do_get_extension_func(const char *name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void show_glx_client_string(const string &name, int id);
|
void show_glx_client_string(const string &name, int id);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -53,13 +53,11 @@ PosixGraphicsStateGuardian::
|
|||||||
// not defined.
|
// not defined.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void *PosixGraphicsStateGuardian::
|
void *PosixGraphicsStateGuardian::
|
||||||
do_get_extension_func(const char *prefix, const char *name) {
|
do_get_extension_func(const char *name) {
|
||||||
nassertr(prefix != NULL, NULL);
|
|
||||||
nassertr(name != NULL, NULL);
|
nassertr(name != NULL, NULL);
|
||||||
string fullname = string(prefix) + string(name);
|
|
||||||
|
|
||||||
if (glx_get_os_address) {
|
if (glx_get_os_address) {
|
||||||
return get_system_func(fullname.c_str());
|
return get_system_func(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
~PosixGraphicsStateGuardian();
|
~PosixGraphicsStateGuardian();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void *do_get_extension_func(const char *prefix, const char *name);
|
virtual void *do_get_extension_func(const char *name);
|
||||||
void *get_system_func(const char *name);
|
void *get_system_func(const char *name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -38,14 +38,14 @@ TypeHandle osxGraphicsStateGuardian::_type_handle;
|
|||||||
// not defined.
|
// not defined.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void *osxGraphicsStateGuardian::
|
void *osxGraphicsStateGuardian::
|
||||||
do_get_extension_func(const char *prefix, const char *name) {
|
do_get_extension_func(const char *name) {
|
||||||
string fullname = "_" + string(prefix) + string(name);
|
string fullname = "_" + string(name);
|
||||||
NSSymbol symbol = NULL;
|
NSSymbol symbol = NULL;
|
||||||
|
|
||||||
if (NSIsSymbolNameDefined (fullname.c_str())) {
|
if (NSIsSymbolNameDefined(fullname.c_str())) {
|
||||||
symbol = NSLookupAndBindSymbol (fullname.c_str());
|
symbol = NSLookupAndBindSymbol(fullname.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return symbol ? NSAddressOfSymbol(symbol) : NULL;
|
return symbol ? NSAddressOfSymbol(symbol) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#define __glext_h_
|
#define __glext_h_
|
||||||
#include <OpenGL/gl.h>
|
#include <OpenGL/gl.h>
|
||||||
#include <AGL/agl.h>
|
#include <AGL/agl.h>
|
||||||
|
|
||||||
#include "pandabase.h"
|
#include "pandabase.h"
|
||||||
#include "glgsg.h"
|
#include "glgsg.h"
|
||||||
|
|
||||||
@ -38,20 +38,20 @@ public:
|
|||||||
virtual void reset();
|
virtual void reset();
|
||||||
|
|
||||||
void draw_resize_box();
|
void draw_resize_box();
|
||||||
|
|
||||||
bool get_gamma_table();
|
bool get_gamma_table();
|
||||||
bool static_set_gamma(bool restore, PN_stdfloat gamma);
|
bool static_set_gamma(bool restore, PN_stdfloat gamma);
|
||||||
bool set_gamma(PN_stdfloat gamma);
|
bool set_gamma(PN_stdfloat gamma);
|
||||||
void atexit_function();
|
void atexit_function();
|
||||||
void restore_gamma();
|
void restore_gamma();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void *do_get_extension_func(const char *prefix, const char *name);
|
virtual void *do_get_extension_func(const char *name);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OSStatus build_gl(bool full_screen, bool pbuffer, FrameBufferProperties &fb_props);
|
OSStatus build_gl(bool full_screen, bool pbuffer, FrameBufferProperties &fb_props);
|
||||||
AGLContext get_context() { return _aglcontext; };
|
AGLContext get_context() { return _aglcontext; };
|
||||||
|
|
||||||
const AGLPixelFormat get_agl_pixel_format() const { return _aglPixFmt; };
|
const AGLPixelFormat get_agl_pixel_format() const { return _aglPixFmt; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -583,9 +583,8 @@ get_extra_extensions() {
|
|||||||
// not defined.
|
// not defined.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void *wglGraphicsStateGuardian::
|
void *wglGraphicsStateGuardian::
|
||||||
do_get_extension_func(const char *prefix, const char *name) {
|
do_get_extension_func(const char *name) {
|
||||||
string fullname = string(prefix) + string(name);
|
return (void*) wglGetProcAddress(name);
|
||||||
return (void*) wglGetProcAddress(fullname.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void get_extra_extensions();
|
virtual void get_extra_extensions();
|
||||||
virtual void *do_get_extension_func(const char *prefix, const char *name);
|
virtual void *do_get_extension_func(const char *name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void make_context(HDC hdc);
|
void make_context(HDC hdc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user