mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
This commit adds more+better support for OpenGL ES:
* Support for many OES extensions * Support for OpenGL ES 2.x * Compile fixes for OpenGL ES 1.x * Support for FBO's in both versions
This commit is contained in:
parent
7bb2991ccb
commit
cbe036c849
@ -37,7 +37,7 @@ CLP(GeomContext)::
|
||||
bool CLP(GeomContext)::
|
||||
get_display_list(GLuint &index, const CLP(GeomMunger) *munger,
|
||||
UpdateSeq modified) {
|
||||
#ifdef OPENGLES_1
|
||||
#ifdef OPENGLES
|
||||
// Display lists not supported by OpenGL ES.
|
||||
nassertr(false, false);
|
||||
return false;
|
||||
@ -56,7 +56,7 @@ get_display_list(GLuint &index, const CLP(GeomMunger) *munger,
|
||||
index = dl._index;
|
||||
dl._modified = modified;
|
||||
return list_current;
|
||||
#endif // OPENGLES_1
|
||||
#endif // OPENGLES
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -68,7 +68,7 @@ get_display_list(GLuint &index, const CLP(GeomMunger) *munger,
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CLP(GeomContext)::
|
||||
release_display_lists() {
|
||||
#ifdef OPENGLES_1
|
||||
#ifdef OPENGLES
|
||||
// Display lists not supported by OpenGL ES.
|
||||
nassertv(_display_lists.empty());
|
||||
|
||||
@ -91,7 +91,7 @@ release_display_lists() {
|
||||
}
|
||||
|
||||
_display_lists.clear();
|
||||
#endif // OPENGLES_1
|
||||
#endif // OPENGLES
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -10,9 +10,33 @@
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
TypeHandle CLP(GraphicsBuffer)::_type_handle;
|
||||
|
||||
// This helps to keep the source clean of hundreds of #ifdefs.
|
||||
#ifdef OPENGLES_2
|
||||
#define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER
|
||||
#define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER
|
||||
#else
|
||||
#ifdef OPENGLES_1
|
||||
#define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
|
||||
#define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER_OES
|
||||
#define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER_OES
|
||||
#define GL_RENDERBUFFER GL_RENDERBUFFER_OES
|
||||
#define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
|
||||
#define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_OES
|
||||
#define GL_STENCIL_ATTACHMENT GL_STENCIL_ATTACHMENT_OES
|
||||
#define GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES
|
||||
#define GL_FRAMEBUFFER_UNSUPPORTED GL_FRAMEBUFFER_UNSUPPORTED_OES
|
||||
#define GL_DEPTH_STENCIL GL_DEPTH_STENCIL_OES
|
||||
#endif
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: glGraphicsBuffer::Constructor
|
||||
// Access: Public
|
||||
@ -173,26 +197,28 @@ check_fbo() {
|
||||
CLP(GraphicsStateGuardian) *glgsg;
|
||||
DCAST_INTO_R(glgsg, _gsg, false);
|
||||
|
||||
GLenum status = glgsg->_glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
GLenum status = glgsg->_glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
||||
GLCAT.error() << "EXT_framebuffer_object reports non-framebuffer-completeness.\n";
|
||||
switch(status) {
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT\n"; break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT\n"; break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT\n"; break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_FORMATS_EXT\n"; break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT\n"; break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT\n"; break;
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
|
||||
GLCAT.error() << "FRAMEBUFFER_UNSUPPORTED_EXT\n"; break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT\n"; break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_ATTACHMENT\n"; break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\n"; break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_DIMENSIONS\n"; break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_FORMATS\n"; break;
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED:
|
||||
GLCAT.error() << "FRAMEBUFFER_UNSUPPORTED\n"; break;
|
||||
#ifndef OPENGLES
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER\n"; break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_READ_BUFFER\n"; break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
|
||||
GLCAT.error() << "FRAMEBUFFER_INCOMPLETE_MULTISAMPLE\n"; break;
|
||||
#endif
|
||||
default:
|
||||
GLCAT.error() << "OTHER PROBLEM\n"; break;
|
||||
}
|
||||
@ -307,10 +333,11 @@ rebuild_bitplanes() {
|
||||
|
||||
// For all slots, update the slot.
|
||||
|
||||
// bind_slot(rb_resize, attach, RTP_depth_stencil, GL_DEPTH_ATTACHMENT_EXT);
|
||||
bind_slot(rb_resize, attach, RTP_depth, GL_DEPTH_ATTACHMENT_EXT);
|
||||
bind_slot(rb_resize, attach, RTP_color, GL_COLOR_ATTACHMENT0_EXT);
|
||||
int next = GL_COLOR_ATTACHMENT1_EXT;
|
||||
// bind_slot(rb_resize, attach, RTP_depth_stencil, GL_DEPTH_ATTACHMENT);
|
||||
bind_slot(rb_resize, attach, RTP_depth, GL_DEPTH_ATTACHMENT);
|
||||
bind_slot(rb_resize, attach, RTP_color, GL_COLOR_ATTACHMENT0);
|
||||
#ifndef OPENGLES
|
||||
int next = GL_COLOR_ATTACHMENT1;
|
||||
for (int i=0; i<_fb_properties.get_aux_rgba(); i++) {
|
||||
bind_slot(rb_resize, attach, (RenderTexturePlane)(RTP_aux_rgba_0+i), next);
|
||||
next += 1;
|
||||
@ -323,15 +350,17 @@ rebuild_bitplanes() {
|
||||
bind_slot(rb_resize, attach, (RenderTexturePlane)(RTP_aux_float_0+i), next);
|
||||
next += 1;
|
||||
}
|
||||
#endif // OPENGLES_2
|
||||
// Setup any required multisample buffers.
|
||||
if (_requested_multisamples) {
|
||||
if (_fbo_multisample == 0) {
|
||||
glgsg->_glGenFramebuffers(1, &_fbo_multisample);
|
||||
}
|
||||
glgsg->bind_fbo(_fbo_multisample);
|
||||
bind_slot(rb_resize, attach, RTP_depth, GL_DEPTH_ATTACHMENT_EXT);
|
||||
bind_slot_multisample(rb_resize, attach, RTP_color, GL_COLOR_ATTACHMENT0_EXT);
|
||||
int next = GL_COLOR_ATTACHMENT1_EXT;
|
||||
bind_slot(rb_resize, attach, RTP_depth, GL_DEPTH_ATTACHMENT);
|
||||
bind_slot_multisample(rb_resize, attach, RTP_color, GL_COLOR_ATTACHMENT0);
|
||||
#ifndef OPENGLES
|
||||
int next = GL_COLOR_ATTACHMENT1;
|
||||
for (int i=0; i<_fb_properties.get_aux_rgba(); i++) {
|
||||
bind_slot_multisample(rb_resize, attach, (RenderTexturePlane)(RTP_aux_rgba_0+i), next);
|
||||
next += 1;
|
||||
@ -344,10 +373,10 @@ rebuild_bitplanes() {
|
||||
bind_slot_multisample(rb_resize, attach, (RenderTexturePlane)(RTP_aux_float_0+i), next);
|
||||
next += 1;
|
||||
}
|
||||
glEnable(GL_MULTISAMPLE_ARB);
|
||||
}
|
||||
else {
|
||||
glDisable(GL_MULTISAMPLE_ARB);
|
||||
glEnable(GL_MULTISAMPLE);
|
||||
} else {
|
||||
glDisable(GL_MULTISAMPLE);
|
||||
#endif // OPENGLES_2
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -367,7 +396,7 @@ rebuild_bitplanes() {
|
||||
}
|
||||
|
||||
if (update) {
|
||||
int color_attachment = GL_COLOR_ATTACHMENT0_EXT;
|
||||
int color_attachment = GL_COLOR_ATTACHMENT0;
|
||||
|
||||
for (int i=0; i<count_textures(); i++) {
|
||||
// Do we really need the following lines?
|
||||
@ -391,8 +420,8 @@ rebuild_bitplanes() {
|
||||
// also case RTP_depth_stencil
|
||||
for (int f = 0; f < 6; f++) {
|
||||
glgsg -> bind_fbo(_cubemap_fbo [f]);
|
||||
glgsg -> _glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + f,
|
||||
glgsg -> _glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X + f,
|
||||
gtc->_index, 0);
|
||||
}
|
||||
break;
|
||||
@ -412,8 +441,8 @@ rebuild_bitplanes() {
|
||||
case RTP_aux_float_3:
|
||||
for (int f = 0; f < 6; f++) {
|
||||
glgsg -> bind_fbo(_cubemap_fbo [f]);
|
||||
glgsg -> _glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, color_attachment,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + f,
|
||||
glgsg -> _glFramebufferTexture2D(GL_FRAMEBUFFER, color_attachment,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X + f,
|
||||
gtc->_index, 0);
|
||||
}
|
||||
color_attachment++;
|
||||
@ -428,15 +457,17 @@ rebuild_bitplanes() {
|
||||
glgsg -> bind_fbo(_cubemap_fbo [0]);
|
||||
}
|
||||
|
||||
#ifndef OPENGLES
|
||||
if ( (_fb_properties.get_rgb_color() > 0) ||
|
||||
(_fb_properties.get_aux_hrgba() > 0) ) {
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||
}
|
||||
else {
|
||||
glDrawBuffer(GL_NONE);
|
||||
glReadBuffer(GL_NONE);
|
||||
}
|
||||
#endif
|
||||
|
||||
_cube_face_active = 0;
|
||||
report_my_gl_errors();
|
||||
@ -461,12 +492,14 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, GLenum atta
|
||||
case RTP_aux_rgba_3:
|
||||
glFormat = GL_RGBA;
|
||||
break;
|
||||
#ifndef OPENGLES_2
|
||||
case RTP_aux_hrgba_0:
|
||||
case RTP_aux_hrgba_1:
|
||||
case RTP_aux_hrgba_2:
|
||||
case RTP_aux_hrgba_3:
|
||||
glFormat = GL_RGBA16F_ARB;
|
||||
break;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@ -486,7 +519,7 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, GLenum atta
|
||||
tex->set_y_size(_rb_size_y);
|
||||
tex->set_pad_size(_rb_size_x - _x_size, _rb_size_y - _y_size);
|
||||
_use_depth_stencil = false;
|
||||
if (attachpoint == GL_DEPTH_ATTACHMENT_EXT) {
|
||||
if (attachpoint == GL_DEPTH_ATTACHMENT) {
|
||||
if ( _gsg->get_supports_depth_stencil() && tex->get_format() == Texture::F_depth_stencil ) {
|
||||
tex->set_component_type(Texture::T_unsigned_int_24_8);
|
||||
_use_depth_stencil = true;
|
||||
@ -496,39 +529,44 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, GLenum atta
|
||||
CLP(TextureContext) *gtc = DCAST(CLP(TextureContext), tc);
|
||||
glgsg->update_texture(tc, true);
|
||||
if (tex->get_texture_type() == Texture::TT_2d_texture) {
|
||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
GL_TEXTURE_2D, gtc->_index, 0);
|
||||
} else {
|
||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
|
||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X,
|
||||
gtc->_index, 0);
|
||||
}
|
||||
if (_use_depth_stencil) {
|
||||
if (tex->get_texture_type() == Texture::TT_2d_texture) {
|
||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
|
||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
GL_TEXTURE_2D, gtc->_index, 0);
|
||||
} else {
|
||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
|
||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X,
|
||||
gtc->_index, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (glFormat == GL_RGBA16F_ARB)
|
||||
#ifdef OPENGLES_2
|
||||
tex->set_format(Texture::F_rgba);
|
||||
#else
|
||||
if (glFormat == GL_RGBA16F_ARB) {
|
||||
tex->set_format(Texture::F_rgba16);
|
||||
else
|
||||
} else {
|
||||
tex->set_format(Texture::F_rgba);
|
||||
}
|
||||
#endif
|
||||
|
||||
TextureContext *tc = tex->prepare_now(glgsg->get_prepared_objects(), glgsg);
|
||||
nassertv(tc != (TextureContext *)NULL);
|
||||
CLP(TextureContext) *gtc = DCAST(CLP(TextureContext), tc);
|
||||
glgsg->update_texture(tc, true);
|
||||
if (tex->get_texture_type() == Texture::TT_2d_texture) {
|
||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, attachpoint,
|
||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER, attachpoint,
|
||||
GL_TEXTURE_2D, gtc->_index, 0);
|
||||
} else {
|
||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, attachpoint,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
|
||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER, attachpoint,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X,
|
||||
gtc->_index, 0);
|
||||
}
|
||||
}
|
||||
@ -556,12 +594,13 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, GLenum atta
|
||||
}
|
||||
|
||||
// Allocate and bind the renderbuffer.
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, _rb[slot]);
|
||||
if (attachpoint == GL_DEPTH_ATTACHMENT_EXT) {
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER, _rb[slot]);
|
||||
if (attachpoint == GL_DEPTH_ATTACHMENT) {
|
||||
#ifndef OPENGLES_2
|
||||
if (_gsg->get_supports_depth_stencil() && slot == RTP_depth_stencil) {
|
||||
glgsg->_glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_STENCIL_EXT,
|
||||
glgsg->_glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_STENCIL,
|
||||
_rb_size_x, _rb_size_y);
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, 0);
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
|
||||
GLuint rb;
|
||||
|
||||
@ -570,15 +609,16 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, GLenum atta
|
||||
rb = _shared_depth_buffer -> _rb[slot];
|
||||
}
|
||||
|
||||
glgsg->_glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
GL_RENDERBUFFER, rb);
|
||||
|
||||
glgsg->_glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
GL_RENDERBUFFER, rb);
|
||||
} else {
|
||||
glgsg->_glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT,
|
||||
#endif
|
||||
glgsg->_glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT,
|
||||
_rb_size_x, _rb_size_y);
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, 0);
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
|
||||
GLuint rb;
|
||||
|
||||
@ -587,15 +627,17 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, GLenum atta
|
||||
rb = _shared_depth_buffer -> _rb[slot];
|
||||
}
|
||||
|
||||
glgsg->_glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
GL_RENDERBUFFER, rb);
|
||||
#ifndef OPENGLES_2
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
glgsg->_glRenderbufferStorage(GL_RENDERBUFFER_EXT, glFormat,
|
||||
glgsg->_glRenderbufferStorage(GL_RENDERBUFFER, glFormat,
|
||||
_rb_size_x, _rb_size_y);
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, 0);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, attachpoint,
|
||||
GL_RENDERBUFFER_EXT, _rb[slot]);
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachpoint,
|
||||
GL_RENDERBUFFER, _rb[slot]);
|
||||
}
|
||||
|
||||
// Toss any texture that was connected to the slot.
|
||||
@ -613,95 +655,115 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, GLenum atta
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CLP(GraphicsBuffer)::
|
||||
bind_slot_multisample(bool rb_resize, Texture **attach, RenderTexturePlane slot, GLenum attachpoint) {
|
||||
CLP(GraphicsStateGuardian) *glgsg;
|
||||
DCAST_INTO_V(glgsg, _gsg);
|
||||
CLP(GraphicsStateGuardian) *glgsg;
|
||||
DCAST_INTO_V(glgsg, _gsg);
|
||||
|
||||
if ((_rbm[slot] != 0)&&(!rb_resize)) {
|
||||
return;
|
||||
}
|
||||
if (_rbm[slot] != 0) {
|
||||
glgsg->_glDeleteRenderbuffers(1, &(_rbm[slot]));
|
||||
_rbm[slot] = 0;
|
||||
}
|
||||
glgsg->_glBindFramebuffer(GL_FRAMEBUFFER_EXT, _fbo_multisample);
|
||||
glgsg->_glGenRenderbuffers(1, &(_rbm[slot]));
|
||||
// Allocate and bind the renderbuffer.
|
||||
Texture *tex = attach[slot];// if there is a texture map, use it's format as needed.
|
||||
if ((_rbm[slot] != 0)&&(!rb_resize)) {
|
||||
return;
|
||||
}
|
||||
if (_rbm[slot] != 0) {
|
||||
glgsg->_glDeleteRenderbuffers(1, &(_rbm[slot]));
|
||||
_rbm[slot] = 0;
|
||||
}
|
||||
glgsg->_glBindFramebuffer(GL_FRAMEBUFFER, _fbo_multisample);
|
||||
glgsg->_glGenRenderbuffers(1, &(_rbm[slot]));
|
||||
// Allocate and bind the renderbuffer.
|
||||
Texture *tex = attach[slot];// if there is a texture map, use it's format as needed.
|
||||
|
||||
if (attachpoint == GL_DEPTH_ATTACHMENT_EXT) {
|
||||
if ( _gsg->get_supports_depth_stencil() && _use_depth_stencil ) {
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, _rbm[slot]);
|
||||
if (_requested_coverage_samples)
|
||||
glgsg->_glRenderbufferStorageMultisampleCoverage(GL_RENDERBUFFER_EXT, _requested_coverage_samples,
|
||||
_requested_multisamples, GL_DEPTH_STENCIL_EXT,
|
||||
_rb_size_x, _rb_size_y);
|
||||
else
|
||||
glgsg->_glRenderbufferStorageMultisample(GL_RENDERBUFFER_EXT, _requested_multisamples, GL_DEPTH_STENCIL_EXT,
|
||||
_rb_size_x, _rb_size_y);
|
||||
GLint givenSamples = -1;
|
||||
glgsg->_glGetRenderbufferParameteriv( GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_SAMPLES_EXT, &givenSamples);
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, 0);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, _rbm[slot]);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, _rbm[slot]);
|
||||
} else {
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, _rbm[slot]);
|
||||
GLuint format = GL_DEPTH_COMPONENT;
|
||||
if (tex)
|
||||
{
|
||||
if (tex->get_format() == Texture::F_depth_component16)
|
||||
format = GL_DEPTH_COMPONENT16;
|
||||
if (tex->get_format() == Texture::F_depth_component24)
|
||||
format = GL_DEPTH_COMPONENT24;
|
||||
if (tex->get_format() == Texture::F_depth_component32)
|
||||
format = GL_DEPTH_COMPONENT32;
|
||||
}
|
||||
if (_requested_coverage_samples)
|
||||
glgsg->_glRenderbufferStorageMultisampleCoverage(GL_RENDERBUFFER_EXT, _requested_coverage_samples,
|
||||
_requested_multisamples, format,
|
||||
_rb_size_x, _rb_size_y);
|
||||
else
|
||||
glgsg->_glRenderbufferStorageMultisample(GL_RENDERBUFFER_EXT, _requested_multisamples, format,
|
||||
_rb_size_x, _rb_size_y);
|
||||
GLint givenSamples = -1;
|
||||
glgsg->_glGetRenderbufferParameteriv( GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_SAMPLES_EXT, &givenSamples);
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, 0);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, _rbm[slot]);
|
||||
if (attachpoint == GL_DEPTH_ATTACHMENT) {
|
||||
#ifndef OPENGLES_2
|
||||
if (_gsg->get_supports_depth_stencil() && _use_depth_stencil) {
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER, _rbm[slot]);
|
||||
if (_requested_coverage_samples)
|
||||
glgsg->_glRenderbufferStorageMultisampleCoverage(GL_RENDERBUFFER, _requested_coverage_samples,
|
||||
_requested_multisamples, GL_DEPTH_STENCIL,
|
||||
_rb_size_x, _rb_size_y);
|
||||
else
|
||||
glgsg->_glRenderbufferStorageMultisample(GL_RENDERBUFFER, _requested_multisamples, GL_DEPTH_STENCIL,
|
||||
_rb_size_x, _rb_size_y);
|
||||
GLint givenSamples = -1;
|
||||
#ifndef OPENGLES
|
||||
glgsg->_glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_SAMPLES, &givenSamples);
|
||||
#endif // OPENGLES
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
GL_RENDERBUFFER, _rbm[slot]);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
GL_RENDERBUFFER, _rbm[slot]);
|
||||
} else {
|
||||
#endif // OPENGLES_2
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER, _rbm[slot]);
|
||||
GLuint format = GL_DEPTH_COMPONENT;
|
||||
if (tex) {
|
||||
if (tex->get_format() == Texture::F_depth_component16)
|
||||
#ifdef OPENGLES_1
|
||||
format = GL_DEPTH_COMPONENT16_OES;
|
||||
#else // OPENGLES_1
|
||||
format = GL_DEPTH_COMPONENT16;
|
||||
#endif
|
||||
if (tex->get_format() == Texture::F_depth_component24)
|
||||
#ifdef OPENGLES
|
||||
format = GL_DEPTH_COMPONENT24_OES;
|
||||
if (tex->get_format() == Texture::F_depth_component32)
|
||||
format = GL_DEPTH_COMPONENT32_OES;
|
||||
#else
|
||||
format = GL_DEPTH_COMPONENT24;
|
||||
if (tex->get_format() == Texture::F_depth_component32)
|
||||
format = GL_DEPTH_COMPONENT32;
|
||||
#endif // OPENGLES
|
||||
#ifndef OPENGLES_2
|
||||
}
|
||||
#endif // OPENGLES_2
|
||||
if (_requested_coverage_samples)
|
||||
glgsg->_glRenderbufferStorageMultisampleCoverage(GL_RENDERBUFFER, _requested_coverage_samples,
|
||||
_requested_multisamples, format,
|
||||
_rb_size_x, _rb_size_y);
|
||||
else
|
||||
glgsg->_glRenderbufferStorageMultisample(GL_RENDERBUFFER, _requested_multisamples, format,
|
||||
_rb_size_x, _rb_size_y);
|
||||
GLint givenSamples = -1;
|
||||
#ifndef OPENGLES
|
||||
glgsg->_glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_SAMPLES, &givenSamples);
|
||||
#endif
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
GL_RENDERBUFFER, _rbm[slot]);
|
||||
}
|
||||
else {
|
||||
Texture *Tex = attach[slot];
|
||||
GLuint glFormat = GL_RGBA;
|
||||
switch (slot) {
|
||||
case RTP_aux_rgba_0:
|
||||
case RTP_aux_rgba_1:
|
||||
case RTP_aux_rgba_2:
|
||||
case RTP_aux_rgba_3:
|
||||
glFormat = GL_RGBA;
|
||||
break;
|
||||
case RTP_aux_hrgba_0:
|
||||
case RTP_aux_hrgba_1:
|
||||
case RTP_aux_hrgba_2:
|
||||
case RTP_aux_hrgba_3:
|
||||
glFormat = GL_RGBA16F_ARB;
|
||||
break;
|
||||
};
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, _rbm[slot]);
|
||||
if (_requested_coverage_samples)
|
||||
glgsg->_glRenderbufferStorageMultisampleCoverage(GL_RENDERBUFFER_EXT, _requested_coverage_samples,
|
||||
_requested_multisamples, glFormat, _rb_size_x, _rb_size_y);
|
||||
else
|
||||
glgsg->_glRenderbufferStorageMultisample(GL_RENDERBUFFER_EXT, _requested_multisamples, glFormat,
|
||||
_rb_size_x, _rb_size_y);
|
||||
GLint givenSamples = -1;
|
||||
glgsg->_glGetRenderbufferParameteriv( GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_SAMPLES_EXT, &givenSamples);
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, 0);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER_EXT, attachpoint,
|
||||
GL_RENDERBUFFER_EXT, _rbm[slot]);
|
||||
}
|
||||
glgsg->report_my_gl_errors();
|
||||
} else {
|
||||
Texture *Tex = attach[slot];
|
||||
GLuint glFormat = GL_RGBA;
|
||||
switch (slot) {
|
||||
case RTP_aux_rgba_0:
|
||||
case RTP_aux_rgba_1:
|
||||
case RTP_aux_rgba_2:
|
||||
case RTP_aux_rgba_3:
|
||||
glFormat = GL_RGBA;
|
||||
break;
|
||||
#ifndef OPENGLES_2
|
||||
case RTP_aux_hrgba_0:
|
||||
case RTP_aux_hrgba_1:
|
||||
case RTP_aux_hrgba_2:
|
||||
case RTP_aux_hrgba_3:
|
||||
glFormat = GL_RGBA16F_ARB;
|
||||
break;
|
||||
#endif
|
||||
};
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER, _rbm[slot]);
|
||||
if (_requested_coverage_samples)
|
||||
glgsg->_glRenderbufferStorageMultisampleCoverage(GL_RENDERBUFFER, _requested_coverage_samples,
|
||||
_requested_multisamples, glFormat, _rb_size_x, _rb_size_y);
|
||||
else
|
||||
glgsg->_glRenderbufferStorageMultisample(GL_RENDERBUFFER, _requested_multisamples, glFormat,
|
||||
_rb_size_x, _rb_size_y);
|
||||
GLint givenSamples = -1;
|
||||
#ifndef OPENGLES
|
||||
glgsg->_glGetRenderbufferParameteriv( GL_RENDERBUFFER, GL_RENDERBUFFER_SAMPLES, &givenSamples);
|
||||
#endif
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, attachpoint,
|
||||
GL_RENDERBUFFER, _rbm[slot]);
|
||||
}
|
||||
glgsg->report_my_gl_errors();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -742,8 +804,7 @@ generate_mipmaps() {
|
||||
// after rendering is completed for a given frame. It
|
||||
// should do whatever finalization is required.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CLP(GraphicsBuffer)::
|
||||
end_frame(FrameMode mode, Thread *current_thread) {
|
||||
void CLP(GraphicsBuffer)::end_frame(FrameMode mode, Thread *current_thread) {
|
||||
end_frame_spam(mode);
|
||||
nassertv(_gsg != (GraphicsStateGuardian *)NULL);
|
||||
|
||||
@ -758,8 +819,8 @@ void CLP(GraphicsBuffer)::
|
||||
// Resolve Multisample rendering if using it.
|
||||
if (_requested_multisamples && _fbo_multisample) {
|
||||
glgsg->report_my_gl_errors();
|
||||
glgsg->_glBindFramebuffer( GL_DRAW_FRAMEBUFFER_EXT, _fbo );
|
||||
glgsg->_glBindFramebuffer( GL_READ_FRAMEBUFFER_EXT, _fbo_multisample );
|
||||
glgsg->_glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _fbo);
|
||||
glgsg->_glBindFramebuffer(GL_READ_FRAMEBUFFER, _fbo_multisample);
|
||||
|
||||
// If the depth buffer is shared, resolve it only on the last to render FBO.
|
||||
int do_depth_blit = 0;
|
||||
@ -774,18 +835,20 @@ void CLP(GraphicsBuffer)::
|
||||
graphics_buffer_iterator++) {
|
||||
graphics_buffer = (*graphics_buffer_iterator);
|
||||
if (graphics_buffer) {
|
||||
// this call removes the entry from the list
|
||||
if ( graphics_buffer->get_sort() >= max_sort_order ) {
|
||||
// This call removes the entry from the list
|
||||
if (graphics_buffer->get_sort() >= max_sort_order) {
|
||||
max_sort_order = graphics_buffer->get_sort();
|
||||
highest_sort_graphics_buffer = graphics_buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( max_sort_order == this->get_sort() )
|
||||
if (max_sort_order == this->get_sort()) {
|
||||
do_depth_blit = 1;
|
||||
}
|
||||
else
|
||||
}
|
||||
} else {
|
||||
do_depth_blit = 1;
|
||||
}
|
||||
#ifndef OPENGLES
|
||||
if (do_depth_blit)
|
||||
glgsg->_glBlitFramebuffer(0, 0, _rb_size_x, _rb_size_y, 0, 0, _rb_size_x, _rb_size_y,
|
||||
GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT,
|
||||
@ -795,30 +858,31 @@ void CLP(GraphicsBuffer)::
|
||||
GL_COLOR_BUFFER_BIT,
|
||||
GL_NEAREST);
|
||||
// Now handle the other color buffers.
|
||||
int next = GL_COLOR_ATTACHMENT1_EXT;
|
||||
int next = GL_COLOR_ATTACHMENT1;
|
||||
for (int i=0; i<_fb_properties.get_aux_rgba(); i++) {
|
||||
glReadBuffer( next );
|
||||
glDrawBuffer( next );
|
||||
glReadBuffer(next);
|
||||
glDrawBuffer(next);
|
||||
glgsg->_glBlitFramebuffer(0, 0, _rb_size_x, _rb_size_y, 0, 0, _rb_size_x, _rb_size_y,
|
||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
next += 1;
|
||||
}
|
||||
for (int i=0; i<_fb_properties.get_aux_hrgba(); i++) {
|
||||
glReadBuffer( next );
|
||||
glDrawBuffer( next );
|
||||
glReadBuffer(next);
|
||||
glDrawBuffer(next);
|
||||
glgsg->_glBlitFramebuffer(0, 0, _rb_size_x, _rb_size_y, 0, 0, _rb_size_x, _rb_size_y,
|
||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
next += 1;
|
||||
}
|
||||
for (int i=0; i<_fb_properties.get_aux_float(); i++) {
|
||||
glReadBuffer( next );
|
||||
glDrawBuffer( next );
|
||||
glReadBuffer(next);
|
||||
glDrawBuffer(next);
|
||||
glgsg->_glBlitFramebuffer(0, 0, _rb_size_x, _rb_size_y, 0, 0, _rb_size_x, _rb_size_y,
|
||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
next += 1;
|
||||
}
|
||||
glReadBuffer( GL_COLOR_ATTACHMENT0_EXT );
|
||||
glDrawBuffer( GL_COLOR_ATTACHMENT0_EXT );
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
#endif
|
||||
glgsg->report_my_gl_errors();
|
||||
}
|
||||
glgsg->bind_fbo(0);
|
||||
|
@ -181,6 +181,7 @@ is_at_least_gles_version(int major_version, int minor_version) const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void CLP(GraphicsStateGuardian)::
|
||||
enable_multisample_antialias(bool val) {
|
||||
#ifndef OPENGLES_2
|
||||
if (_supports_multisample) {
|
||||
if ((_multisample_mode & MM_antialias) != 0 && !val) {
|
||||
// Turn off antialias multisample.
|
||||
@ -196,6 +197,7 @@ enable_multisample_antialias(bool val) {
|
||||
_multisample_mode |= MM_antialias;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -207,6 +209,7 @@ enable_multisample_antialias(bool val) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void CLP(GraphicsStateGuardian)::
|
||||
enable_multisample_alpha_one(bool val) {
|
||||
#ifndef OPENGLES_2
|
||||
if (_supports_multisample) {
|
||||
if ((_multisample_mode & MM_alpha_one) != 0 && !val) {
|
||||
// Turn off sample_alpha_to_one multisample.
|
||||
@ -224,6 +227,7 @@ enable_multisample_alpha_one(bool val) {
|
||||
_multisample_mode |= MM_alpha_one;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -235,6 +239,7 @@ enable_multisample_alpha_one(bool val) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void CLP(GraphicsStateGuardian)::
|
||||
enable_multisample_alpha_mask(bool val) {
|
||||
#ifndef OPENGLES_2
|
||||
if (_supports_multisample) {
|
||||
if ((_multisample_mode & MM_alpha_mask) != 0 && !val) {
|
||||
// Turn off sample_alpha_to_mask multisample.
|
||||
@ -252,6 +257,7 @@ enable_multisample_alpha_mask(bool val) {
|
||||
_multisample_mode |= MM_alpha_mask;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -261,6 +267,7 @@ enable_multisample_alpha_mask(bool val) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void CLP(GraphicsStateGuardian)::
|
||||
enable_line_smooth(bool val) {
|
||||
#ifndef OPENGLES_2
|
||||
if (_line_smooth_enabled != val) {
|
||||
_state_mask.clear_bit(TransparencyAttrib::get_class_slot());
|
||||
_line_smooth_enabled = val;
|
||||
@ -270,6 +277,7 @@ enable_line_smooth(bool val) {
|
||||
GLP(Disable)(GL_LINE_SMOOTH);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -279,6 +287,7 @@ enable_line_smooth(bool val) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void CLP(GraphicsStateGuardian)::
|
||||
enable_point_smooth(bool val) {
|
||||
#ifndef OPENGLES_2
|
||||
if (_point_smooth_enabled != val) {
|
||||
_state_mask.clear_bit(TransparencyAttrib::get_class_slot());
|
||||
_point_smooth_enabled = val;
|
||||
@ -288,6 +297,7 @@ enable_point_smooth(bool val) {
|
||||
GLP(Disable)(GL_POINT_SMOOTH);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -297,7 +307,7 @@ enable_point_smooth(bool val) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void CLP(GraphicsStateGuardian)::
|
||||
enable_polygon_smooth(bool val) {
|
||||
#ifndef OPENGLES_1 // GL_POLYGON_SMOOTH not supported in OpenGL ES.
|
||||
#ifndef OPENGLES // GL_POLYGON_SMOOTH not supported in OpenGL ES.
|
||||
if (_polygon_smooth_enabled != val) {
|
||||
_polygon_smooth_enabled = val;
|
||||
if (val) {
|
||||
@ -306,7 +316,7 @@ enable_polygon_smooth(bool val) {
|
||||
GLP(Disable)(GL_POLYGON_SMOOTH);
|
||||
}
|
||||
}
|
||||
#endif // OPENGLES_1
|
||||
#endif // OPENGLES
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -462,6 +472,7 @@ enable_depth_test(bool val) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void CLP(GraphicsStateGuardian)::
|
||||
enable_fog(bool val) {
|
||||
#ifndef OPENGLES_2
|
||||
if (_fog_enabled != val) {
|
||||
_fog_enabled = val;
|
||||
if (val) {
|
||||
@ -478,6 +489,7 @@ enable_fog(bool val) {
|
||||
GLP(Disable)(GL_FOG);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -487,6 +499,7 @@ enable_fog(bool val) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void CLP(GraphicsStateGuardian)::
|
||||
enable_alpha_test(bool val) {
|
||||
#ifndef OPENGLES_2
|
||||
if (_alpha_test_enabled != val) {
|
||||
_alpha_test_enabled = val;
|
||||
if (val) {
|
||||
@ -503,6 +516,7 @@ enable_alpha_test(bool val) {
|
||||
GLP(Disable)(GL_ALPHA_TEST);
|
||||
}
|
||||
}
|
||||
#endif // OPENGLES_2
|
||||
}
|
||||
|
||||
|
||||
@ -541,7 +555,9 @@ enable_polygon_offset(bool val) {
|
||||
// Description: Convert index to gl light id
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE GLenum CLP(GraphicsStateGuardian)::get_light_id(int index) const {
|
||||
#ifndef OPENGLES_2
|
||||
return GL_LIGHT0 + index;
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -551,7 +567,9 @@ INLINE GLenum CLP(GraphicsStateGuardian)::get_light_id(int index) const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE GLenum CLP(GraphicsStateGuardian)::
|
||||
get_clip_plane_id(int index) const {
|
||||
#ifndef OPENGLES_2
|
||||
return GL_CLIP_PLANE0 + index;
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -94,7 +94,11 @@ typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebu
|
||||
typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target);
|
||||
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
#ifdef OPENGLES_2
|
||||
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
|
||||
#else
|
||||
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
|
||||
#endif
|
||||
typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);
|
||||
@ -104,6 +108,10 @@ typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type
|
||||
typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXOESPROC) (GLuint matrixpaletteindex);
|
||||
typedef void (APIENTRYP PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESPROC) (void);
|
||||
typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
typedef void (APIENTRYP PFNGLWEIGHTPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
#endif // __EDG__
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -448,9 +456,14 @@ public:
|
||||
PFNGLWEIGHTFVARBPROC _glWeightfvARB;
|
||||
|
||||
bool _supports_matrix_palette;
|
||||
PFNGLCURRENTPALETTEMATRIXARBPROC _glCurrentPaletteMatrixARB;
|
||||
PFNGLMATRIXINDEXPOINTERARBPROC _glMatrixIndexPointerARB;
|
||||
PFNGLMATRIXINDEXUIVARBPROC _glMatrixIndexuivARB;
|
||||
#ifdef OPENGLES
|
||||
PFNGLCURRENTPALETTEMATRIXOESPROC _glCurrentPaletteMatrix;
|
||||
PFNGLMATRIXINDEXPOINTEROESPROC _glMatrixIndexPointer;
|
||||
#else
|
||||
PFNGLCURRENTPALETTEMATRIXARBPROC _glCurrentPaletteMatrix;
|
||||
PFNGLMATRIXINDEXPOINTERARBPROC _glMatrixIndexPointer;
|
||||
PFNGLMATRIXINDEXUIVARBPROC _glMatrixIndexuiv;
|
||||
#endif
|
||||
|
||||
bool _supports_draw_range_elements;
|
||||
PFNGLDRAWRANGEELEMENTSPROC _glDrawRangeElements;
|
||||
@ -502,7 +515,11 @@ public:
|
||||
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC _glCheckFramebufferStatus;
|
||||
PFNGLFRAMEBUFFERTEXTURE1DEXTPROC _glFramebufferTexture1D;
|
||||
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC _glFramebufferTexture2D;
|
||||
#ifdef OPENGLES_2
|
||||
PFNGLFRAMEBUFFERTEXTURE3DOES _glFramebufferTexture3D;
|
||||
#else
|
||||
PFNGLFRAMEBUFFERTEXTURE3DEXTPROC _glFramebufferTexture3D;
|
||||
#endif
|
||||
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC _glFramebufferRenderbuffer;
|
||||
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC _glGetFramebufferAttachmentParameteriv;
|
||||
PFNGLGENERATEMIPMAPEXTPROC _glGenerateMipmap;
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "lightMutexHolder.h"
|
||||
#include "pStatTimer.h"
|
||||
|
||||
#ifndef OPENGLES_1 // Occlusion queries not supported by OpenGL ES.
|
||||
#ifndef OPENGLES // Occlusion queries not supported by OpenGL ES.
|
||||
|
||||
TypeHandle CLP(OcclusionQueryContext)::_type_handle;
|
||||
|
||||
@ -114,4 +114,4 @@ get_num_fragments() const {
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // OPENGLES_1
|
||||
#endif // OPENGLES
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
class GraphicsStateGuardian;
|
||||
|
||||
#ifndef OPENGLES_1 // Occlusion queries not supported by OpenGL ES.
|
||||
#ifndef OPENGLES // Occlusion queries not supported by OpenGL ES.
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : GLOcclusionQueryContext
|
||||
@ -57,5 +57,5 @@ private:
|
||||
|
||||
#include "glOcclusionQueryContext_src.I"
|
||||
|
||||
#endif // OPENGLES_1
|
||||
#endif // OPENGLES
|
||||
|
||||
|
@ -168,7 +168,7 @@ void CLP(init_classes)() {
|
||||
CLP(VertexBufferContext)::init_type();
|
||||
CLP(GraphicsBuffer)::init_type();
|
||||
|
||||
#ifndef OPENGLES_1
|
||||
#ifndef OPENGLES
|
||||
CLP(OcclusionQueryContext)::init_type();
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user