Original Post
O.k. I have a class that has a pointer to a structure. When I init the pointer it works in one program(DOS) but gives me an access violation In a windows prog?? Here is my code.
defs:
init:
bool MD2::LoadMD2(char *fileName)
{
int i;
FILE *filePointer;
filePointer=fopen(fileName,"rb");
if(!filePointer)
{
return FALSE;
}
fread(&header,1,sizeof(MD2_HEADER),filePointer);
if(header.numFrames<1)
{
// cout<<"FUCK"<,1,sizeof(MD2_TRIANGLE),filePointer);
fseek(filePointer,header.offsetFrames,SEEK_SET);
for(i=0;i[edited by - tHiSiSbOb on December 6, 2002 6:36:44 PM]
[edited by - tHiSiSbOb on December 6, 2002 6:37:46 PM]
#ifndef _defs_h_
#define _defs_h_
#include <windows.h>
#include <stdio.h>
#include <gl\gl.h> // Header File For The OpenGL32 Library
#include <gl\glu.h>
struct VERTEX
{
float x;
float y;
float z;
float R;
float G;
float B;
float texx;
float texy;
};
struct MD2_HEADER
{
int magic;
int version;
int skinWidth;
int skinHeight;
int frameSize;
int numSkins;
int numVertices;
int numTexCoords;
int numTriangles;
int numGlCommands;
int numFrames;
int offsetSkins;
int offsetTexCoords;
int offsetTriangles;
int offsetFrames;
int offsetGlCommands;
int offsetEnd;
};
struct MD2_VERTEX
{
byte vertex[3];
byte lightNormalIndex;
};
struct MD2_FRAME
{
float scale[3];
float translate[3];
char name[16];
MD2_VERTEX verts[1];
};
class INFINITY
{
public:
void RenderVertexList(VERTEX * vertList,int numPrims);
};
typedef struct
{
short vertex[3];
short texture[3];
} MD2_TRIANGLE;
class MD2
{
public:
MD2_HEADER header;
MD2_FRAME *frames;
MD2_TRIANGLE *triangles;
bool LoadMD2(char *fileName);
void RenderMD2();
};
#endif