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

Author Topic: OEM gfx drivers (former pure virtual function) SOLVED  (Read 4470 times)

0 Members and 1 Guest are viewing this topic.

docwizard

  • Newbie
  • *
  • Posts: 4
    • View Profile
OEM gfx drivers (former pure virtual function) SOLVED
« on: March 18, 2008, 04:31:38 pm »
With the following example code from the SFML 1.2 SDK (./sample/opengl/). Slightly modified so the background and texture images can be placed in the running directory. At exit, a pure virtual function call runtime error will be shown in Windows. Other relevant information: Compiled using debug libraries , compiled using EITHER MinGW 3.4.5 or MS VC++ 2008 Express. On testing machine: SFML 1.2 SDK is not installed, MS visual C++ runtime 2005 and 2008 redistributables are installed, Microsoft .net framework 3.5 is installed, MinGW, MSYS, MSYSDTK, gdb, et. al. are installed - VC++ 2008 Express is NOT. PLEASE EXAMINE THIS ISSUE AS I BELEIVE YOURE LIBRARY IS CALLING A PURE VIRTUAL FUNCTION AT EXIT.

Code: [Select]

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <fstream>
#include <iostream>


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create main window
    sf::RenderWindow App(sf::VideoMode(800, 600), "SFML OpenGL");

    // Create a sprite for the background
    sf::Image BackgroundImage;
    if (!BackgroundImage.LoadFromFile("background.jpg"))
        return EXIT_FAILURE;
    sf::Sprite Background(BackgroundImage);

    // Load an OpenGL texture.
    // We could directly use a sf::Image as an OpenGL texture (with its Bind() member function),
    // but here we want more control on it (generate mipmaps, ...) so we create a new one
    GLuint Texture = 0;
    {
        sf::Image Image;
        if (!Image.LoadFromFile("texture.jpg"))
            return EXIT_FAILURE;
        glGenTextures(1, &Texture);
        glBindTexture(GL_TEXTURE_2D, Texture);
        gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, Image.GetWidth(), Image.GetHeight(), GL_RGBA, GL_UNSIGNED_BYTE, Image.GetPixelsPtr());
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    }

    // Enable Z-buffer read and write
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
    glClearDepth(1.f);

    // Setup a perspective projection
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(90.f, 1.f, 1.f, 500.f);

    // Bind our texture
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, Texture);
    glColor4f(1.f, 1.f, 1.f, 1.f);

    // Create a clock for measuring the time elapsed
    sf::Clock Clock;

    // Start game loop
    bool Running = true;
    while (Running)
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                Running = false;

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                Running = false;
        }

        // Draw background
        App.Draw(Background);

        // Clear depth buffer
        glClear(GL_DEPTH_BUFFER_BIT);

        // Apply some transformations
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glTranslatef(0.f, 0.f, -200.f);
        glRotatef(Clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f);
        glRotatef(Clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f);
        glRotatef(Clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f);

        // Draw a cube
        glBegin(GL_QUADS);

            glTexCoord2f(0, 0); glVertex3f(-50.f, -50.f, -50.f);
            glTexCoord2f(0, 1); glVertex3f(-50.f,  50.f, -50.f);
            glTexCoord2f(1, 1); glVertex3f( 50.f,  50.f, -50.f);
            glTexCoord2f(1, 0); glVertex3f( 50.f, -50.f, -50.f);

            glTexCoord2f(0, 0); glVertex3f(-50.f, -50.f, 50.f);
            glTexCoord2f(0, 1); glVertex3f(-50.f,  50.f, 50.f);
            glTexCoord2f(1, 1); glVertex3f( 50.f,  50.f, 50.f);
            glTexCoord2f(1, 0); glVertex3f( 50.f, -50.f, 50.f);

            glTexCoord2f(0, 0); glVertex3f(-50.f, -50.f, -50.f);
            glTexCoord2f(0, 1); glVertex3f(-50.f,  50.f, -50.f);
            glTexCoord2f(1, 1); glVertex3f(-50.f,  50.f,  50.f);
            glTexCoord2f(1, 0); glVertex3f(-50.f, -50.f,  50.f);

            glTexCoord2f(0, 0); glVertex3f(50.f, -50.f, -50.f);
            glTexCoord2f(0, 1); glVertex3f(50.f,  50.f, -50.f);
            glTexCoord2f(1, 1); glVertex3f(50.f,  50.f,  50.f);
            glTexCoord2f(1, 0); glVertex3f(50.f, -50.f,  50.f);

            glTexCoord2f(0, 1); glVertex3f(-50.f, -50.f,  50.f);
            glTexCoord2f(0, 0); glVertex3f(-50.f, -50.f, -50.f);
            glTexCoord2f(1, 0); glVertex3f( 50.f, -50.f, -50.f);
            glTexCoord2f(1, 1); glVertex3f( 50.f, -50.f,  50.f);

            glTexCoord2f(0, 1); glVertex3f(-50.f, 50.f,  50.f);
            glTexCoord2f(0, 0); glVertex3f(-50.f, 50.f, -50.f);
            glTexCoord2f(1, 0); glVertex3f( 50.f, 50.f, -50.f);
            glTexCoord2f(1, 1); glVertex3f( 50.f, 50.f,  50.f);

        glEnd();

        // Draw some text on top of our OpenGL object
        sf::String Text("This is a rotating cube");
        Text.SetPosition(230.f, 300.f);
        Text.SetColor(sf::Color(128, 0, 128));
        App.Draw(Text);

        // Finally, display rendered frame on screen
        App.Display();
    }

    // Don't forget to destroy our texture
    glDeleteTextures(1, &Texture);

    return EXIT_SUCCESS;
}

