Vertex Arrays dont work

Started by
12 comments, last by executor_2k2 22 years, 3 months ago
I can make a demo using vertex arrays, and it will compile with no problems. When I run the .exe though it crashes. Any known problems with vertex arrays? I''m running Win XP on a GeForce3 ti500 with 21.83 dets. Any ideas? As you can imagine this is a major setback. Thanks in advance.
Well, that was a waste of 2 minutes of my life. Now I have to code faster to get 'em back...
Advertisement
2 things
youre not using correct pointers
youre pointing to bollux memory
What is bolux memory? Could you take a look at some sample source I have that wont run? thx

Edited by - executor_2k2 on January 27, 2002 3:59:07 PM
Well, that was a waste of 2 minutes of my life. Now I have to code faster to get 'em back...
this is exactly what i mean about people trying to get into game/graphics programming before they even understanding the basic funcdamentals of programming.

the problem is not with OpenGL. read the documentation on vertex arrays before you start using them. or try using the debug option of VS, that''s what it''s for.

anyway, the definition of bullox memory....

bullox memory: you are either trying to access memory that is not permitted to the application, or the memory is filled with invalid values.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
I dont think the code is at fault. It came with the "OpenGL Game Programming" book by kevin hawkins and dave astle. I understand vertex arrays. The code looks fine by my inspection. I am trying to find out if its an imcompatibility with my machine.

And d00d this is the "For Beginners" forum, so chill out.
Well, that was a waste of 2 minutes of my life. Now I have to code faster to get 'em back...
so what happens when you step through the code?

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
Well it says there is an access violation. When I get to the line

glDrawElements(GL_TRIANGLE_STRIP, MAP_X * 2, GL_UNSIGNED_INT, &g_indexArray[z * MAP_X * 2]);

"Unhandeled Exeception in terrain.exe (NVOGLNT.DLL): 0xC0000005: Access Violation"

here''s my definition of g_indexArray:
GLuint g_indexArray[MAP_X * MAP_Z * 6]; //vertex index array

From that error message im thinking memory access violation naturally. The problem is, I dont see where the memory access is going wrong.
Well, that was a waste of 2 minutes of my life. Now I have to code faster to get 'em back...
What are the values of MAP_X, MAP_Z and z? (Look in the Variables window). Are MAP_X and MAP_Z constants?

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!
yes they are constants. Both are equal to 32. I am trying to use vertex arrays for a terrain based on a height map.
Well, that was a waste of 2 minutes of my life. Now I have to code faster to get 'em back...
okay so you are creating an array of size (32x32x6) = 6144 integers.

you are telling "glDrawElements" to draw (32x2) = 64 vertices.

now, what is the value of "z" when this access violation occurs?

Edit: 2048 -> 6144, my math is a little off.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Edited by - jenova on January 27, 2002 10:05:22 PM
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

This topic is closed to new replies.

Advertisement