Exception Writing Violation

Does anyone have a better eye than me?
I can't exactly locate this error that has been holding me up for quite some time now.


First-chance exception at 0x01093b05 in TechneQuad.exe: 0xC0000005: Access violation writing location 0x046f4000.
Unhandled exception at 0x770015de in TechneQuad.exe: 0xC0000005: Access violation writing location 0x046f4000.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
int Render::RenderVertexArray(){

	Exceptions Render_Exceptions;

	   struct Face{
		   
		   bool Front;
		   bool Back;

		   bool Right;
		   bool Left;

		   bool Top;
		   bool Bottom;

	   }VertexList[WORLD_X][WORLD_Y][WORLD_Z];

	    glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();
	   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  


		
        glTranslatef(-50,-50, -70.f); //add zero on end

    int CurrentBlock = 0;

	// Generate false list

   for(LoopCount x = 0; x < WORLD_X; x++)
    {
     for(LoopCount y = 0; y < WORLD_Y; y++)
     {
      for(LoopCount z = 0; z < WORLD_Z; z++)
	  {

	      VertexList[x][y][z].Front = false;
		  VertexList[x][y][z].Back = false;	

		  VertexList[x][y][z].Right = false;
		  VertexList[x][y][z].Left = false;

		  VertexList[x][y][z].Top = false;
		  VertexList[x][y][z].Bottom = false;

	  }

     }

    }


	for(LoopCount x = 0; x < WORLD_X; x++)
    {
     for(LoopCount y = 0; y < WORLD_Y; y++)
     {
      for(LoopCount z = 0; z < WORLD_Z; z++)
	  {

	        VertexList[x][y][z].Front  =  isClear(Render_Map.SelectBlock(x,y,z + 1));
			VertexList[x][y][z].Back   =  isClear(Render_Map.SelectBlock(x,y,z - 1));

			VertexList[x][y][z].Right  =  isClear(Render_Map.SelectBlock(x + 1,y,z));  
			VertexList[x][y][z].Left   =  isClear(Render_Map.SelectBlock(x - 1,y,z));  

			VertexList[x][y][z].Top    =  isClear(Render_Map.SelectBlock(x,y + 1,z));  
			VertexList[x][y][z].Bottom =  isClear(Render_Map.SelectBlock(x,y - 1,z));  

	  }
     }
    }


	unsigned __int64 ArraySizeCount;

	for(LoopCount x = 0; x < WORLD_X; x++)
    {
     for(LoopCount y = 0; y < WORLD_Y; y++)
     {
      for(LoopCount z = 0; z < WORLD_Z; z++)
	  {

		if( VertexList[x][y][z].Front == true)
		  ArraySizeCount += 1;
		if( VertexList[x][y][z].Back == true)
		  ArraySizeCount += 1;

		if( VertexList[x][y][z].Right == true)
		  ArraySizeCount += 1;
		if( VertexList[x][y][z].Left == true)
		  ArraySizeCount += 1;

		if( VertexList[x][y][z].Top == true)
		  ArraySizeCount += 1;
		if( VertexList[x][y][z].Bottom == true)
		  ArraySizeCount += 1;

	  }
     }
    }

	int *DynamicVertex;

	try{
		DynamicVertex = new int[ArraySizeCount];
	   } 

	catch(std::bad_alloc&)
	{
		Render_Exceptions.FindException(1);
		return 225;
	}

	unsigned __int64 VertexCount = 0;

	for(LoopCount Xposition = 0; Xposition < WORLD_X; Xposition++)
    {
     for(LoopCount Yposition = 0; Yposition < WORLD_Y; Yposition++)
     {
      for(LoopCount Zposition = 0; Zposition < WORLD_Z; Zposition++)
	  {

		 if( VertexList[Xposition][Yposition][Zposition].Front == true)
		{
		   DynamicVertex[VertexCount] = (-BLOCK_SIZE)+((BLOCK_SIZE*2)*Xposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (-BLOCK_SIZE)+((BLOCK_SIZE*2)*Yposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (BLOCK_SIZE)+((BLOCK_SIZE*2)*Zposition);
		   VertexCount++;

		   DynamicVertex[VertexCount] = (-BLOCK_SIZE)+((BLOCK_SIZE*2)*Xposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (BLOCK_SIZE)+((BLOCK_SIZE*2)*Yposition);
	       VertexCount++;
		   DynamicVertex[VertexCount] = (BLOCK_SIZE)+((BLOCK_SIZE*2)*Zposition);
		   VertexCount++;

		   DynamicVertex[VertexCount] = ( BLOCK_SIZE)+((BLOCK_SIZE*2)*Xposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (BLOCK_SIZE)+((BLOCK_SIZE*2)*Yposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (BLOCK_SIZE)+((BLOCK_SIZE*2)*Zposition);
		   VertexCount++;

		   DynamicVertex[VertexCount] = ( BLOCK_SIZE)+((BLOCK_SIZE*2)*Xposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (-BLOCK_SIZE)+((BLOCK_SIZE*2)*Yposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (BLOCK_SIZE)+((BLOCK_SIZE*2)*Zposition);
		   VertexCount++;
		}

		 if( VertexList[Xposition][Yposition][Zposition].Back == true)
		{
		   DynamicVertex[VertexCount] = (-BLOCK_SIZE)+((BLOCK_SIZE*2)*Xposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (-BLOCK_SIZE)+((BLOCK_SIZE*2)*Yposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (-BLOCK_SIZE)+((BLOCK_SIZE*2)*Zposition);
		   VertexCount++;

		   DynamicVertex[VertexCount] = (-BLOCK_SIZE)+((BLOCK_SIZE*2)*Xposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (BLOCK_SIZE)+((BLOCK_SIZE*2)*Yposition);
	       VertexCount++;
		   DynamicVertex[VertexCount] = (-BLOCK_SIZE)+((BLOCK_SIZE*2)*Zposition);
		   VertexCount++;

		   DynamicVertex[VertexCount] = ( BLOCK_SIZE)+((BLOCK_SIZE*2)*Xposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (BLOCK_SIZE)+((BLOCK_SIZE*2)*Yposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (-BLOCK_SIZE)+((BLOCK_SIZE*2)*Zposition);
		   VertexCount++;

		   DynamicVertex[VertexCount] = ( BLOCK_SIZE)+((BLOCK_SIZE*2)*Xposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (-BLOCK_SIZE)+((BLOCK_SIZE*2)*Yposition);
		   VertexCount++;
		   DynamicVertex[VertexCount] = (-BLOCK_SIZE)+((BLOCK_SIZE*2)*Zposition);
		   VertexCount++;
		}
	//And so on for Right, Left, Top, and Bottom	
	
	  }//X
     }//Y
    }//Z

      glEnableClientState(GL_VERTEX_ARRAY);
	  
	  glVertexPointer(3, GL_INT, 0, DynamicVertex);

	  glDrawArrays(GL_QUADS, 0, (VertexCount / 4));

	  glDisableClientState(GL_VERTEX_ARRAY);



	return 0;
}
Try to provide a minimal example that does reproduce your issue.

You did not initialize `ArraySizeCount'


By the way if( Boolean_variable == true ) should be
if( (((Boolean_variable == true) == true) == true) == true /*ad infinitum*/ )
Topic archived. No new replies allowed.