Crash of the first OpenGL Superbible

This does not work, obviously. The code is copied directly from the provided source. I put the libraries and headers where they told me. Execution of this result leads to some failure.

I asked several people to start it, all of them said that he gave them an error regarding the missing DLLs and did not try to run a program completely different from what was happening to me.

from the "x.exe has stopped working" dialog box:

Problem signature:
  Problem Event Name:   BEX
  Application Name: OpenGLtutorialCh2.exe
  Application Version:  0.0.0.0
  Application Timestamp:    4d02d634
  Fault Module Name:    StackHash_0a9e
  Fault Module Version: 0.0.0.0
  Fault Module Timestamp:   00000000
  Exception Offset: 00000000
  Exception Code:   c0000005
  Exception Data:   00000008
  OS Version:   6.1.7600.2.0.0.256.48
  Locale ID:    1033
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

Addition:

    1>------ Rebuild All started: Project: OpenGLtutorialCh2, Configuration: Debug Win32 ------
1>  triangle.cpp
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>gltools.lib(GLBatch.obj) : warning LNK4099: PDB 'vc90.pdb' was not found with 'gltools.lib(GLBatch.obj)' or at 'C:\Users\Bacu\documents\visual studio 2010\Projects\OpenGLtutorialCh2\Debug\vc90.pdb'; linking object as if no debug info
1>gltools.lib(glew.obj) : warning LNK4099: PDB 'vc90.pdb' was not found with 'gltools.lib(glew.obj)' or at 'C:\Users\Bacu\documents\visual studio 2010\Projects\OpenGLtutorialCh2\Debug\vc90.pdb'; linking object as if no debug info
1>gltools.lib(GLShaderManager.obj) : warning LNK4099: PDB 'vc90.pdb' was not found with 'gltools.lib(GLShaderManager.obj)' or at 'C:\Users\Bacu\documents\visual studio 2010\Projects\OpenGLtutorialCh2\Debug\vc90.pdb'; linking object as if no debug info
1>gltools.lib(GLTools.obj) : warning LNK4099: PDB 'vc90.pdb' was not found with 'gltools.lib(GLTools.obj)' or at 'C:\Users\Bacu\documents\visual studio 2010\Projects\OpenGLtutorialCh2\Debug\vc90.pdb'; linking object as if no debug info
1>gltools.lib(GLTriangleBatch.obj) : warning LNK4099: PDB 'vc90.pdb' was not found with 'gltools.lib(GLTriangleBatch.obj)' or at 'C:\Users\Bacu\documents\visual studio 2010\Projects\OpenGLtutorialCh2\Debug\vc90.pdb'; linking object as if no debug info
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>gltools.lib(GLBatch.obj) : warning LNK4099: PDB 'vc90.pdb' was not found with 'gltools.lib(GLBatch.obj)' or at 'C:\Users\Bacu\documents\visual studio 2010\Projects\OpenGLtutorialCh2\Debug\vc90.pdb'; linking object as if no debug info
1>gltools.lib(glew.obj) : warning LNK4099: PDB 'vc90.pdb' was not found with 'gltools.lib(glew.obj)' or at 'C:\Users\Bacu\documents\visual studio 2010\Projects\OpenGLtutorialCh2\Debug\vc90.pdb'; linking object as if no debug info
1>gltools.lib(GLShaderManager.obj) : warning LNK4099: PDB 'vc90.pdb' was not found with 'gltools.lib(GLShaderManager.obj)' or at 'C:\Users\Bacu\documents\visual studio 2010\Projects\OpenGLtutorialCh2\Debug\vc90.pdb'; linking object as if no debug info
1>gltools.lib(GLTools.obj) : warning LNK4099: PDB 'vc90.pdb' was not found with 'gltools.lib(GLTools.obj)' or at 'C:\Users\Bacu\documents\visual studio 2010\Projects\OpenGLtutorialCh2\Debug\vc90.pdb'; linking object as if no debug info
1>gltools.lib(GLTriangleBatch.obj) : warning LNK4099: PDB 'vc90.pdb' was not found with 'gltools.lib(GLTriangleBatch.obj)' or at 'C:\Users\Bacu\documents\visual studio 2010\Projects\OpenGLtutorialCh2\Debug\vc90.pdb'; linking object as if no debug info
1>  OpenGLtutorialCh2.vcxproj -> C:\Users\Bacu\documents\visual studio 2010\Projects\OpenGLtutorialCh2\Debug\OpenGLtutorialCh2.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

Code in question:

    #include <GLTools.h>
#include <GLShaderManager.h>

#ifdef __APPLE__
#include <glut/glut.h>
#else
#define FREEGLUT_STATIC
#include <GL/glut.h>
#endif

GLBatch triangleBatch;
GLShaderManager shaderManager;


///////////////////////////////////////////////////////////////////////////////
// Window has changed size, or has just been created. In either case, we need
// to use the window dimensions to set the viewport and the projection matrix.
void ChangeSize(int w, int h)
{
    glViewport(0,0,w,h);
}

///////////////////////////////////////////////////////////////////////////////
// This function does any needed initialization on the rendering context.
// This is the first opportunity to do any OpenGL related tasks.
void SetupRC()
{
    glClearColor(0.0f,0.0f,1.0f,1.0f);

    shaderManager.InitializeStockShaders();

    GLfloat vVerts[]= {
        -0.5f,  0.0f,   0.0f,
        0.5f,   0.0f,   0.0f,
        0.0f,   0.5f,   0.0f };

    triangleBatch.Begin(GL_TRIANGLES, 3);
    triangleBatch.CopyVertexData3f(vVerts);
    triangleBatch.End();
}

///////////////////////////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
{
    // Clear the window with current clearing color
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

    GLfloat vRed[] = {1.0f, 0.0f, 0.0f, 1.0f};
    shaderManager.UseStockShader(GLT_SHADER_IDENTITY, vRed);
    triangleBatch.Draw();
    glutSwapBuffers();
}

///////////////////////////////////////////////////////////////////////////////
// Main entry point for GLUT based programs
int main(int argc, char* argv[])
{
    gltSetWorkingDirectory(argv[0]);

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
    glutInitWindowSize(800,600);
    glutCreateWindow("Triangle");
    glutReshapeFunc(ChangeSize);
    glutDisplayFunc(RenderScene);

    GLenum err = glewInit();
    if (GLEW_OK != err) {
        fprintf(stderr, "GLEW ERROR: %s\n", glewGetErrorString(err));
        return 1;
    }

    SetupRC();
    glutMainLoop();
    return 0;
}

I asked several people to start it, all of them said that he gave them an error regarding the missing DLLs and did not try to run a program completely different from what was happening to me.

+3
source share
4 answers

I prevented this from happening until the bad driver.

0
source

Actually, the information you provide shows that the application was compiled:

========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

The rest of the messages were just warnings.

+4

LNK4098 - , , > C/++ > > DLL . ( Debug. Release DLL .)

LNK4099 - , .pdb , . .pdb, - , (Debug Release) Debug Release .

, . , , , .

+1

In fact, you are confused by your code - GLUT and WGL in one project ... Try to use only excess as shown in these examples http://www.lighthouse3d.com/opengl/glut/ Worked perfectly on my Ubuntu laptop and Win7x64 desktop.

0
source

Source: https://habr.com/ru/post/1779699/


All Articles