Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: No display  (Read 1238 times)

0 Members and 1 Guest are viewing this topic.

Runner111

  • Newbie
  • *
  • Posts: 5
    • View Profile
No display
« on: June 16, 2020, 12:56:19 pm »
I start the SFML from a QT Thread, the window can popup correctly. But no Image display, and I trace the code, no error. How should I do?
I found after create the image from RGB data, that is right

        pimage = new sf::Image;
        pimage->create(nWidth, nHeight, pdata);
        pimage->saveToFile("c:\\test6.jpg");              <---- right picture. size is 53518Byte

and then
       int ret = pTexture->loadFromImage(*pimage);   <---- ret is 1,
       pTexture->copyToImage().saveToFile("c:\\test5.jpg");   <---- empty picture. size is 11111Byte
« Last Edit: June 16, 2020, 04:33:24 pm by Runner111 »

Runner111

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: No display
« Reply #1 on: June 17, 2020, 03:39:39 am »
It is very strange, I rewrite the function in a test project(only have SFML), it can run correctly.
And I trace the code, when run copytoImage, m_texture can not get the pixels, so the pixels is empty.
What's happend??
        std::vector<Uint8> allPixels(m_actualSize.x * m_actualSize.y * 4);
        glCheck(glBindTexture(GL_TEXTURE_2D, m_texture));
        glCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, &allPixels[0]));

Runner111

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: No display
« Reply #2 on: June 17, 2020, 05:01:46 am »
And I test like this. Do not use loadFromImage. create texture first, and then use update.

        pimage = new sf::Image;
        pimage->create(nWidth, nHeight, pdata);
        pTexture->create(nWidth, nHeight);
        pTexture->update(*pimage);
        //int ret = pTexture->loadFromImage(*pimage);
        pTexture->copyToImage().saveToFile("c:\\test5.jpg");
        pimage->saveToFile("c:\\test6.jpg");
        delete pimage;
 

But I find the pTexture is init failed.
if (!m_texture)
    {
        GLuint texture;
        glCheck(glGenTextures(1, &texture));
        m_texture = static_cast<unsigned int>(texture);
    }
 

it can run into this area, but m_texture still 0.

if I test only SFML, without QT code, it run correctly.
    sf::Texture* pbackgroundTexture = new sf::Texture;
    pbackgroundTexture->create(800, 480);
    pbackgroundTexture->update(*pbackgroundImage);
    //pbackgroundTexture->loadFromImage(*pbackgroundImage);
    delete pbackgroundImage;
    pbackgroundTexture->copyToImage().saveToFile("c:\\test1.jpg");
 

In init part. I write like this:
   m_pThread = new QUIThread(this);
    m_pThread->Init();
    m_pThread->start();

void QUIThread::Init() {
    m_pGECase = new GraphEngineCase;
    m_pGECase->SetThread(this);
    m_pGECase->SetGraphEngine(m_pGECase);
    m_pGECase->InitGraphEngine();
}

void GraphEngine::InitGraphEngine() {
    QFile file(".\\GraphConfig.ini");
    if (!file.open(QIODevice::ReadOnly)) {
        return;
    }

    QTextStream in(&file);
    QString info = file.readLine();
    m_width = info.right(info.length() - info.indexOf(":") - 1).toInt();
    info = file.readLine();
    m_height = info.right(info.length() - info.indexOf(":") - 1).toInt();
    file.close();
    m_Settings.antialiasingLevel = 8;
    m_Window.create(sf::VideoMode(m_width, m_height), "Tinading Simulator", sf::Style::Default, m_Settings);
    m_Window.setFramerateLimit(50);
}
 
« Last Edit: June 17, 2020, 11:14:15 pm by eXpl0it3r »

Runner111

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: No display
« Reply #3 on: June 17, 2020, 03:34:45 pm »
Failed to activate OpenGL context:

Failed to activate the window's context
An internal OpenGL call failed in Texture.cpp(746).
Expression:
   glBindTexture(GL_TEXTURE_2D, texture->m_texture)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(772).
Expression:
   glMatrixMode(GL_TEXTURE)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(773).
Expression:
   glLoadMatrixf(matrix)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(776).
Expression:
   glMatrixMode(GL_MODELVIEW)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in RenderTarget.cpp(711).
Expression:
   glDrawArrays(mode, static_cast<GLint>(firstVertex), static_cast<GLsizei>(vertexCount))
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in TextureSaver.cpp(38).
Expression:
   glGetIntegerv(GL_TEXTURE_BINDING_2D, &m_textureBinding)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(424).
