Fix OpenGL ES compiler errors

This commit is contained in:
rdb 2015-02-11 21:41:48 +01:00
parent 5a51a7e08d
commit 4d2dcdcef7
13 changed files with 150 additions and 115 deletions

View File

@ -1,5 +1,5 @@
// Filename: eglGraphicsBuffer.cxx
// Created by: pro-rsoft (13Jun09)
// Created by: rdb (13Jun09)
//
////////////////////////////////////////////////////////////////////
//
@ -195,8 +195,8 @@ open_buffer() {
}
int attrib_list[] = {
EGL_WIDTH, _x_size,
EGL_HEIGHT, _y_size,
EGL_WIDTH, _size.get_x(),
EGL_HEIGHT, _size.get_y(),
EGL_NONE
};

View File

@ -1,5 +1,5 @@
// Filename: eglGraphicsBuffer.h
// Created by: pro-rsoft (13Jun09)
// Created by: rdb (13Jun09)
//
////////////////////////////////////////////////////////////////////
//

View File

@ -1,5 +1,5 @@
// Filename: eglGraphicsPixmap.cxx
// Created by: pro-rsoft (13Jun09)
// Created by: rdb (13Jun09)
//
////////////////////////////////////////////////////////////////////
//
@ -222,7 +222,7 @@ open_buffer() {
}
_x_pixmap = XCreatePixmap(_display, _drawable,
_x_size, _y_size, visual_info->depth);
_size.get_x(), _size.get_y(), visual_info->depth);
if (_x_pixmap == None) {
egldisplay_cat.error()
<< "Failed to create X pixmap.\n";

View File

@ -1,5 +1,5 @@
// Filename: eglGraphicsPixmap.h
// Created by: pro-rsoft (13Jun09)
// Created by: rdb (13Jun09)
//
////////////////////////////////////////////////////////////////////
//

View File

@ -100,20 +100,19 @@ typedef char GLchar;
#define GL_RGBA16F GL_RGBA16F_EXT
#define GL_RGB32F GL_RGB32F_EXT
#define GL_RGBA32F GL_RGBA32F_EXT
#define GL_DEBUG_SEVERITY_HIGH GL_DEBUG_SEVERITY_HIGH_KHR
#define GL_DEBUG_SEVERITY_MEDIUM GL_DEBUG_SEVERITY_MEDIUM_KHR
#define GL_DEBUG_SEVERITY_LOW GL_DEBUG_SEVERITY_LOW_KHR
#define GL_DEBUG_SEVERITY_NOTIFICATION GL_DEBUG_SEVERITY_NOTIFICATION_KHR
#define GL_DEBUG_OUTPUT_SYNCHRONOUS GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR
#define GL_FRAMEBUFFER_SRGB GL_FRAMEBUFFER_SRGB_EXT
#define GL_SRGB GL_SRGB_EXT
#define GL_SRGB_ALPHA GL_SRGB_ALPHA_EXT
#define GL_SRGB8 GL_SRGB8_EXT
#define GL_SRGB8_ALPHA GL_SRGB8_ALPHA_EXT
#define GL_SLUMINANCE GL_SLUMINANCE_NV
#define GL_SLUMINANCE_ALPHA GL_SLUMINANCE_ALPHA_NV
#define GL_SLUMINANCE8 GL_SLUMINANCE8_NV
#define GL_SLUMINANCE8_ALPHA GL_SLUMINANCE8_ALPHA_NV
#define GL_SRGB8_ALPHA8 GL_SRGB8_ALPHA8_EXT
#define GL_RGBA8 GL_RGBA8_OES
#define GL_R8 GL_R8_EXT
#define GL_RG8 GL_RG8_EXT
#define GL_ALPHA8 GL_ALPHA8_OES
#define GL_LUMINANCE8 GL_LUMINANCE8_OES
#define GL_LUMINANCE8_ALPHA8 GL_LUMINANCE8_ALPHA8_EXT
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_EXT
#define GL_R32F GL_R32F_EXT
#define GL_RG32F GL_RG32F_EXT
#define GL_RGB8 GL_RGB8_OES
#undef SUPPORT_IMMEDIATE_MODE
#define APIENTRY

View File

@ -115,6 +115,9 @@
#define GL_RGBA16F GL_RGBA16F_EXT
#define GL_RGB32F GL_RGB32F_EXT
#define GL_RGBA32F GL_RGBA32F_EXT
#define GL_ALPHA8 GL_ALPHA8_EXT
#define GL_LUMINANCE8 GL_LUMINANCE8_EXT
#define GL_LUMINANCE8_ALPHA8 GL_LUMINANCE8_ALPHA8_EXT
#undef SUPPORT_IMMEDIATE_MODE
#define APIENTRY

View File

@ -1674,7 +1674,7 @@ resolve_multisamples() {
GL_NEAREST);
}
// Now handle the other color buffers.
#ifndef OPENGLES_1
#ifndef OPENGLES
int next = GL_COLOR_ATTACHMENT1_EXT;
if (_fb_properties.is_stereo()) {
glReadBuffer(next);

View File

@ -745,9 +745,12 @@ call_glTexParameterfv(GLenum target, GLenum pname, const LVecBase4 &value) {
// Access: Public
// Description: Convert index to gl light id
////////////////////////////////////////////////////////////////////
INLINE GLenum CLP(GraphicsStateGuardian)::get_light_id(int index) const {
INLINE GLenum CLP(GraphicsStateGuardian)::
get_light_id(int index) const {
#ifndef OPENGLES_2
return GL_LIGHT0 + index;
#else
return 0;
#endif
}
@ -760,6 +763,8 @@ INLINE GLenum CLP(GraphicsStateGuardian)::
get_clip_plane_id(int index) const {
#ifndef OPENGLES_2
return GL_CLIP_PLANE0 + index;
#else
return 0;
#endif
}

View File

@ -127,16 +127,16 @@ null_glBlendColor(GLclampf, GLclampf, GLclampf, GLclampf) {
// a fixed-function pipeline.
// This default shader just outputs a red color, telling
// the user that something went wrong.
CPT(Shader::ShaderFile) default_shader_name = new Shader::ShaderFile("default-shader");
CPT(Shader::ShaderFile) default_shader_body = new Shader::ShaderFile("\
uniform mediump mat4 p3d_ModelViewProjectionMatrix;\
attribute highp vec4 p3d_Vertex;\
void main(void) {\
gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;\
}\n",
"void main(void) {\
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\
}\n", "", "", "");
static const string default_vshader =
"uniform mediump mat4 p3d_ModelViewProjectionMatrix;\n"
"attribute highp vec4 p3d_Vertex;\n"
"void main(void) {\n"
" gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;\n"
"}\n";
static const string default_fshader =
"void main(void) {\n"
" gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
"}\n";
#endif
@ -1370,7 +1370,7 @@ reset() {
// if it failed to compile. This default shader just outputs
// a red color, indicating that something went wrong.
if (_default_shader == NULL) {
_default_shader = new Shader(default_shader_name, default_shader_body, Shader::SL_GLSL);
_default_shader = Shader::load(Shader::SL_GLSL, default_vshader, default_fshader);
}
#endif
@ -1915,6 +1915,8 @@ reset() {
}
_supports_sampler_objects = false;
#ifndef OPENGLES
if (gl_support_sampler_objects &&
((is_at_least_gl_version(3, 3) || has_extension("GL_ARB_sampler_objects")))) {
_glGenSamplers = (PFNGLGENSAMPLERSPROC) get_extension_func("glGenSamplers");
@ -1935,6 +1937,7 @@ reset() {
_supports_sampler_objects = true;
}
}
#endif // OPENGLES
// Check availability of multi-bind functions.
_supports_multi_bind = false;
@ -1944,10 +1947,12 @@ reset() {
_glBindImageTextures = (PFNGLBINDIMAGETEXTURESPROC)
get_extension_func("glBindImageTextures");
#ifndef OPENGLES
if (_supports_sampler_objects) {
_glBindSamplers = (PFNGLBINDSAMPLERSPROC)
get_extension_func("glBindSamplers");
}
#endif // OPENGLES
if (_glBindTextures != NULL && _glBindImageTextures != NULL) {
_supports_multi_bind = true;
@ -2011,14 +2016,18 @@ reset() {
_supports_stencil_wrap =
has_extension("GL_EXT_stencil_wrap") || has_extension("GL_OES_stencil_wrap");
_supports_two_sided_stencil = has_extension("GL_EXT_stencil_two_side");
if (_supports_two_sided_stencil) {
_supports_two_sided_stencil = false;
#ifndef OPENGLES
if (has_extension("GL_EXT_stencil_two_side")) {
_glActiveStencilFaceEXT = (PFNGLACTIVESTENCILFACEEXTPROC)
get_extension_func("glActiveStencilFaceEXT");
}
else {
_supports_two_sided_stencil = true;
} else {
_glActiveStencilFaceEXT = 0;
}
#endif
#ifndef OPENGLES
// Some drivers expose one, some expose the other. ARB seems to be the newer one.
@ -2618,9 +2627,11 @@ clear_before_callback() {
// Clear the bound sampler object, so that we do not inadvertently
// override the callback's desired sampler settings.
#ifndef OPENGLES
if (_supports_sampler_objects) {
_glBindSampler(0, 0);
}
#endif
}
////////////////////////////////////////////////////////////////////
@ -2761,7 +2772,7 @@ begin_frame(Thread *current_thread) {
}*/
#endif
#ifndef OPENGLES_1
#ifndef OPENGLES
if (_current_properties->get_srgb_color()) {
glEnable(GL_FRAMEBUFFER_SRGB);
}
@ -2819,7 +2830,7 @@ void CLP(GraphicsStateGuardian)::
end_frame(Thread *current_thread) {
report_my_gl_errors();
#ifndef OPENGLES_1
#ifndef OPENGLES
if (_current_properties->get_srgb_color()) {
glDisable(GL_FRAMEBUFFER_SRGB);
}
@ -4521,8 +4532,10 @@ prepare_sampler(const SamplerState &sampler) {
////////////////////////////////////////////////////////////////////
void CLP(GraphicsStateGuardian)::
release_sampler(SamplerContext *sc) {
#ifndef OPENGLES
CLP(SamplerContext) *gsc = DCAST(CLP(SamplerContext), sc);
delete gsc;
#endif
}
////////////////////////////////////////////////////////////////////
@ -5205,7 +5218,7 @@ make_geom_munger(const RenderState *state, Thread *current_thread) {
// from the camera plane. The point is assumed to be
// in the GSG's internal coordinate system.
////////////////////////////////////////////////////////////////////
PN_stdfloat GLGraphicsStateGuardian::
PN_stdfloat CLP(GraphicsStateGuardian)::
compute_distance_to(const LPoint3 &point) const {
return -point[2];
}
@ -7447,7 +7460,7 @@ get_external_image_format(Texture *tex) const {
break;
case Texture::CM_dxt1:
#ifndef OPENGLES_1
#ifndef OPENGLES
if (format == Texture::F_srgb_alpha) {
return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
} else if (format == Texture::F_srgb) {
@ -7484,13 +7497,13 @@ get_external_image_format(Texture *tex) const {
#else
case Texture::CM_pvr1_2bpp:
#ifndef OPENGLES_1
#ifndef OPENGLES
if (format == Texture::F_srgb_alpha) {
return GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT;
} else if (format == Texture::F_srgb) {
return GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT;
} else
#endif // OPENGLES_1
#endif // OPENGLES
if (Texture::has_alpha(format)) {
return GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
} else {
@ -7498,13 +7511,13 @@ get_external_image_format(Texture *tex) const {
}
case Texture::CM_pvr1_4bpp:
#ifndef OPENGLES_1
#ifndef OPENGLES
if (format == Texture::F_srgb_alpha) {
return GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT;
} else if (format == Texture::F_srgb) {
return GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT;
} else
#endif // OPENGLES_1
#endif // OPENGLES
if (Texture::has_alpha(format)) {
return GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
} else {
@ -7762,7 +7775,7 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
#endif
case Texture::CM_dxt1:
#ifndef OPENGLES_1
#ifndef OPENGLES
if (format == Texture::F_srgb_alpha) {
return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
} else if (format == Texture::F_srgb) {
@ -7798,13 +7811,6 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
}
#else
case Texture::CM_pvr1_2bpp:
#ifndef OPENGLES_1
if (format == Texture::F_srgb_alpha) {
return GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT;
} else if (format == Texture::F_srgb) {
return GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT;
} else
#endif // OPENGLES_1
if (Texture::has_alpha(format)) {
return GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
} else {
@ -7812,13 +7818,6 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
}
case Texture::CM_pvr1_4bpp:
#ifndef OPENGLES_1
if (format == Texture::F_srgb_alpha) {
return GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT;
} else if (format == Texture::F_srgb) {
return GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT;
} else
#endif // OPENGLES_1
if (Texture::has_alpha(format)) {
return GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
} else {
@ -7843,7 +7842,7 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
case Texture::F_depth_stencil:
if (_supports_depth_stencil) {
#ifndef OPENGLES_1
#ifndef OPENGLES
if (tex->get_component_type() == Texture::T_float) {
return GL_DEPTH32F_STENCIL8;
} else
@ -7903,7 +7902,10 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
#ifndef OPENGLES_1
if (tex->get_component_type() == Texture::T_float) {
return GL_RGBA16F;
} else if (tex->get_component_type() == Texture::T_unsigned_short) {
} else
#endif
#ifndef OPENGLES
if (tex->get_component_type() == Texture::T_unsigned_short) {
return GL_RGBA16;
} else
#endif
@ -7949,7 +7951,7 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
case Texture::F_rgba12:
return GL_RGBA12;
#endif // OPENGLES
#ifndef OPENGLES_1
#ifndef OPENGLES
case Texture::F_rgba16:
if (tex->get_component_type() == Texture::T_float) {
return GL_RGBA16F;
@ -8040,26 +8042,36 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
return force_sized ? GL_ALPHA8 : GL_ALPHA;
case Texture::F_luminance:
#ifndef OPENGLES
if (tex->get_component_type() == Texture::T_float) {
return GL_LUMINANCE16F_ARB;
} else if (tex->get_component_type() == Texture::T_unsigned_short) {
return GL_LUMINANCE16;
} else {
} else
#endif // OPENGLES
{
return force_sized ? GL_LUMINANCE8 : GL_LUMINANCE;
}
case Texture::F_luminance_alpha:
case Texture::F_luminance_alphamask:
#ifndef OPENGLES
if (tex->get_component_type() == Texture::T_float || tex->get_component_type() == Texture::T_unsigned_short) {
return GL_LUMINANCE_ALPHA16F_ARB;
} else {
} else
#endif // OPENGLES
{
return force_sized ? GL_LUMINANCE8_ALPHA8 : GL_LUMINANCE_ALPHA;
}
#ifndef OPENGLES_1
case Texture::F_srgb:
#ifndef OPENGLES
return GL_SRGB8;
#endif
case Texture::F_srgb_alpha:
return GL_SRGB8_ALPHA8;
#endif
#ifndef OPENGLES
case Texture::F_sluminance:
return GL_SLUMINANCE8;
case Texture::F_sluminance_alpha:
@ -9043,7 +9055,7 @@ set_state_and_transform(const RenderState *target,
////////////////////////////////////////////////////////////////////
void CLP(GraphicsStateGuardian)::
free_pointers() {
#ifdef HAVE_CG
#if defined(HAVE_CG) && !defined(OPENGLES)
if (_cg_context != 0) {
cgDestroyContext(_cg_context);
_cg_context = 0;
@ -10081,6 +10093,7 @@ bool CLP(GraphicsStateGuardian)::
apply_sampler(GLuint unit, const SamplerState &sampler, TextureContext *tc) {
CLP(TextureContext) *gtc = DCAST(CLP(TextureContext), tc);
#ifndef OPENGLES
if (_supports_sampler_objects) {
// We support sampler objects. Prepare the sampler object and
// bind it to the indicated texture unit.
@ -10097,7 +10110,9 @@ apply_sampler(GLuint unit, const SamplerState &sampler, TextureContext *tc) {
<< "bind " << unit << " " << sampler << "\n";
}
} else {
} else
#endif // OPENGLES
{
// We don't support sampler objects. We'll have to bind the
// texture and change the texture parameters if they don't match.
if (gtc->_active_sampler != sampler) {
@ -10678,6 +10693,7 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload,
if (tex->has_clear_color()) {
// The texture has a clear color, so we should fill this mipmap
// level to a solid color.
#ifndef OPENGLES
if (_supports_clear_texture) {
// We can do that with the convenient glClearTexImage function.
string clear_data = tex->get_clear_data();
@ -10685,12 +10701,13 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload,
_glClearTexImage(gtc->_index, n - mipmap_bias, external_format,
component_type, (void *)clear_data.data());
continue;
} else {
}
#endif // OPENGLES
// Ask the Texture class to create the mipmap level in RAM.
// It'll fill it in with the correct clear color, which we
// can then upload.
ptimage = tex->make_ram_mipmap_image(n);
}
} else {
// No clear color and no more images.
break;
@ -10726,13 +10743,8 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload,
_data_transferred_pcollector.add_level(view_size);
#endif
switch (texture_target) {
#ifdef OPENGLES_2
case GL_TEXTURE_3D_OES:
#endif
#ifndef OPENGLES
case GL_TEXTURE_3D:
#endif
#ifndef OPENGLES_1
case GL_TEXTURE_3D:
if (_supports_3d_texture) {
if (image_compression == Texture::CM_off) {
_glTexSubImage3D(page_target, n - mipmap_bias, 0, 0, 0, width, height, depth,
@ -10746,7 +10758,9 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload,
return false;
}
break;
#endif // OPENGLES_1
#ifndef OPENGLES
case GL_TEXTURE_1D:
if (image_compression == Texture::CM_off) {
glTexSubImage1D(page_target, n - mipmap_bias, 0, width,
@ -10756,7 +10770,8 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload,
external_format, view_size, image_ptr);
}
break;
#endif
#endif // OPENGLES
#ifndef OPENGLES
case GL_TEXTURE_2D_ARRAY_EXT:
if (_supports_2d_texture_array) {
@ -10772,7 +10787,8 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload,
return false;
}
break;
#endif
#endif // OPENGLES
default:
if (image_compression == Texture::CM_off) {
if (n==0) {
@ -11319,7 +11335,7 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
type = Texture::T_unsigned_int_24_8;
format = Texture::F_depth_stencil;
break;
#ifndef OPENGLES_1
#ifndef OPENGLES
case GL_DEPTH32F_STENCIL8:
type = Texture::T_float;
format = Texture::F_depth_stencil;
@ -11483,26 +11499,34 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
format = Texture::F_alpha;
break;
case GL_LUMINANCE:
#ifndef OPENGLES
case GL_LUMINANCE16:
case GL_LUMINANCE16F_ARB:
#endif
case 1:
format = Texture::F_luminance;
break;
case GL_LUMINANCE_ALPHA:
#ifndef OPENGLES
case GL_LUMINANCE_ALPHA16F_ARB:
#endif
case 2:
format = Texture::F_luminance_alpha;
break;
#ifndef OPENGLES_1
case GL_SRGB:
#ifndef OPENGLES
case GL_SRGB8:
#endif
format = Texture::F_srgb;
break;
case GL_SRGB_ALPHA:
case GL_SRGB8_ALPHA8:
format = Texture::F_srgb_alpha;
break;
#endif // OPENGLES_1
#ifndef OPENGLES
case GL_SLUMINANCE:
case GL_SLUMINANCE8:
format = Texture::F_sluminance;
@ -11511,7 +11535,7 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
case GL_SLUMINANCE8_ALPHA8:
format = Texture::F_sluminance_alpha;
break;
#endif
#endif // OPENGLES
#ifndef OPENGLES
case GL_COMPRESSED_RGB:
@ -11561,7 +11585,7 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
format = Texture::F_rgbm;
compression = Texture::CM_dxt1;
break;
#ifndef OPENGLES_1
#ifndef OPENGLES
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
format = Texture::F_srgb;
compression = Texture::CM_dxt1;
@ -11572,25 +11596,6 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
break;
#endif
#ifdef OPENGLES_2
case GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT:
format = Texture::F_srgb;
compression = Texture::CM_pvr1_2bpp;
break;
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT:
format = Texture::F_srgb_alpha;
compression = Texture::CM_pvr1_2bpp;
break;
case GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT:
format = Texture::F_srgb;
compression = Texture::CM_pvr1_4bpp;
break;
case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT:
format = Texture::F_srgb_alpha;
compression = Texture::CM_pvr1_4bpp;
break;
#endif // OPENGLES_2
#ifdef OPENGLES
case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
format = Texture::F_rgb;
@ -11963,6 +11968,7 @@ do_issue_stencil() {
<< "SRS_back_stencil_pass_z_pass_operation " << (int)stencil->get_render_state(StencilAttrib::SRS_back_stencil_pass_z_pass_operation) << "\n";
}
#ifndef OPENGLES
if (_supports_two_sided_stencil) {
//TODO: add support for OpenGL 2.0-style glStencilFuncSeparate.
unsigned int back_compare;
@ -11989,6 +11995,7 @@ do_issue_stencil() {
_glActiveStencilFaceEXT(GL_FRONT);
}
#endif // OPENGLES
unsigned int front_compare;
front_compare = stencil->get_render_state(StencilAttrib::SRS_front_comparison_function);
@ -12018,9 +12025,11 @@ do_issue_stencil() {
}
} else {
glDisable(GL_STENCIL_TEST);
#ifndef OPENGLES
if (_supports_two_sided_stencil) {
glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
}
#endif // OPENGLES
}
}
@ -12067,9 +12076,12 @@ do_issue_scissor() {
if (_scissor_array.size() > 0) {
// Scissoring is enabled on the display region.
// Revert to the scissor state specified in the DisplayRegion.
#ifndef OPENGLES
if (_supports_viewport_arrays) {
_glScissorArrayv(0, _scissor_array.size(), _scissor_array[0].get_data());
} else {
} else
#endif // OPENGLES
{
const LVecBase4i sr = _scissor_array[0];
glScissor(sr[0], sr[1], sr[2], sr[3]);
}

View File

@ -14,6 +14,8 @@
#include "pnotify.h"
#ifndef OPENGLES
TypeHandle CLP(SamplerContext)::_type_handle;
////////////////////////////////////////////////////////////////////
@ -81,3 +83,5 @@ reset_data() {
// re-load the sampler later.
//glGenSamplers(1, &_index);
}
#endif // OPENGLES

View File

@ -12,6 +12,8 @@
//
////////////////////////////////////////////////////////////////////
#ifndef OPENGLES
#include "pandabase.h"
#include "samplerContext.h"
#include "deletedChain.h"
@ -56,3 +58,5 @@ public:
private:
static TypeHandle _type_handle;
};
#endif // OPENGLES

View File

@ -821,10 +821,12 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext
param_type == GL_INT_VEC2 ||
param_type == GL_INT_VEC3 ||
param_type == GL_INT_VEC4 ||
param_type == GL_UNSIGNED_INT ||
#ifndef OPENGLES
param_type == GL_UNSIGNED_INT_VEC2 ||
param_type == GL_UNSIGNED_INT_VEC3 ||
param_type == GL_UNSIGNED_INT_VEC4);
param_type == GL_UNSIGNED_INT_VEC4 ||
#endif
param_type == GL_UNSIGNED_INT );
if (noprefix.empty()) {
// Arbitrarily named attribute.
@ -863,12 +865,16 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext
// Get the number of bind points.
switch (param_type) {
case GL_FLOAT_MAT3:
#ifndef OPENGLES
case GL_DOUBLE_MAT3:
#endif
bind._elements = 3 * param_size;
break;
case GL_FLOAT_MAT4:
#ifndef OPENGLES
case GL_DOUBLE_MAT4:
#endif
bind._elements = 4 * param_size;
break;

View File

@ -283,7 +283,9 @@ void CLP(init_classes)() {
CLP(ShaderContext)::init_type();
#endif
CLP(TextureContext)::init_type();
#ifndef OPENGLES
CLP(SamplerContext)::init_type();
#endif
CLP(VertexBufferContext)::init_type();
CLP(GraphicsBuffer)::init_type();