Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Access violation error and type error.

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2017
    Posts
    4

    Access violation error and type error.

    GL.glDrawArrays(GL.GL_TRIANGLES,0,model1.vertexcou nt)
    gives me an error saying:
    ctypes.ArgumentError:argument 3:<class 'TypeError'>: wrong type
    which i interpret as:
    the 3rd argument given to this function/method is in the wrong type
    so,i search on the internet for what type they want for the third argument ,it says:
    it wants GLsizei type,which is a non-negative binary integer.
    After that,i checked the model1.vertexcount's type by doing print(type(model1.vertexcount)) using python,it prints <class 'float'>
    I tried to change it to integer by doing int(model1.vertexcount),but it gives me an error:
    OSError:exception:access violation reading 0x0A56BAA8
    I also tried to input the value 6 myself,instead of letting the raw model class do the job,but it still output an Error:
    OSError:exception:access violation reading 0x0CD5DD98

    Notes:
    1)The hexadecimal number at the back part of the error differ in every run.
    2)i am using python

    Hope anyone can help me
    Thanks.....

  2. #2
    Intern Contributor
    Join Date
    Dec 2016
    Location
    Ocean Shores, WA USA
    Posts
    70
    Were you first getting the error from the compiler? and now you're getting the error when running the program?

    Jeff

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2017
    Posts
    4
    Python is an interpreted programming language,so it is harder to know weather it is compile time or run time errors,but I think you are right.so,what should I do to solve this error?

  4. #4
    Intern Contributor
    Join Date
    Dec 2016
    Location
    Ocean Shores, WA USA
    Posts
    70
    I dont' know python, unfortunately.... but can you use an Unsigned Int, or one of the GL variable types?

    Jeff

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2017
    Posts
    4
    Tried that,it doesnt work...

    Two of my python files:
    http://www.mediafire.com/file/8vfudf...b5/Ballopia.py
    http://www.mediafire.com/file/peenhcfta6b8671/loader.py

    I hope you can help me find whats causing the error and tell me how to solve it...

  6. #6
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,167
    Quote Originally Posted by hsunteik
    Code python:
    GL.glDrawArrays(GL.GL_TRIANGLES,0,model1.vertexcount)
    gives me an error saying:
    Code :
    ctypes.ArgumentError:argument 3:<class 'TypeError'>: wrong type
    which i interpret as:
    the 3rd argument given to this function/method is in the wrong type
    so,i search on the internet for what type they want for the third argument ,it says:
    it wants GLsizei type,which is a non-negative binary integer.
    After that,i checked the model1.vertexcount's type by doing print(type(model1.vertexcount)) using python,it prints <class 'float'>
    I tried to change it to integer by doing int(model1.vertexcount),but it gives me an error:
    Code :
    OSError:exception:access violation reading 0x0A56BAA8
    I'm sure you've already figured this out, but by adding the int() cast to argument 3 you've most likely solved your first error, which was keeping you from even calling the underlying glDrawArrays method in the underlying OpenGL driver.

    Once past that, either glDrawArrays in the OpenGL driver or the call to it in your Python wrapper library (GL.glDrawArrays) is crashing because something isn't setup right before the draw call, or your parameters to the draw call are wrong (too many vertices, bogus pointer provided, etc.). I would double-check that you have an active GL context before calling this function.

    Also make sure you are Checking for GL errors. If you find one is active before your draw call, trace it back to the source. Usually this points to some way you are misusing the OpenGL API.

    Finally, I would look carefully at how the VAO you're creating in loadtoVAO is supposed to be bound in render(). In particular, loadtoVAO() isn't returning the VAO id, and you're hard-coding a "1" for the VAO id passed into render(). I suspect this may be one of your problems.
    Last edited by Dark Photon; 11-13-2017 at 07:47 AM.

Posting Permissions

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