Expression:
   glBindTexture(GL_TEXTURE_2D, m_texture)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(425).
Expression:
   glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(426).
Expression:
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, m_isSmooth ? GL_LINEAR : GL_NEAREST)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(433).
Expression:
   glFlush()
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in TextureSaver.cpp(45).
Expression:
   glBindTexture(GL_TEXTURE_2D, m_textureBinding)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(746).
Expression:
   glBindTexture(GL_TEXTURE_2D, texture->m_texture)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(772).
Expression:
   glMatrixMode(GL_TEXTURE)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(773).
Expression:
   glLoadMatrixf(matrix)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(776).
Expression:
   glMatrixMode(GL_MODELVIEW)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in RenderTarget.cpp(711).
Expression:
   glDrawArrays(mode, static_cast<GLint>(firstVertex), static_cast<GLsizei>(vertexCount))
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(472).
Expression:
   glGetIntegerv(GLEXT_GL_READ_FRAMEBUFFER_BINDING, &readFramebuffer)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(473).
Expression:
   glGetIntegerv(GLEXT_GL_DRAW_FRAMEBUFFER_BINDING, &drawFramebuffer)
Error description:
   GL_INVALID_OPERATION
   The specified operation Failed to activate OpenGL context:


Failed to activate the window's context
An internal OpenGL call failed in Texture.cpp(746).
Expression:
   glBindTexture(GL_TEXTURE_2D, texture->m_texture)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(772).
Expression:
   glMatrixMode(GL_TEXTURE)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(773).
Expression:
   glLoadMatrixf(matrix)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(776).
Expression:
   glMatrixMode(GL_MODELVIEW)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in RenderTarget.cpp(711).
Expression:
   glDrawArrays(mode, static_cast<GLint>(firstVertex), static_cast<GLsizei>(vertexCount))
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in TextureSaver.cpp(38).
Expression:
   glGetIntegerv(GL_TEXTURE_BINDING_2D, &m_textureBinding)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(424).
Expression:
   glBindTexture(GL_TEXTURE_2D, m_texture)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(425).
Expression:
   glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(426).
Expression:
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, m_isSmooth ? GL_LINEAR : GL_NEAREST)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(433).
Expression:
   glFlush()
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in TextureSaver.cpp(45).
Expression:
   glBindTexture(GL_TEXTURE_2D, m_textureBinding)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(746).
Expression:
   glBindTexture(GL_TEXTURE_2D, texture->m_texture)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(772).
Expression:
   glMatrixMode(GL_TEXTURE)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(773).
Expression:
   glLoadMatrixf(matrix)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(776).
Expression:
   glMatrixMode(GL_MODELVIEW)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in RenderTarget.cpp(711).
Expression:
   glDrawArrays(mode, static_cast<GLint>(firstVertex), static_cast<GLsizei>(vertexCount))
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(472).
Expression:
   glGetIntegerv(GLEXT_GL_READ_FRAMEBUFFER_BINDING, &readFramebuffer)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(473).
Expression:
   glGetIntegerv(GLEXT_GL_DRAW_FRAMEBUFFER_BINDING, &drawFramebuffer)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(478).
Expression:
   GLEXT_glGenFramebuffers(1, &sourceFrameBuffer)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(479).
Expression:
   GLEXT_glGenFramebuffers(1, &destFrameBuffer)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

Cannot copy texture, failed to create a frame buffer object
An internal OpenGL call failed in Texture.cpp(746).
Expression:
   glBindTexture(GL_TEXTURE_2D, texture->m_texture)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(772).
Expression:
   glMatrixMode(GL_TEXTURE)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(773).
Expression:
   glLoadMatrixf(matrix)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(776).
Expression:
   glMatrixMode(GL_MODELVIEW)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in RenderTarget.cpp(711).
Expression:
   glDrawArrays(mode, static_cast<GLint>(firstVertex), static_cast<GLsizei>(vertexCount))
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(782).
Expression:
   glBindTexture(GL_TEXTURE_2D, 0)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(785).
Expression:
   glMatrixMode(GL_TEXTURE)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(786).
Expression:
   glLoadIdentity()
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(789).
Expression:
   glMatrixMode(GL_MODELVIEW)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.
 
« Last Edit: June 17, 2020, 11:13:13 pm by eXpl0it3r »

Runner111

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: No display
« Reply #4 on: June 17, 2020, 04:39:54 pm »
I found the problem, window init in other thread, so it can not catch the resource.