|
|
@@ -3020,30 +3020,11 @@ draw_sphere(GeomSphere *geom, GeomContext *gc) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
TextureContext *DXGraphicsStateGuardian9::
|
|
|
prepare_texture(Texture *tex) {
|
|
|
-
|
|
|
DXTextureContext9 *dtc = new DXTextureContext9(tex);
|
|
|
-#ifdef WBD_GL_MODE
|
|
|
- glGenTextures(1, >c->_index);
|
|
|
-
|
|
|
- bind_texture(gtc);
|
|
|
- glPrioritizeTextures(1, >c->_index, >c->_priority);
|
|
|
- specify_texture(tex);
|
|
|
- apply_texture_immediate(tex);
|
|
|
-#else
|
|
|
-
|
|
|
if (dtc->CreateTexture(*_pScrn) == NULL) {
|
|
|
delete dtc;
|
|
|
return NULL;
|
|
|
}
|
|
|
-#endif // WBD_GL_MODE
|
|
|
-
|
|
|
- bool inserted = mark_prepared_texture(dtc);
|
|
|
-
|
|
|
- // If this assertion fails, the same texture was prepared twice,
|
|
|
- // which shouldn't be possible, since the texture itself should
|
|
|
- // detect this.
|
|
|
- nassertr(inserted, NULL);
|
|
|
-
|
|
|
return dtc;
|
|
|
}
|
|
|
|
|
|
@@ -3217,17 +3198,7 @@ apply_texture(TextureContext *tc) {
|
|
|
void DXGraphicsStateGuardian9::
|
|
|
release_texture(TextureContext *tc) {
|
|
|
DXTextureContext9 *gtc = DCAST(DXTextureContext9, tc);
|
|
|
- Texture *tex = tc->_texture;
|
|
|
-
|
|
|
gtc->DeleteTexture();
|
|
|
- bool erased = unmark_prepared_texture(gtc);
|
|
|
-
|
|
|
- // If this assertion fails, a texture was released that hadn't been
|
|
|
- // prepared (or a texture was released twice).
|
|
|
- nassertv(erased);
|
|
|
-
|
|
|
- tex->clear_gsg(this);
|
|
|
-
|
|
|
delete gtc;
|
|
|
}
|
|
|
|
|
|
@@ -3692,7 +3663,9 @@ issue_texture(const TextureAttrib *attrib) {
|
|
|
enable_texturing(true);
|
|
|
Texture *tex = attrib->get_texture();
|
|
|
nassertv(tex != (Texture *)NULL);
|
|
|
- tex->apply(this);
|
|
|
+
|
|
|
+ TextureContext *tc = tex->prepare_now(_prepared_objects, this);
|
|
|
+ apply_texture(tc);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -4597,12 +4570,6 @@ dx_cleanup(bool bRestoreDisplayMode,bool bAtExitFnCalled) {
|
|
|
|
|
|
PRINT_REFCNT(dxgsg9,_pD3DDevice);
|
|
|
|
|
|
- // these 2 calls release ddraw surfaces and vbuffers. unsafe unless not on exit
|
|
|
- release_all_textures();
|
|
|
- release_all_geoms();
|
|
|
-
|
|
|
- PRINT_REFCNT(dxgsg9,_pD3DDevice);
|
|
|
-
|
|
|
// delete non-panda-texture/geom DX objects (VBs/textures/shaders)
|
|
|
//SAFE_DELSHADER(Vertex,_CurVertexShader,_pD3DDevice);
|
|
|
//SAFE_DELSHADER(Pixel,_CurPixelShader,_pD3DDevice);
|