GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: Add Line Numbers


Errors. by richjkl
#ifndef _MAIN_H
#define _MAIN_H

#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glu32.lib")
#pragma comment(lib, "glaux.lib")
#pragma comment(linker, "/subsystem:windows")

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <gl\gl.h>                                        // Header File For The OpenGL32 Library
#include <gl\glu.h>                                        // Header File For The GLu32 Library
#include <vector.h>
#include <string.h>
#include <fstream.h>
#include <vector>
#include <string>
#include <fstream>
#include <gl\glaux.h>

using namespace std;

#define SCREEN_WIDTH 800                                // We want our screen width 800 pixels
#define SCREEN_HEIGHT 600                                // We want our screen height 600 pixels
#define SCREEN_DEPTH 16                                    // We want 16 bits per pixel


#define MAX_TEXTURES 1000

class CVector2 
{
public:
float x, y;
};

bool CreateTexture(UINT &texture, LPSTR strFileName);

struct tFace
{
int vertIndex[3]; // indicies for the verts that make up this triangle
int coordIndex[3]; // indicies for the tex coords to texture this face
};
struct tMaterialInfo
{
char strName[255]; // The texture name
char strFile[255]; // The texture file name (If this is set it's a texture map)
BYTE color[3]; // The color of the object (R, G, B)
int texureId; // the texture ID
float uTile; // u tiling of texture 
float vTile; // v tiling of texture 
float uOffset; // u offset of texture
float vOffset; // v offset of texture
}; 

struct t3DObject 
{
int numOfVerts; // The number of verts in the model
int numOfFaces; // The number of faces in the model
int numTexVertex; // The number of texture coordinates
int materialID; // The texture ID to use, which is the index into our texture array
bool bHasTexture; // This is TRUE if there is a texture map for this object
char strName[255]; // The name of the object
CVector3 * pVerts; // The object's vertices
CVector3 * pNormals; // The object's normals
CVector2 * pTexVerts; // The texture's UV coordinates
tFace * pFaces; // The faces information of the object
};
struct tAnimationInfo
{
char strName[255]; // This stores the name of the animation (I.E. "TORSO_STAND")
int startFrame; // This stores the first frame number for this animation
int endFrame; // This stores the last frame number for this animation
int loopingFrames; // This stores the looping frames for this animation (not used)
int framesPerSecond; // This stores the frames per second that this animation runs
};
// This our model structure
struct t3DModel 
{
int numOfObjects; // The number of objects in the model
int numOfMaterials; // The number of materials for the model
vector<tMaterialInfo> pMaterials; // The list of material information (Textures and colors)
vector<t3DObject> pObject; // The object list for our model
int numOfAnimations; // The number of animations in this model 
int currentAnim; // The current index into pAnimations list 
int currentFrame; // The current frame of the current animation 
int nextFrame; // The next frame of animation to interpolate too
float t; // The ratio of 0.0f to 1.0f between each key frame
float lastTime; // This stores the last time that was stored
vector<tAnimationInfo> pAnimations; // The list of animations

int numOfTags; // This stores the number of tags in the model
t3DModel **pLinks; // This stores a list of pointers that are linked to this model
struct tMd3Tag *pTags; // This stores all the tags for the model animations
};


struct CVector3
{
public:
    
    // A default constructor
    CVector3() {}

    // This is our constructor that allows us to initialize our data upon creating an instance
    CVector3(float X, float Y, float Z) 
    { 
        x = X; y = Y; z = Z;
    };

    // Here we overload the + operator so we can add vectors together 
    CVector3 operator+(CVector3 vVector)
    {
        // Return the added vectors result.
        return CVector3(vVector.x + x, vVector.y + y, vVector.z + z);
    };

    // Here we overload the - operator so we can subtract vectors 
    CVector3 operator-(CVector3 vVector)
    {
        // Return the subtracted vectors result
        return CVector3(x - vVector.x, y - vVector.y, z - vVector.z);
    };
    
    // Here we overload the - operator so we can subtract vectors 
    CVector3 operator*(float num)
    {
        // Return the subtracted vectors result
        return CVector3(x * num, y * num, z * num);
    };

