mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-02-20 11:03:09 +00:00
Fix ParticleEditor's Materialpicker screwing up ViewPort
In short, it uses a idGLDrawableMaterial widget that calls renderSystem->BeginFrame(w, h); (with w and h being small for the texture preview window) and BeginFrame() sets glConfig.vidWidth and vidHeight to w/h and that never got reset to the original value (window width/height). This breaks everything because for some reason renderSystem->GetSCreenWidth()/Height() return glConfig.vidWidth/Height so it will just continue to render everything at that resolution (in a small rectangle on the lower left corner of the window). This bug has already existed in Doom3 1.3.1 (but was less noticable because apparently when switching away from Doom3 and back to the window it reset vidWidth/Height to the window resolution) I only implemented a workaround (restore glConfig.vid* after rendering the texture preview), it's possible that the same issue exists in other (probably editor-) code - but a "proper fix" might also break code (and I'm not super-familiar with the editor code or even just using them)
This commit is contained in:
parent
b0d022f559
commit
5c1e1d7708
3 changed files with 25 additions and 1 deletions
|
@ -610,6 +610,13 @@ void idRenderSystemLocal::BeginFrame( int windowWidth, int windowHeight ) {
|
|||
windowHeight = tiledViewport[1];
|
||||
}
|
||||
|
||||
// DG: FIXME: WTF?! this is *not* reset in EndFrame() and next time
|
||||
// idSessionLocal::UpdateScreen() calls this function to render a proper frame,
|
||||
// passing renderSystem->GetScreenWidth()/Height() WHICH JUST RETURN glConfig.vidWidth/Height
|
||||
// will render the whole frame in that resolution (in a corner of the window), unless someone
|
||||
// resets glConfig.vid* manually... this is quite fragile, I wonder how many (more) bugs
|
||||
// (esp. in Editor code) will turn up because of this, but right now I don't dare to change
|
||||
// the behavior either, in case "fixing" it breaks other things
|
||||
glConfig.vidWidth = windowWidth;
|
||||
glConfig.vidHeight = windowHeight;
|
||||
|
||||
|
|
|
@ -445,6 +445,19 @@ void idGLDrawableMaterial::draw(int x, int y, int w, int h) {
|
|||
}
|
||||
|
||||
renderView_t refdef;
|
||||
|
||||
// DG: renderSystem->BeginFrame() changes glConfig.vidWidth and vidHeight to w and h
|
||||
// that is never reset automatically and for some reason glConfig.vidWith/height is even
|
||||
// used for renderSystem->GetScreenWidth()/Height() so idSessionLocal::UpdateScreen()
|
||||
// which calls renderSystem->BeginFrame( renderSystem->GetScreenWidth(), renderSystem->GetScreenHeight() );
|
||||
// won't reset those values to something sane either, causing the game to be rendered in a tiny rectangle
|
||||
// at the lower left corner of the screen once we're done picking a material here..
|
||||
// I don't dare to fix this in renderSystem, as other code might rely on this behavior..
|
||||
// (OTOH I wouldn't be surprised if other callers of renderSystem->BeginFrame() cause the same issue)
|
||||
// Anyway, my workaround is to remember glConfig.vidWith/Height and set them to the original
|
||||
// values once we're done rendering here..
|
||||
int oldWidth = glConfig.vidWidth;
|
||||
int oldHeight = glConfig.vidHeight;
|
||||
// render it
|
||||
renderSystem->BeginFrame(w, h);
|
||||
memset( &refdef, 0, sizeof( refdef ) );
|
||||
|
@ -469,6 +482,9 @@ void idGLDrawableMaterial::draw(int x, int y, int w, int h) {
|
|||
|
||||
qglMatrixMode( GL_MODELVIEW );
|
||||
qglLoadIdentity();
|
||||
// DG: reset glConfig.vidWidth/Height
|
||||
glConfig.vidWidth = oldWidth;
|
||||
glConfig.vidHeight = oldHeight;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -448,7 +448,8 @@ void CPreviewDlg::SetModal() {
|
|||
void CPreviewDlg::OnBnClickedButtonReload()
|
||||
{
|
||||
BuildTree();
|
||||
g_qeglobals.sw->StopAllSounds();
|
||||
if(g_qeglobals.sw != NULL)
|
||||
g_qeglobals.sw->StopAllSounds();
|
||||
}
|
||||
|
||||
void CPreviewDlg::OnBnClickedButtonAdd()
|
||||
|
|
Loading…
Reference in a new issue