mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
Fix crash in do_issue_scissor
This commit is contained in:
parent
d9c529a5d0
commit
0e785de0ff
@ -310,6 +310,8 @@ CLP(GraphicsStateGuardian)(GraphicsEngine *engine, GraphicsPipe *pipe) :
|
|||||||
_check_errors = gl_check_errors;
|
_check_errors = gl_check_errors;
|
||||||
_force_flush = gl_force_flush;
|
_force_flush = gl_force_flush;
|
||||||
|
|
||||||
|
_scissor_enabled = false;
|
||||||
|
|
||||||
#ifdef DO_PSTATS
|
#ifdef DO_PSTATS
|
||||||
if (gl_finish) {
|
if (gl_finish) {
|
||||||
GLCAT.warning()
|
GLCAT.warning()
|
||||||
@ -2371,8 +2373,10 @@ prepare_display_region(DisplayRegionPipelineReader *dr) {
|
|||||||
|
|
||||||
if (dr->get_scissor_enabled()) {
|
if (dr->get_scissor_enabled()) {
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
_scissor_enabled = true;
|
||||||
} else {
|
} else {
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
_scissor_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_supports_viewport_arrays) {
|
if (_supports_viewport_arrays) {
|
||||||
@ -11378,12 +11382,14 @@ do_issue_scissor() {
|
|||||||
const ScissorAttrib *target_scissor = DCAST(ScissorAttrib, _target_rs->get_attrib_def(ScissorAttrib::get_class_slot()));
|
const ScissorAttrib *target_scissor = DCAST(ScissorAttrib, _target_rs->get_attrib_def(ScissorAttrib::get_class_slot()));
|
||||||
|
|
||||||
if (target_scissor->is_off()) {
|
if (target_scissor->is_off()) {
|
||||||
if (_current_display_region->get_scissor_enabled()) {
|
if (_scissor_enabled) {
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
_scissor_enabled = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!_current_display_region->get_scissor_enabled()) {
|
if (!_scissor_enabled) {
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
_scissor_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const LVecBase4 &frame = target_scissor->get_frame();
|
const LVecBase4 &frame = target_scissor->get_frame();
|
||||||
@ -11393,7 +11399,6 @@ do_issue_scissor() {
|
|||||||
int width = (int)(_viewport_width * (frame[1] - frame[0]) + 0.5f);
|
int width = (int)(_viewport_width * (frame[1] - frame[0]) + 0.5f);
|
||||||
int height = (int)(_viewport_height * (frame[3] - frame[2]) + 0.5f);
|
int height = (int)(_viewport_height * (frame[3] - frame[2]) + 0.5f);
|
||||||
|
|
||||||
glEnable(GL_SCISSOR_TEST);
|
|
||||||
glScissor(x, y, width, height);
|
glScissor(x, y, width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -529,6 +529,7 @@ protected:
|
|||||||
PN_stdfloat _point_size;
|
PN_stdfloat _point_size;
|
||||||
bool _point_perspective;
|
bool _point_perspective;
|
||||||
bool _vertex_blending_enabled;
|
bool _vertex_blending_enabled;
|
||||||
|
bool _scissor_enabled;
|
||||||
|
|
||||||
#ifndef OPENGLES_1
|
#ifndef OPENGLES_1
|
||||||
PT(Shader) _current_shader;
|
PT(Shader) _current_shader;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user