Thread: glGenTextures causes GL_INVALID_OPERATION

  1. #1
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345

    glGenTextures causes GL_INVALID_OPERATION

    I noticed that glGenTextures isn't generating textures and instead causing GL_INVALID_OPERATION error in the project I'm currently working on, first I thought that there is a missing glEnd or something, I looked for such a thing but everything was OK, so I created this program:
    Code:
    #include <windows.h>
    #include <gl/gl.h>
    #include <gl/glu.h>
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
        LPSTR lpCmdLine, int nCmdShow) {
    	UINT texture = 0;
    	glGenTextures(1, &texture);
    	GLenum e = glGetError();
    	switch (e) {
    		case GL_NO_ERROR:
    			MessageBox(NULL, "GL_NO_ERROR", "", MB_OK);
    			break;
    		case GL_INVALID_VALUE:
    			MessageBox(NULL, "GL_INVALID_VALUE", "", MB_OK);
    			break;
    		case GL_INVALID_OPERATION:
    			MessageBox(NULL, "GL_INVALID_OPERATION", "", MB_OK);
    			break;
    	};
    	return 0;
    }
    and it gave the same error
    I loaded one of my previous projects and it worked OK.
    So what am I doing wrong? does glGenTextures require some initialization (MSDN says nothing about this)?
    Last edited by glUser3f; 09-28-2003 at 07:08 AM.

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    because you have not setup a rendering context and initialized OpenGL.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    well, I guess this is the reason, I was testing a texture class I made to simplify texture operations, and I tried to test it in WinMain, thanks for the response

Popular pages Recent additions subscribe to a feed