    float x, y, z;                        
};


// Type this in your main header file (*.h)

struct Model
{
CVector3 position; // the position of our Model
CVector3 heading; // the heading of our Model
CVector3 speed; // the speed of our Model
float direction; // the direction of our Model
};


// Extern our global variables so other source files can use them
extern bool  g_bFullScreen;                                    // Set full screen as default
extern HWND  g_hWnd;                                        // This is the handle for the window
extern RECT  g_rRect;                                        // This holds the window dimensions
extern HDC   g_hDC;                                            // General HDC - (handle to device context)
extern HGLRC g_hRC;                                            // General OpenGL_DC - Our Rendering Context for OpenGL
extern HINSTANCE g_hInstance;                                // This holds our window hInstance

// This is our MAIN() for windows
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprev, PSTR cmdline, int ishow);

// The window proc which handles all of window's messages.
LRESULT CALLBACK WinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

// This controls our main program loop
WPARAM MainLoop();

// This changes the screen to full screen mode
void ChangeToFullScreen();

// This is our own function that makes creating a window modular and easy
HWND CreateMyWindow(LPSTR strWindowName, int width, int height, DWORD dwStyle, bool bFullScreen, HINSTANCE hInstance);

// This allows us to configure our window for OpenGL and backbuffered
bool bSetupPixelFormat(HDC hdc);

// This inits our screen translations and projections
void SizeOpenGLScreen(int width, int height);

// This sets up OpenGL
void InitializeOpenGL(int width, int height);

// This initializes the whole program
void Init(HWND hWnd);

// This draws everything to the screen
void RenderScene();

// This frees all our memory in our program
void DeInit();
#endif 
New Errors...

ompiling...
Main.cpp
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(65) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(65) : error C2501: 'CVector3' : missing storage-class or type specifiers
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(65) : error C2501: 'pVerts' : missing storage-class or type specifiers
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(66) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(66) : error C2501: 'CVector3' : missing storage-class or type specifiers
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(66) : error C2501: 'pNormals' : missing storage-class or type specifiers
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.cpp(147) : warning C4305: '+=' : truncation from 'const double' to 'float'
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.cpp(152) : warning C4305: '-=' : truncation from 'const double' to 'float'
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.cpp(161) : error C2143: syntax error : missing ';' before 'case'
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.cpp(162) : error C2143: syntax error : missing ';' before 'switch'
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.cpp(162) : error C2143: syntax error : missing ';' before '{'
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.cpp(162) : error C2447: missing function header (old-style formal list?)
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.cpp(177) : error C2143: syntax error : missing ';' before 'break'
Init.cpp
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(65) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(65) : error C2501: 'CVector3' : missing storage-class or type specifiers
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(65) : error C2501: 'pVerts' : missing storage-class or type specifiers
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(66) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(66) : error C2501: 'CVector3' : missing storage-class or type specifiers
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(66) : error C2501: 'pNormals' : missing storage-class or type specifiers
Md3.cpp
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(65) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(65) : error C2501: 'CVector3' : missing storage-class or type specifiers
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(65) : error C2501: 'pVerts' : missing storage-class or type specifiers
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(66) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(66) : error C2501: 'CVector3' : missing storage-class or type specifiers
c:\documents and settings\richjkl\desktop\cruor online\cruor\main.h(66) : error C2501: 'pNormals' : missing storage-class or type specifiers
c:\documents and settings\richjkl\desktop\cruor online\cruor\md3.cpp(437) : error C2039: 'pNormals' : is not a member of 't3DObject'

 
Comments by GLProgramming users
 
Author Comment by richjkl 02:11:12 30/Sep/2004 


    bool CreateTexture(UINT &texture, LPSTR strFileName); <-- The line they all refer to.

 
Author Comment by richjkl 02:14:20 30/Sep/2004 


    bool CreateTexture(UINT &texture, LPSTR strFileName); <-- The line they all refer to.

 
Author Comment by richjkl 02:14:29 30/Sep/2004 


    bool CreateTexture(UINT &texture, LPSTR strFileName); <-- The line they all refer to.