mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 14:01:45 +00:00
- fixed: Hardware camera textures were given a dimension of (0, 0).
This commit is contained in:
parent
870890d8cf
commit
ad021cc374
3 changed files with 15 additions and 11 deletions
|
@ -207,8 +207,6 @@ unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// store the physical size.
|
// store the physical size.
|
||||||
texwidth = rw;
|
|
||||||
texheight = rh;
|
|
||||||
|
|
||||||
int sourcetype;
|
int sourcetype;
|
||||||
if (glTextureBytes > 0)
|
if (glTextureBytes > 0)
|
||||||
|
@ -467,14 +465,14 @@ void FHardwareTexture::UnbindAll()
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
int FHardwareTexture::GetDepthBuffer()
|
int FHardwareTexture::GetDepthBuffer(int width, int height)
|
||||||
{
|
{
|
||||||
if (glDepthID == 0)
|
if (glDepthID == 0)
|
||||||
{
|
{
|
||||||
glGenRenderbuffers(1, &glDepthID);
|
glGenRenderbuffers(1, &glDepthID);
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, glDepthID);
|
glBindRenderbuffer(GL_RENDERBUFFER, glDepthID);
|
||||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,
|
||||||
GetTexDimension(texwidth), GetTexDimension(texheight));
|
GetTexDimension(width), GetTexDimension(height));
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||||
}
|
}
|
||||||
return glDepthID;
|
return glDepthID;
|
||||||
|
@ -487,10 +485,12 @@ int FHardwareTexture::GetDepthBuffer()
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void FHardwareTexture::BindToFrameBuffer()
|
void FHardwareTexture::BindToFrameBuffer(int width, int height)
|
||||||
{
|
{
|
||||||
|
width = GetTexDimension(width);
|
||||||
|
height = GetTexDimension(height);
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, glDefTex.glTexID, 0);
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, glDefTex.glTexID, 0);
|
||||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, GetDepthBuffer());
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, GetDepthBuffer(width, height));
|
||||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, GetDepthBuffer());
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, GetDepthBuffer(width, height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
short texwidth = 0, texheight = 0;
|
|
||||||
bool forcenocompression;
|
bool forcenocompression;
|
||||||
|
|
||||||
TranslatedTexture glDefTex;
|
TranslatedTexture glDefTex;
|
||||||
|
@ -71,7 +70,7 @@ private:
|
||||||
|
|
||||||
TranslatedTexture * GetTexID(int translation);
|
TranslatedTexture * GetTexID(int translation);
|
||||||
|
|
||||||
int GetDepthBuffer();
|
int GetDepthBuffer(int w, int h);
|
||||||
void Resize(int swidth, int sheight, int width, int height, unsigned char *src_data, unsigned char *dst_data);
|
void Resize(int swidth, int sheight, int width, int height, unsigned char *src_data, unsigned char *dst_data);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -81,7 +80,7 @@ public:
|
||||||
static void Unbind(int texunit);
|
static void Unbind(int texunit);
|
||||||
static void UnbindAll();
|
static void UnbindAll();
|
||||||
|
|
||||||
void BindToFrameBuffer();
|
void BindToFrameBuffer(int w, int h);
|
||||||
|
|
||||||
unsigned int Bind(int texunit, int translation, bool needmipmap);
|
unsigned int Bind(int texunit, int translation, bool needmipmap);
|
||||||
void AllocateBuffer(int w, int h, int texelsize);
|
void AllocateBuffer(int w, int h, int texelsize);
|
||||||
|
|
|
@ -207,6 +207,11 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int transla
|
||||||
wt->GenTime[0] = screen->FrameTime;
|
wt->GenTime[0] = screen->FrameTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
w = tex->GetWidth();
|
||||||
|
h = tex->GetHeight();
|
||||||
|
}
|
||||||
if (!hwtex->CreateTexture(buffer, w, h, texunit, needmipmap, translation, "FGLTexture.Bind"))
|
if (!hwtex->CreateTexture(buffer, w, h, texunit, needmipmap, translation, "FGLTexture.Bind"))
|
||||||
{
|
{
|
||||||
// could not create texture
|
// could not create texture
|
||||||
|
@ -762,7 +767,7 @@ void FMaterial::BindToFrameBuffer()
|
||||||
FHardwareTexture::Unbind(0);
|
FHardwareTexture::Unbind(0);
|
||||||
ClearLastTexture();
|
ClearLastTexture();
|
||||||
}
|
}
|
||||||
mBaseLayer->mHwTexture->BindToFrameBuffer();
|
mBaseLayer->mHwTexture->BindToFrameBuffer(mWidth, mHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue