i know somewhere i need to set Skybox_Initialize(10.0) into the header file.
the function is under the class CGfxOpenGL::Init() which is shown on the header file.
I made a new class called class Skybox; but im sure thats not enough.
i tried having Skybox_Initialize(10.) under the public CGfxOpenGL(); destructor. of course below the virtural. i guess thats not enough for the compiler to regcognize it as a declaration.
theres is also a CSkybox Header file which im really not to concerned about.
My primary focus is just on the CGfxOpenGL file and its header.
Enough babbaling heres the code:
Header:
ifndef __GL_COMPONENT
define __GL_COMPONENT
const int TERRAIN_SIZE = 260;
define PI 3.14159f
define DEG2RAD(x) (x*PI)/180.0f
class Skybox;
class CGfxOpenGL
{
private:
GLubyte heightmap[TERRAIN_SIZE * TERRAIN_SIZE];
int m_windowWidth;
int m_windowHeight;
No. I am really not going to bother this time. It is a waste of time. You seem determined to learn nothing and to ignore all advice previously given.
If you cannot imagine why doing initialisation in a destructor makes no sense you are completely lost! Nothing you have written in either English or code makes much sense. Further if you have not yet figured out the difference between a function declaration and a function call as seems to be the case you are truly up-the-creek.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Could u please help? i would really like to see this. I would like to apologize for my ignorance and i wish to obtain my help via this website.
ok what im having trouble with is undeclared declarations, i.e. Skybox_Initialize(10.0)
My first step is to see what class its under which happens to be 'bool CGfxOpenGL::Init()
now(which is probably a mistake) i go to the CGfxOPenGL header file and notice that there already is a class named CGfxOpenGL. IF im correct the skybox_Intialize should be under the CGfxOpenGL class.
now since my declaration of bool Skybox_Initalize(10.0) is under CGfxOpenGL::Init() i would place my Skybox_Initialize(10.0) under private.
but unfortunatly it does not recognize it and reads undeclared.
what im wondering is do i have to make an entirely new class for Skybox that im using? for instance:
could u please help? im sorry for not understanding. i will be more educated in the future i can promise that. i hope u are all doing well and happy easter.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Skybox_Initialize(10.0) is not a declaration. If it is anything (which I doubt), it is a call to a static member function.
You cannot put a constant literal value in a declaration, that "10.0" should be a data type and parameter name. If you need a constant, then just use one, you don't need to pass it as a parameter at all.
Why would you have an Initialize() function when you could use a constructor to automatically perform initialisation every time an object is created.
Perhaps with this "10.0" what you actually wanted was an initialiser list for a constructor.
If all the above means nothing, then that was exactly my point; as has been said before, you are trying to run before you can walk. It has been suggested (several times) that you first learn the basics of C++ and object oriented programming. So long as you persist with this over complex example that you yourself do not understand, you will continue to annoy rather than incite assistance.
Basically no one wishes to help you start from the wrong place because you'll never reach your destination.
Asking over complex (and obviously confused) questions on a forum is a painfully slow and unreliable way to learn C++. The same is true of merely copying and adapting other peoples' code of which you have no real understanding. For example, this code is obviously not targeted at GCC; the #pragma directive only has meaning in Microsoft's compiler and will be ignored.
I also suggest that you have over analyzed your problem, but your analysis is flawed, hence the question makes no sense - as you say it is all 'babbling'. I have no idea what the question is or what you are trying to do. I have no intention of trawling through all that code to try to figure it out, and you are not yet equipped to understand what your problem is in the first place.
My point is that if you had started at the beginning instead of wading in at the deep end, you would have resolved all your confusions over this before the code got too complex for you to understand or for us to bother figuring out for you.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i know somewhere i need to set Skybox_Initialize(10.0) into the header file.
the function is under the class CGfxOpenGL::Init() which is shown on the header file.
I made a new class called class Skybox; but im sure thats not enough.
i tried having Skybox_Initialize(10.) under the public CGfxOpenGL(); destructor. of course below the virtural. i guess thats not enough for the compiler to regcognize it as a declaration.
theres is also a CSkybox Header file which im really not to concerned about.
My primary focus is just on the CGfxOpenGL file and its header.
Enough babbaling heres the code:
Header:
ifndef __GL_COMPONENT
define __GL_COMPONENT
const int TERRAIN_SIZE = 260;
define PI 3.14159f
define DEG2RAD(x) (x*PI)/180.0f
class Skybox;
class CGfxOpenGL
{
private:
GLubyte heightmap[TERRAIN_SIZE * TERRAIN_SIZE];
int m_windowWidth;
int m_windowHeight;
public:
CGfxOpenGL();
virtual ~CGfxOpenGL();
};
endif
CGfxOPenGL file:
ifdef _WINDOWS
include <windows.h>
endif
include <gl/gl.h>
include <gl/glu.h>
include <math.h>
include <time.h>
include "glext.h"
include "CGfxOpenGL.h"
include <cmath>
include <cstdio>
include "CTargaImage.h"
include <Skybox.h>
pragma warning(disable:4244)
const char heightmapFilename[] = "heightmap.raw";
const float MAX_HEIGHT = 30.0f;
const float MAX_FOG_HEIGHT = MAX_HEIGHT * 0.5f;
const float SCALE_FACTOR = 256.0f / MAX_HEIGHT;
const float WATER_HEIGHT = 2.0f;
CGfxOpenGL::CGfxOpenGL()
{
m_grassTexture = m_waterTexture = 0;
cameraX = cameraY = cameraZ = 0.0f;
m_angle = 0.0;
m_height = 10.0;
}
CGfxOpenGL::~CGfxOpenGL()
{
}
bool CGfxOpenGL::Init()
{
FILE *pFile = fopen(heightmapFilename, "rb");
if(!pFile)
return false;
}
bool CGfxOpenGL::Shutdown()
{
glDeleteTextures(1, &m_waterTexture);
glDeleteTextures(1, &m_grassTexture);
int Skybox_Release();
Skybox_Release();
}
void CGfxOpenGL::SetupProjection(int width, int height)
{
if (height == 0) // don't want a divide by zero
{
height = 1;
}
}
void CGfxOpenGL::Prepare(float dt)
{
cameraX = sin(DEG2RAD(m_angle))TERRAIN_SIZE/2.0f;
cameraY = m_height;
cameraZ = cos(DEG2RAD(m_angle))TERRAIN_SIZE/2.0f;
}
void CGfxOpenGL::DrawTerrain()
{
// draw terrain!
}
}
void CGfxOpenGL::Render()
{
glClearColor(0.0f, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Skybox_Render(cameraX, cameraY, cameraZ);
};
No. I am really not going to bother this time. It is a waste of time. You seem determined to learn nothing and to ignore all advice previously given.
If you cannot imagine why doing initialisation in a destructor makes no sense you are completely lost! Nothing you have written in either English or code makes much sense. Further if you have not yet figured out the difference between a function declaration and a function call as seems to be the case you are truly up-the-creek.
Could u please help? i would really like to see this. I would like to apologize for my ignorance and i wish to obtain my help via this website.
ok what im having trouble with is undeclared declarations, i.e. Skybox_Initialize(10.0)
My first step is to see what class its under which happens to be 'bool CGfxOpenGL::Init()
now(which is probably a mistake) i go to the CGfxOPenGL header file and notice that there already is a class named CGfxOpenGL. IF im correct the skybox_Intialize should be under the CGfxOpenGL class.
now since my declaration of bool Skybox_Initalize(10.0) is under CGfxOpenGL::Init() i would place my Skybox_Initialize(10.0) under private.
but unfortunatly it does not recognize it and reads undeclared.
what im wondering is do i have to make an entirely new class for Skybox that im using? for instance:
Skybox::Skybox
{
}
Skybox::~Skybox
{
}
Skybox::Initialize(10.0)
// but what goes here?
}
could u please help? im sorry for not understanding. i will be more educated in the future i can promise that. i hope u are all doing well and happy easter.
Skybox_Initialize(10.0) is not a declaration. If it is anything (which I doubt), it is a call to a static member function.
You cannot put a constant literal value in a declaration, that "10.0" should be a data type and parameter name. If you need a constant, then just use one, you don't need to pass it as a parameter at all.
Why would you have an Initialize() function when you could use a constructor to automatically perform initialisation every time an object is created.
Perhaps with this "10.0" what you actually wanted was an initialiser list for a constructor.
If all the above means nothing, then that was exactly my point; as has been said before, you are trying to run before you can walk. It has been suggested (several times) that you first learn the basics of C++ and object oriented programming. So long as you persist with this over complex example that you yourself do not understand, you will continue to annoy rather than incite assistance.
Basically no one wishes to help you start from the wrong place because you'll never reach your destination.
Can I suggest that you this:
http://www.cplusplus.com/doc/tutorial/
and perhaps for greater depth, this: http://mindview.net/Books/TICPP/ThinkingInCPP2e.html
Asking over complex (and obviously confused) questions on a forum is a painfully slow and unreliable way to learn C++. The same is true of merely copying and adapting other peoples' code of which you have no real understanding. For example, this code is obviously not targeted at GCC; the #pragma directive only has meaning in Microsoft's compiler and will be ignored.
I also suggest that you have over analyzed your problem, but your analysis is flawed, hence the question makes no sense - as you say it is all 'babbling'. I have no idea what the question is or what you are trying to do. I have no intention of trawling through all that code to try to figure it out, and you are not yet equipped to understand what your problem is in the first place.
My point is that if you had started at the beginning instead of wading in at the deep end, you would have resolved all your confusions over this before the code got too complex for you to understand or for us to bother figuring out for you.
Clifford