Results 1 to 8 of 8

Thread: CL_OpenGLGraphicContextProvider::reset_texture

  1. #1

    Default CL_OpenGLGraphicContextProvider::reset_texture

    I'm having a lot of difficulty narrowing down the reason that my program sometimes crashes on startup.

    No CL_Exception is thrown; I get a read access violation on a line in CL_OpenGLGraphicContextProvider::reset_texture.

    I won't pretend to understand what this function does.

    I only started having this problem recently, but due to the fact that the crash occurs "sometimes", I'm still not sure what addition to my code caused this to start.

    I am not yet able to reproduce the error, as I have no idea where it's rooted. I don't expect anyone to be able to give me a definitive answer.

    What would help me is if someone can explain what this function does, when it is called (I'm trying to figure this out but haven't yet), and if possible, some things that might cause a crash like this.

    The line in reset_texture where the break happens is:

    Code:
    glActiveTexture( GL_TEXTURE0 + unit_index );
    Thanks for taking the time to read this!

    Update: no progress, really, but here's the documentation on CL_GraphicContextProvider::reset_texture.

    Is it odd that I can't find CL_OpenGLGraphicContextProvider in the docs, but the code is breaking on its reset_texture method?
    Last edited by Pigmess; 03-04-2012 at 10:27 PM.

  2. #2
    Lesser Knight
    Join Date
    Sep 2011
    Posts
    38

    Default

    Sorry, I can't solve your question. But I can tell you why the Document doesn't have CL_GraphicContextProvider.
    Download the lastest source from http://clanlib.org/wiki/Download
    And check Source/GL/ directory, you'll find the source code there(named opengl_graphic_context_provider.h).
    The online doxygen document only builds the code in Source/API directory, and CL_GraphicConectProvider's header is not there( but in Source/GL/ ).

  3. #3

    Default

    Quote Originally Posted by apple1000 View Post
    Download the lastest source from http://clanlib.org/wiki/Download
    Thanks for the response. I do have the latest source - in fact, I started this project on 2.3.4, and when I saw that the recent 2.3.5 listed no breaking changes, I made the upgrade.

    I downloaded the precompiled binaries, but am pointing VS10 at the source located in the source code package linked on the examples page.

    Perhaps the link on the examples page points to an outdated version of the source?

  4. #4
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,768

    Default

    CL_GraphicContext calls the low level graphics provider functions via an interface class (CL_GraphicContextProvider)

    For OpenGL, this is CL_OpenGLGraphicContextProvider. This is an internal class, not exposed to the API.

    reset_texture() tells OpenGL that we are not using the texture for slot number "unit_index"

    For glActiveTexture() to fail, I can think of these reasons:

    1) The pointer for "glActiveTexture" (alias to CL_OpenGL::functions->activeTexture ) has been damaged by a bug in your code.
    This can be checked by inspecting the pointer before and after the crash
    Here is the watch value: I get this value (yours will be different)
    Code:
    		(*(CL_OpenGL::functions)).activeTexture	0x61828790	void (unsigned int)*
    2) There is a bug with your graphics card driver. This is unlikely since glActiveTexture has been around since around OpenGL 1.2

    3) You call reset_texture() in your own destructor after the display window was destroyed. This is unlikely since there is no reason for you to call this function in a destructor.

    Have a look at the debugger call stack, it can give lots of clues.

  5. #5

    Default

    Thanks for the quick response.

    1) The pointer for "glActiveTexture" (alias to CL_OpenGL::functions->activeTexture ) has been damaged by a bug in your code.
    This can be checked by inspecting the pointer before and after the crash
    Should I place a watch on the alias, or the full name? Does it matter which? (I'll try both.)

    2) There is a bug with your graphics card driver. This is unlikely since glActiveTexture has been around since around OpenGL 1.2
    Although I doubt this, I have been having some issues with my graphics card recently. It might be worthwhile for me to reproduce it on another machine, which I'll be able to do tomorrow morning.

    3) You call reset_texture() in your own destructor after the display window was destroyed.
    You're right, there is no reason for me to do this, and I definitely haven't.

    I'll keep you posted on my progress with (1) tonight. If the problem persists, I'll look at trying the code on another machine tomorrow morning in an attempt to determine if (2) is the culprit.

    Thanks for the in-depth look, it is helpful.

  6. #6
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,768

    Default

    Also, sometimes a "rebuild all" (or make clean) fixes unusual problems.

    (very occasionally the compiler can get confused for various reasons)

  7. #7

    Default

    I meant to post here a minute after my last one, but had trouble connecting to the forum.

    I believe I've ruled out (1), as I have tried to capture here:

    Click image for larger version. 

Name:	Capture.PNG 
Views:	10 
Size:	70.9 KB 
ID:	733

    As you can see, the code has stopped on the line I highlighted (funny how it seems to take more tries to get it to happen when I actually want it to), and I've placed a watch on the value you suggested. Apparently I can't put a watch on an alias, but the value seems to be valid.

    Also, sometimes a "rebuild all" (or make clean) fixes unusual problems.
    I've done cleans and rebuilds, and I have a batch file set up to nuke all the generated files in the project, which I run from time to time or when the compiler is acting strange.

    I'm starting to think it would be very beneficial for me to run the code on another machine.

  8. #8

    Default

    I can't say so definitively, but it seems that the issue is restricted to my home desktop. :P

    Thanks for your help in figuring this out.

Bookmarks

Bookmarks

Posting Permissions

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