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

Author Topic: OpenGL issues with nvidia nvoglv32.dll  (Read 7254 times)

0 Members and 1 Guest are viewing this topic.

Gauzr

  • Newbie
  • *
  • Posts: 20
    • View Profile
OpenGL issues with nvidia nvoglv32.dll
« on: June 21, 2015, 04:32:18 pm »
In my code I used some opengl, but I get an error when debugging (Other code works fine). I get this error:

Unhandled exception at 0x02BCD6AE (nvoglv32.dll) in sfmlTest.exe: 0xC0000005: Access violation reading location 0x00000000.

It goes on to say nvoglv32.pdb is not loaded, but to be honest I have little idea about what this is about. Let me know if you need my opengl code, although it will take me a while as it is quite sparse in my game. Is there an easy fix for this?

Edit: It seems sprites or shapes don't draw at all either.
« Last Edit: June 21, 2015, 06:34:03 pm by Gauzr »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: OpenGL issues with nvidia nvoglv32.dll
« Reply #1 on: June 21, 2015, 04:37:05 pm »
Without a minimal complete example*, we can't say anything. Just make sure that your drivers are up-to-date and that you link everything correctly.

________
* In order to save your and our time and to avoid unnecessary questions, it is absolutely crucial that you read that post carefully.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Gauzr

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: OpenGL issues with nvidia nvoglv32.dll
« Reply #2 on: June 21, 2015, 06:12:28 pm »
I had to borrow some of the the opengl example from sfml and use it in the code, as it would of taken way too long to get the original code together, but the result/error is still the same.

#ifndef windowo
#define windowo

#include <SFML/OpenGL.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>


