-4

My IDE can't recognize glActiveTexture method. I have installed freeglut and GLEW lib, when I build my project IDE doesn't show any error but when i run program i have this "has stopped working" type error. I don't really know how to fix it and what causes this problem. Another think is that IDE know the name of the function(this #thing) but I gues don't know the function itself (it should be () symbol just like in first function). glActiveTexture

I hope someone know solution for this problem.

Edit1 Here is mine example code:

#define GLEW_STATIC
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#endif

#include <iostream>
#include <stdlib.h>
using namespace std;
int main(int argc, char *argv[])
{
    glutInit(&argc, argv);
    GLenum err = glewInit();
    if (GLEW_OK != err)
    {
        cout<<"Error: "<<glewGetErrorString(err)<<endl;
    }
    else cout<<"Initialized"<<endl;

    return EXIT_SUCCESS;
}

and I'm getting Error: Missing GL version

Here is glewinfo:

GLEW version 1.13.0
Reporting capabilities of pixelformat 3
Running on a Intel(R) HD Graphics 4600 from Intel
OpenGL version 4.3.0 - Build 10.18.10.3960 is supported
student
  • 3
  • 1
  • 2
  • Did you create a OpenGL context? Did you initialize GLEW with the OpenGL context being created and active? Did you test that either OpenGL-1.2 or better is supported (you may end up on a fallback OpenGL-1.1 software implementation if your GPU drivers are improperly installed). – datenwolf Jan 09 '16 at 21:34
  • 1
    And please show a [MCVE](http://stackoverflow.com/help/mcve) – BDL Jan 09 '16 at 21:44

1 Answers1

1

You need to create an OpenGL rendering context before calling glewInit:

glutInit(&argc, argv);
glutCreateWindow("My Program");
GLenum err = glewInit();

See here for details.

Sam
  • 3,320
  • 1
  • 17
  • 22