[EDIT]
See last post. This is a driver issue it has nothing to do with SFML.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OEM gfx drivers (former pure virtual function) SOLVED
« Reply #1 on: March 19, 2008, 03:03:50 am »
I've never got such error with this code, with any of the compiler I'm using.

And I can't see any SFML class which could do such a pure virtual function call on exit.

Did you try recompiling SFML ?
Laurent Gomila - SFML developer

docwizard

  • Newbie
  • *
  • Posts: 4
    • View Profile
Intel GMA (Graphics) Chipsets
« Reply #2 on: March 20, 2008, 03:13:44 pm »
I did extensive testing on the test deployment platform that I use with my SFML programming and discovered that the latest Intel GMA Chipset drivers for Intel graphics cards (at least X3100) are basically incompatible with SFML executables that load images. Why this is, I do not know. But I do know that it is generally acknowledged in the graphics community that "Intel's implementation...generally hit-and-miss." So If you are commercially deploying SFML apps that load images you may want to make note that at program exit SFML programs may exhibit strange behavior in regards to the C++ runtime library etc. IF you have and Intel GMA graphics card based on the X3100 architectures using Win32 drivers. I understand this problem is a little obscure to be fixing at the level of the SFML library but I thought everyone should know.
[EDIT]
This bug applies to the WIN32 platform only.
[EDIT]
See last post, this is a driver issue, it has nothing to do with SFML.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OEM gfx drivers (former pure virtual function) SOLVED
« Reply #3 on: March 20, 2008, 03:32:40 pm »
Wow... weird stuff.

Thanks a lot pointing it out.
Laurent Gomila - SFML developer

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
OEM gfx drivers (former pure virtual function) SOLVED
« Reply #4 on: March 20, 2008, 08:30:35 pm »
I have an Intel GMA on-board gfxcard and I haven't experienced anything like this.

docwizard

  • Newbie
  • *
  • Posts: 4
    • View Profile
hit and miss implementation
« Reply #5 on: March 21, 2008, 12:52:32 am »
As I said it's well known that the intel implementations are hit and miss when it comes to graphics. I guess yours hit and mine missed. ha ha. I am still including the notes in my software. Additionally, I did a quick search of the forums and saw you have 945 GMA, which is not X3100 architecture so it doesnt support the same drivers and in that case Probably wouldnt exhibit the same problems...

docwizard

  • Newbie
  • *
  • Posts: 4
    • View Profile
foot in mouth
« Reply #6 on: March 21, 2008, 04:15:40 pm »
I guess I have to put my foot in my mouth on some of this...I have discovered the diffinitive answer to this thread. If you download the Intel GMA drivers from the support.intel.com website you will get the drivers that have debugging information built into them and therefor the drivers will spit out debug information when you run different applications. This comes directly from Intel's website, with a small bold italic edit done by me...:

Quote

The software drivers provided on this page are generic versions, and can be used for general purposes. However, computer original equipment manufacturers (OEMs) may have altered the features, incorporated customizations, or made other changes to the software or software packaging they provide. To avoid any potential installation incompatibilities on your OEM system, Intel recommends that you check with your OEM and use the software provided via your system manufacturer. Intel or the computer original equipment manufacturer (OEM) may not provide technical support for some or all issues that could arise from the usage of this generic version of software drivers.


So, it is recommended that people use OEM drivers in most consumer graphics cards solutions. This final note and possibly the information from Intel would be the most appropriate note to include, if any with your software.

dcarol

  • Newbie
  • *
  • Posts: 3
    • View Profile
I have the same issue
« Reply #7 on: September 18, 2008, 10:39:36 am »
Quote
If you download the Intel GMA drivers from the support.intel.com website you will get the drivers that have debugging information [...]

I have the same issue. And I have Intel(R) GMA Driver for mobile installed.

I agree you conclusion

Config :arrow: Mobile Intel(R) 965 Express Chipset Family