Results 1 to 7 of 7

Thread: glGenTextures problem in MFC app

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2002
    Location
    Atlanta, GA USA
    Posts
    5

    glGenTextures problem in MFC app

    I am doing a very elementary OpenGL application under Windows, and am using MFC. I know, it's a performance pig, but I'm just trying to get my head around the big picture of OpenGL.

    However, whenever I call glGenTextures in the application, no texture number is generated. glGetError returns GL_INVALID_OPERATION. According to the documentation, this only can happen if glGenTextures is called between glBegin and glEnd.

    I have checked exhaustively, including adding code at the earliest possible place in my code, and am certain that I am not calling glBegin before the glGenTextures call.

    I've built some GLUT demos on my machine that use texture objects and traced through them, and they all perform as expected. Has anyone seen anything like this, or can anyone help a flustered newbie with this?

    Thanks in advance for any suggestions!

    - Steve

  2. #2
    Guest

    Re: glGenTextures problem in MFC app

    Does your code look something like this:
    Code :
    		glGenTextures	(1, &textureID[0]);					// Generate space for Texture Objects

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2002
    Location
    Atlanta, GA USA
    Posts
    5

    Re: glGenTextures problem in MFC app

    I have a class I am using for maintaining individual textures, so it's more along the lines of:

    GLuint m_nTextureID; // this is declared in the header file
    .
    .
    .

    glGenTextures (1, &m_nTextureID); // this is called when I load a texture

    I'm hoping that there is something really obvious I'm doing here, and I've just being staring at the code too long to see it.

    - Steve

  4. #4
    Guest

    Re: glGenTextures problem in MFC app

    Dunno... I was hoping for summit obvious 2.

    Can you post a pointer to the code?

  5. #5
    Senior Member Regular Contributor
    Join Date
    Oct 2001
    Location
    Princeton, NJ
    Posts
    380

    Re: glGenTextures problem in MFC app

    When you call glGenTextures have you created a resource context and set it up as the current context? I am fairly sure that no GL functions will work till you have done that

  6. #6
    Member Contributor
    Join Date
    May 2001
    Posts
    54

    Re: glGenTextures problem in MFC app

    Yeah, Make sure you call glGenTex after you make the context current. Otherwise you would get the INVALID_OPERATION error that you noted....

    Jeremy

  7. #7
    Junior Member Newbie
    Join Date
    Jan 2002
    Location
    Atlanta, GA USA
    Posts
    5

    Re: glGenTextures problem in MFC app

    Well, I feel sheepish. Yes, I was trying to call the function outside of a valid render context. Things are working much better now the performance gain is pretty staggering too.

    Thanks to all who replied!

    - Steve

Similar Threads

  1. glGenTextures
    By Omaha in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 05-22-2005, 07:14 PM
  2. glGenTextures() gives 0
    By Markkos in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-10-2004, 01:06 AM
  3. glGenTextures ... what's going on?
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-03-2004, 05:10 AM
  4. glGenTextures problem
    By Toxigun in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 11-06-2001, 02:19 AM
  5. glGenTextures gives back a zero
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-10-2000, 12:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean