Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: another interesting GLEW error

  1. #11
    Member Regular Contributor
    Join Date
    Mar 2007
    Location
    CA
    Posts
    418

    Re: another interesting GLEW error

    Ok, lets try a helloworld code that only depends on GL, GLUT, and GLEW. Does the following compile and run successfully on your troubled setup?

    you should see some text to stdout and a blue rectangle
    Code :
    $ on my machine the console text result is: 
    OpenGL 4.2.0 NVIDIA 290.10, GLSL 4.20 NVIDIA via Cg compiler
    Quiting, so cleanup GL shader resources

    p.s. I have stopped using glut from your referenced source ( it hasn't been updated for multiple years) and have gone with freeglut instead ... but don't worry about that yet. Just try the following code with your current libraries.

    Code :
    #include <stdio.h>
    #include <GL/glew.h>
    #include <GL/glut.h>
     
    GLuint program;
    GLuint vao;
    GLuint bon_vert; // buffer object name
    size_t VertexArrayCount;
     
    void cleanupGLshader(void) {
      printf("Quiting, so cleanup GL shader resources\n");
      glDeleteBuffers(1,&amp;bon_vert);
      glDeleteVertexArrays(1,&amp;vao);
      glDeleteProgram(program);
    }
     
    void initGLshader(void) 
    {
      //Create shaders for shader program
      GLuint vshader=glCreateShader(GL_VERTEX_SHADER);
      GLuint fshader=glCreateShader(GL_FRAGMENT_SHADER);
     
      const GLchar *vshader_source[] = 
      {
      "#version 150 core\n"
      "\n"
      "in vec3 vert;\n"
      "\n"
      "void main() {\n"
      "  gl_Position=vec4(vert,1.);\n"
      "}\n"
      "\n"
      };
      glShaderSource(vshader,1,vshader_source,NULL);
     
      const GLchar *fshader_source[] = 
      {
      "#version 150 core\n"
      "out vec4 fragcolor;\n"
      "\n"
      "void main() {\n"
      "\n"
      "  fragcolor=vec4(0.0f,0.0f,1.0f,0.0f);\n"
      "}\n"
      "\n"
      };
      glShaderSource(fshader,1,fshader_source,NULL);
     
      glCompileShader(vshader);
      glCompileShader(fshader);
     
      //Create shader program
      program=glCreateProgram();
      glAttachShader(program,vshader);
      glAttachShader(program,fshader);
      glLinkProgram(program);
      glUseProgram(program);
     
      //done with shader source
      glDeleteShader(fshader);
      glDeleteShader(vshader);
     
      //Get handles to shader uniforms
      //... none for this simple vert/frag shader
     
      //Datas destioned for video memory, can be local (and lost after bound to GPU!). 
      #define R 0.9
      GLfloat vertices[] = { // in vec3 vert;
        -R,  R, 0.0, // xyz 
        -R, -R, 0.0, 
         R,  R, 0.0,
         R, -R, 0.0
       };
       VertexArrayCount=sizeof(vertices)/(sizeof(GLfloat)*3); // 3 for {x y z}
     
      //Create geometry vertex array using Model definition
      //use global GLuint vao;
      glGenVertexArrays(1,&amp;vao);
      glBindVertexArray(vao);
     
      //in vec3 vert;
      //use global GLuint bon_vert; // buffer object name
      glGenBuffers(1,&amp;bon_vert);
      glBindBuffer(GL_ARRAY_BUFFER,bon_vert);
      glBufferData(GL_ARRAY_BUFFER,sizeof(GLfloat)*3*VertexArrayCount,vertices,GL_STATIC_DRAW);
      const GLint loc_vert(glGetAttribLocation(program,"vert"));
      glVertexAttribPointer(loc_vert,3,GL_FLOAT,GL_TRUE,0,NULL);
      glEnableVertexAttribArray(loc_vert);
     
      //when exiting delete shared GL resources
      atexit(cleanupGLshader);
    }
     
    void reshape(int w, int h)
    {
      glViewport(0, 0, w, h);
    }
     
    void display()
    {
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     
      glBindVertexArray(vao);
      glDrawArrays(GL_TRIANGLE_STRIP,0,VertexArrayCount);
     
      glutSwapBuffers();
    }
     
    int main(int argc, char **argv)
    {
      glutInit(&amp;argc, argv);
      glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
      glutCreateWindow("glut glew HelloWorld");
      glutReshapeFunc(reshape);
      glutDisplayFunc(display);
     
      glewInit();
      printf("OpenGL %s, GLSL %s\n", glGetString(GL_VERSION),
           glGetString(GL_SHADING_LANGUAGE_VERSION));
     
      initGLshader();
     
      glutMainLoop();
      return 0;
    }

  2. #12
    Junior Member Newbie
    Join Date
    Jan 2012
    Posts
    6

    Re: another interesting GLEW error

    Hello,
    After compiling your code (thanks for the effort btw ) I get same error as before, but instead of __glewGenVertexArray it fails on __glewDeleteVertexArrays. Same as before - runtime error, same message.

  3. #13
    Member Regular Contributor
    Join Date
    Mar 2007
    Location
    CA
    Posts
    418

    Re: another interesting GLEW error

    I have not seen such a persistent error with glew before especially when glewinfo.exe reports these functions as "ok".

    One last long shot along lines of what I dismissed earlier - "Could file glew32.dll be corrupted somehow?" -- search your hardrive for all instances of glew32*.dll and glew32*.lib ... Is there some older version that is not your recently compiled 1.7 version that is getting used during runtime? Note this is assuming compile/installation of glew along lines of quick search result


  4. #14
    Junior Member Newbie
    Join Date
    Jun 2010
    Posts
    3

    Re: another interesting GLEW error

    Not sure if you have solved this problem or not. I have recently met the same problem, I solved it by just copying the glew32.dll and glew32mx.dll to the folder where my visual studio project is, that solved the problem. hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •