Skip to content

Commit 7c0a77a

Browse files
committed
display: disable depth test before DisplayRegion draw callback
Having depth test disabled is the default OpenGL state, and callbacks may quite reasonably expect to see the default state. Kivy seems to expect this, for one.
1 parent 544ef13 commit 7c0a77a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

panda/src/display/graphicsEngine.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "displayRegionCullCallbackData.h"
4848
#include "displayRegionDrawCallbackData.h"
4949
#include "callbackGraphicsWindow.h"
50+
#include "depthTestAttrib.h"
5051

5152
#if defined(WIN32)
5253
#define WINDOWS_LEAN_AND_MEAN
@@ -2046,9 +2047,12 @@ do_draw(GraphicsOutput *win, GraphicsStateGuardian *gsg, DisplayRegion *dr, Thre
20462047
if (cbobj != nullptr) {
20472048
// Issue the draw callback on this DisplayRegion.
20482049

2049-
// Set the GSG to the initial state.
2050+
// Set the GSG to the initial state. We disable depth testing since that
2051+
// is the default OpenGL state, and some libraries (eg. Kivy) expect that.
2052+
static CPT(RenderState) state = RenderState::make(
2053+
DepthTestAttrib::make(DepthTestAttrib::M_none));
20502054
gsg->clear_before_callback();
2051-
gsg->set_state_and_transform(RenderState::make_empty(), TransformState::make_identity());
2055+
gsg->set_state_and_transform(state, TransformState::make_identity());
20522056

20532057
DisplayRegionDrawCallbackData cbdata(cull_result, scene_setup);
20542058
cbobj->do_callback(&cbdata);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy