PDA

View Full Version : Access violation error and type error.



hsunteik
11-03-2017, 03:04 AM
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.....:)

OceanJeff40
11-03-2017, 01:02 PM
Were you first getting the error from the compiler? and now you're getting the error when running the program?

Jeff

hsunteik
11-03-2017, 08:01 PM
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?

OceanJeff40
11-04-2017, 04:43 PM
I dont' know python, unfortunately.... but can you use an Unsigned Int, or one of the GL variable types?

Jeff

hsunteik
11-12-2017, 10:03 PM
Tried that,it doesnt work...

Two of my python files:
http://www.mediafire.com/file/8vfudfolkzgfqb5/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...

Dark Photon
11-13-2017, 07:16 AM
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'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 (https://www.khronos.org/opengl/wiki/OpenGL_Error). 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.