void welcomescreen()
{

        // Request a 32-bits depth buffer when creating the window
        sf::ContextSettings contextSettings;
        contextSettings.depthBits = 48;

        // Create the main window
        sf::RenderWindow windowo(sf::VideoMode(640, 480), "gameTest", sf::Style::Default, contextSettings);
        windowo.resetGLStates();        
        windowo.setVerticalSyncEnabled(true);
       
        sf::Font txt;
        if (!txt.loadFromFile("resources/armyfont.ttf"))
        {
                cout << "An error has occured loading the font.";
        }
       
        sf::Text wlcmtxt;      
        wlcmtxt.setFont(txt);
        wlcmtxt.setScale(1.4, 1.4);
        wlcmtxt.setString("gameTest");
        wlcmtxt.setOrigin(-130, -0);

        // Make it the active window for OpenGL calls
        windowo.setActive();

        // Set the color and depth clear values
        glClearDepth(1.f);
        glClearColor(0.f, 0.f, 0.f, 1.f);

        // Enable Z-buffer read and write
        glEnable(GL_DEPTH_TEST);
        glDepthMask(GL_TRUE);

        // Disable lighting and texturing
        glDisable(GL_LIGHTING);
        glDisable(GL_TEXTURE_2D);
       
        glViewport(0, 0, windowo.getSize().x, windowo.getSize().y);

        // Setup a perspective projection
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        GLfloat ratio = static_cast<float>(windowo.getSize().x) / windowo.getSize().y;
        glFrustum(-ratio, ratio, -1.f, 1.f, 1.f, 800.f);

        // Define a 3D cube (6 faces made of 2 triangles composed by 3 vertices)
        GLfloat cube[] =
        {
                // positions    // colors (r, g, b, a)
                -50, -50, -50, 0, 0, 1, 1,
                -50, 50, -50, 0, 0, 1, 1,
                -50, -50, 50, 0, 0, 1, 1,        // blue
                -50, -50, 50, 0, 0, 1, 1,
                -50, 50, -50, 0, 0, 1, 1,
                -50, 50, 50, 0, 0, 1, 1,

                50, -50, -50, 0, 1, 0, 1,       //green
                50, 50, -50, 0, 1, 0, 1,
                50, -50, 50, 0, 1, 0, 1,
                50, -50, 50, 0, 1, 0, 1,
                50, 50, -50, 0, 1, 0, 1,
                50, 50, 50, 0, 1, 0, 1,

                -50, -50, -50, 1, 0, 0, 1,         //red
                50, -50, -50, 1, 0, 0, 1,
                -50, -50, 50, 1, 0, 0, 1,
                -50, -50, 50, 1, 0, 0, 1,
                50, -50, -50, 1, 0, 0, 1,
                50, -50, 50, 1, 0, 0, 1,

                -50, 50, -50, 0, 1, 1, 1,
                50, 50, -50, 0, 1, 1, 1,
                -50, 50, 50, 0, 1, 1, 1,                //cyan
                -50, 50, 50, 0, 1, 1, 1,
                50, 50, -50, 0, 1, 1, 1,
                50, 50, 50, 0, 1, 1, 1,

                -50, -50, -50, 1, 0, 1, 1,
                50, -50, -50, 1, 0, 1, 1,
                -50, 50, -50, 1, 0, 1, 1,               //purple
                -50, 50, -50, 1, 0, 1, 1,
                50, -50, -50, 1, 0, 1, 1,
                50, 50, -50, 1, 0, 1, 1,

                -50, -50, 50, 1, 1, 0, 1,
                50, -50, 50, 1, 1, 0, 1,
                -50, 50, 50, 1, 1, 0, 1,
                -50, 50, 50, 1, 1, 0, 1,                //yellow
                50, -50, 50, 1, 1, 0, 1,
                50, 50, 50, 1, 1, 0, 1,

        };


        // Enable position and color vertex components
        glEnableClientState(GL_VERTEX_ARRAY);
        glEnableClientState(GL_COLOR_ARRAY);
        glVertexPointer(3, GL_FLOAT, 7 * sizeof(GLfloat), cube);
        glColorPointer(4, GL_FLOAT, 7 * sizeof(GLfloat), cube + 3);

        // Disable normal and texture coordinates vertex components
        glDisableClientState(GL_NORMAL_ARRAY);
        glDisableClientState(GL_TEXTURE_COORD_ARRAY);

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

        // Start the game loop
        while (windowo.isOpen())
        {
                // Process events
                sf::Event event;
                while (windowo.pollEvent(event))
                {
                        // Close window: exit
                        if (event.type == sf::Event::Closed)
                                windowo.close();

                        // Escape key: exit
                        if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape))
                                windowo.close();

                        // Resize event: adjust the viewport
                        if (event.type == sf::Event::Resized)
                                glViewport(0, 0, event.size.width, event.size.height);
                }

       
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::S))
                {
                        windowo.close();
                }
               
               
                // Clear the color and depth buffers
                glClearColor(1.0, 1.0, 1.0, 1.0); // add this

                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
                glColor3f(1.0f, 0.0f, 0.0f);

                // Apply some transformations to rotate the cube
                glMatrixMode(GL_MODELVIEW);
                glLoadIdentity();
                glTranslatef(0.f, 0.f, -200.f);
                glRotatef(clock.getElapsedTime().asSeconds() * 50, 1.f, 0.f, 0.f);
                glRotatef(clock.getElapsedTime().asSeconds() * 30, 0.f, 1.f, 0.f);
                glRotatef(clock.getElapsedTime().asSeconds() * 90, 0.f, 0.f, 1.f);

                // Draw the cube
                glDrawArrays(GL_TRIANGLE_STRIP, 0, 36);
               
                windowo.pushGLStates();
        //      windowo.draw(wlcmtxt); 
                windowo.popGLStates();
                windowo.pushGLStates();
                windowo.popGLStates();

                // Finally, display the rendered frame on screen
                windowo.display();
        }
}

#endif


 

I have the latest Nvidia drivers, I don't think that's the problem. I'm also using SFML 2.2 if that helps.
« Last Edit: June 21, 2015, 06:40:00 pm by Gauzr »

Gauzr

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: OpenGL issues with nvidia nvoglv32.dll
« Reply #3 on: June 21, 2015, 06:54:01 pm »
I figured out why it wasn't working, I had to remove the 4 lines after glDrawArrays. The only reason they were there is because of a copy and paste issue :P

 

anything