fix some graphics issues on Windows virtualbox
This commit is contained in:
parent
4c5d1d0ca5
commit
e35a2e4c79
|
@ -45,7 +45,7 @@ FrameBuffer::FrameBuffer(int width, int height)
|
|||
m_texture->enableBilinearFilter();
|
||||
|
||||
// use FBO ext only if supported
|
||||
if(false && g_graphics.isExtensionSupported("GL_ARB_framebuffer_object")) {
|
||||
if(g_graphics.isExtensionSupported("GL_ARB_framebuffer_object")) {
|
||||
m_fallbackOldImp = false;
|
||||
if(!oglGenFramebuffers) {
|
||||
oglGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)g_platform.getExtensionProcAddress("glGenFramebuffers");
|
||||
|
@ -106,7 +106,7 @@ void FrameBuffer::bind()
|
|||
glLoadIdentity();
|
||||
|
||||
// clear framebuffer
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
|
@ -136,5 +136,5 @@ void FrameBuffer::unbind()
|
|||
|
||||
void FrameBuffer::draw(const Rect& screenCoords, const Rect& framebufferCoords)
|
||||
{
|
||||
g_graphics.drawTexturedRect(screenCoords, m_texture ,framebufferCoords);
|
||||
g_graphics.drawTexturedRect(screenCoords, m_texture, framebufferCoords);
|
||||
}
|
||||
|
|
|
@ -148,18 +148,18 @@ void Graphics::drawTexturedRect(const Rect& screenCoords,
|
|||
float textureBottom;
|
||||
float textureTop;
|
||||
float textureLeft;
|
||||
const Size& textureSize = texture->getGlSize();
|
||||
|
||||
if(textureCoords.isEmpty()) {
|
||||
textureRight = 1.0f;
|
||||
textureBottom = 1.0f;
|
||||
textureRight = texture->getWidth() / (float)textureSize.width();
|
||||
textureBottom = texture->getHeight() / (float)textureSize.height();
|
||||
textureTop = 0.0f;
|
||||
textureLeft = 0.0f;
|
||||
} else {
|
||||
const Size& textureSize = texture->getGlSize();
|
||||
textureRight = (float)(textureCoords.right() + 1) / textureSize.width();
|
||||
textureBottom = (float)(textureCoords.bottom() + 1) / textureSize.height();
|
||||
textureTop = (float)textureCoords.top() / textureSize.height();
|
||||
textureLeft = (float)textureCoords.left() / textureSize.width();
|
||||
textureRight = (textureCoords.right() + 1) / (float)textureSize.width();
|
||||
textureBottom = (textureCoords.bottom() + 1) / (float)textureSize.height();
|
||||
textureTop = textureCoords.top() / (float)textureSize.height();
|
||||
textureLeft = textureCoords.left() / (float)textureSize.width();
|
||||
}
|
||||
|
||||
if(!m_drawing) {
|
||||
|
|
|
@ -72,7 +72,7 @@ uint Texture::internalLoadGLTexture(uchar *pixels, int channels, int width, int
|
|||
std::vector<uint8> tmp;
|
||||
|
||||
// old opengl drivers only accept power of two dimensions
|
||||
if(!g_graphics.isExtensionSupported("GL_ARB_texture_non_power_of_two") && pixels) {
|
||||
if(!g_graphics.isExtensionSupported("GL_ARB_texture_non_power_of_two")) {
|
||||
int glWidth = 1;
|
||||
while(glWidth < width)
|
||||
glWidth = glWidth << 1;
|
||||
|
@ -81,9 +81,8 @@ uint Texture::internalLoadGLTexture(uchar *pixels, int channels, int width, int
|
|||
while(glHeight < height)
|
||||
glHeight = glHeight << 1;
|
||||
|
||||
if(m_size != m_glSize) {
|
||||
if(m_size != m_glSize && pixels) {
|
||||
tmp.resize(glHeight*glWidth*channels, 0);
|
||||
if(pixels)
|
||||
for(int y=0; y<height; ++y)
|
||||
for(int x=0; x<width; ++x)
|
||||
for(int i=0; i<channels; ++i)
|
||||
|
|
|
@ -419,9 +419,11 @@ bool Platform::isExtensionSupported(const char *ext)
|
|||
typedef const char* _wglGetExtensionsStringARB(HDC hdc);
|
||||
_wglGetExtensionsStringARB *wglGetExtensionsStringARB = (_wglGetExtensionsStringARB*)getExtensionProcAddress("wglGetExtensionsStringARB");
|
||||
|
||||
if(wglGetExtensionsStringARB) {
|
||||
const char *exts = wglGetExtensionsStringARB(win32.hdc);
|
||||
if(strstr(exts, ext))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue