473,383 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Help @ C++

Hi, i just started learning how to code OpenGL with the syntax of C++.
But i got the following problem(YES IT IS C++ BUT ITS A OPENGL
PROGRAM):

------------------ Quote From A Site ------------------
First of all you need a bool, let's call it bBallDrawn. In
glPushMatrix set it to true and if it is true in glPopMatrix, we'll
draw the Ball and set it back to false.
Here's the code:

glPushMatrix();
glDisable(GL_TEXTURE_2D); // Ballhack has no textures
glDisable(GL_DEPTH_TEST); // Makes the Balls visible through walls
GLUquadricObj *ball;
if(bT)
glColor3f(1.0f,0.0f,0.0f); // Set Ballhack Color
else if(bCt)
glColor3f(0.0f,0.0f,1.0f); // Set Ballhack Color
glTranslatef(x,y,z); // insert coordinates here
ball=gluNewQuadric();
gluQuadricNormals(ball, GLU_SMOOTH);
gluSphere(ball,5.0f,32,32);
gluDeleteQuadric(ball);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glPopMatrix();
------------------ End Of Quote From A Site ------------------

Ok, i make a bool

bool <bBallDrawn>

But now, how do i set it to true & false ???
Jul 22 '05 #1
6 1654
* TuPLaD:

Ok, i make a bool

bool <bBallDrawn>
Makte that

bool ballIsDrawn;

But now, how do i set it to true & false ???


ballIsDrawn = true;
ballIsDrawn = false;

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #2

"TuPLaD" <sp*****@pandora.be> wrote in message
news:a2**************************@posting.google.c om...
Hi, i just started learning how to code OpenGL with the syntax of C++.
But i got the following problem(YES IT IS C++ BUT ITS A OPENGL
PROGRAM):

------------------ Quote From A Site ------------------
First of all you need a bool, let's call it bBallDrawn. In
glPushMatrix set it to true and if it is true in glPopMatrix, we'll
draw the Ball and set it back to false.
Here's the code:

glPushMatrix();
glDisable(GL_TEXTURE_2D); // Ballhack has no textures
glDisable(GL_DEPTH_TEST); // Makes the Balls visible through walls
GLUquadricObj *ball;
if(bT)
glColor3f(1.0f,0.0f,0.0f); // Set Ballhack Color
else if(bCt)
glColor3f(0.0f,0.0f,1.0f); // Set Ballhack Color
glTranslatef(x,y,z); // insert coordinates here
ball=gluNewQuadric();
gluQuadricNormals(ball, GLU_SMOOTH);
gluSphere(ball,5.0f,32,32);
gluDeleteQuadric(ball);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glPopMatrix();
------------------ End Of Quote From A Site ------------------

Ok, i make a bool

bool <bBallDrawn>

That's not legal C++. Perhaps you meant this

bool bBallDrawn;
But now, how do i set it to true & false ???


bBallDrawn = true;
bBallDrawn = false;

john
Jul 22 '05 #3
TuPLaD wrote:
Hi, i just started learning how to code OpenGL with the syntax of C++.
But i got the following problem(YES IT IS C++ BUT ITS A OPENGL
PROGRAM):

------------------ Quote From A Site ------------------
First of all you need a bool, let's call it bBallDrawn. In
glPushMatrix set it to true and if it is true in glPopMatrix, we'll
draw the Ball and set it back to false.
Here's the code:

glPushMatrix();
glDisable(GL_TEXTURE_2D); // Ballhack has no textures
glDisable(GL_DEPTH_TEST); // Makes the Balls visible through walls
GLUquadricObj *ball;
if(bT)
glColor3f(1.0f,0.0f,0.0f); // Set Ballhack Color
else if(bCt)
glColor3f(0.0f,0.0f,1.0f); // Set Ballhack Color
glTranslatef(x,y,z); // insert coordinates here
ball=gluNewQuadric();
gluQuadricNormals(ball, GLU_SMOOTH);
gluSphere(ball,5.0f,32,32);
gluDeleteQuadric(ball);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glPopMatrix();
------------------ End Of Quote From A Site ------------------

Ok, i make a bool

bool <bBallDrawn>
No, that syntax is nonsense. It should be:

bool bBallDrawn;
But now, how do i set it to true & false ???

Uhm...

bBallDrawn = true;

and

bBallDrawn = false;
Which C++ book are you using?

Jul 22 '05 #4
"TuPLaD" <sp*****@pandora.be> wrote in message
news:a2**************************@posting.google.c om...
Hi, i just started learning how to code OpenGL with the syntax of C++.
But i got the following problem(YES IT IS C++ BUT ITS A OPENGL
PROGRAM):

------------------ Quote From A Site ------------------
First of all you need a bool, let's call it bBallDrawn. In
glPushMatrix set it to true and if it is true in glPopMatrix, we'll
draw the Ball and set it back to false.
Here's the code:

glPushMatrix();
glDisable(GL_TEXTURE_2D); // Ballhack has no textures
glDisable(GL_DEPTH_TEST); // Makes the Balls visible through walls
GLUquadricObj *ball;
if(bT)
glColor3f(1.0f,0.0f,0.0f); // Set Ballhack Color
else if(bCt)
glColor3f(0.0f,0.0f,1.0f); // Set Ballhack Color
glTranslatef(x,y,z); // insert coordinates here
ball=gluNewQuadric();
gluQuadricNormals(ball, GLU_SMOOTH);
gluSphere(ball,5.0f,32,32);
gluDeleteQuadric(ball);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glPopMatrix();
------------------ End Of Quote From A Site ------------------

Ok, i make a bool

bool <bBallDrawn>
This should be

bool bBallDrawn;
But now, how do i set it to true & false ???


In declaration:
bool bBallDrawn = true;
bool bBallDrawn = false;

After declaration:
bBallDrawn = true;
bBallDrawn = false;

You can also use 0 for false and 1 for true, but the above is more clear.

Please don't take this the wrong way, but are you sure you want to work with
OpenGL when you don't know how to declare and initialize variables? If
you're trying to learn from a website, I'd suggest going out and getting one
of the following books instead:

At Amazon.com -
Accelerated C++ (if you already know a language)
C++ Primer Plus: Fourth Edition (supposed to be very good)
You Can Do It! (recommended by some others here)

At Barnes & Noble -
C++ Programming in Easy Steps (I used this one)

Hope you find this useful. Good luck with your programming!
Jul 22 '05 #5
Im not using any C++ book, im just trying to make a OpenGL32.DLL :-)
But a bit edited & stuff.

Well now a few other questions :D
---------------------------------------

I got the following in my OpenGL32 -->
================================================== ===============
// The Begin:
bool bSky;
< after that alot of code >
void sys_glBegin (GLenum mode)
{
//START OF BLACKSKY
if(mode == GL_QUADS)
{
bool bSky = true;
}
else
{
bool bSky = false;
}
//END OF BLACKSKY
(*orig_glBegin) (mode);
}
================================================== ===============

Well, the problem is, it wont turn on the Black Sky in game :\
This is where i got that from:

---------- Quote From A Site ----------
This feature removes the sky, and makes the entire sky black. This
feature requires glBegin, and glVertex3fv.
First, you must make a boolean, let's call it 'bSky'. Now, in glBegin,
you must check for GL_QUADS as the mode. Then you set bSky to be TRUE.
Else, set bSky to be FALSE.

Now, in glVertex3fv, check if bSky is TRUE, then return the caller
without calling the origonal function.
---------- End Of Quote From A Site ----------

What did i do wrong (look @ begin of blacksky) ?
I think everything is right isnt it ?
Should i make bool bSky = true; at the start of the code ??

---------- Next Question ----------
How do i print something on the screen ? If anybody knows ? Becourse
the tutorial of printing of text is too complicated :(
---------- End Of Next Question ----------
Jul 22 '05 #6
* TuPLaD:
Im not using any C++ book, im just trying to make a OpenGL32.DLL :-)
You need a C++ book.

Try "You can do it" and after that "Accelerated C++".

// The Begin:
bool bSky;
< after that alot of code >
void sys_glBegin (GLenum mode)
{
//START OF BLACKSKY
if(mode == GL_QUADS)
{
bool bSky = true;
}
else
{
bool bSky = false;
}
//END OF BLACKSKY
(*orig_glBegin) (mode);
}
================================================== ===============

Well, the problem is, it wont turn on the Black Sky in game :\


No wonder to anyonw who knows just the barest beginnings of C++... You
need a book. Try "You can do it" and after that "Accelerated C++".

Technically, if you just remove the last two 'bool' words it should work.

But to understand that you need a book. Try "You can do it" and after
that "Accelerated C++". And perhaps after that, "The C++ Programming
Language".

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
9
by: Tom | last post by:
A question for gui application programmers. . . I 've got some GUI programs, written in Python/wxPython, and I've got a help button and a help menu item. Also, I've got a compiled file made with...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
7
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available...
5
by: Steve | last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp My expectation is that a developer using my DLL would be able to access this help file during his development time...
8
by: Mark | last post by:
I have loaded Visual Studio .net on my home computer and my laptop, but my home computer has an abbreviated help screen not 2% of the help on my laptop. All the settings look the same on both...
10
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
1
by: trunxnirvana007 | last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' 'UPGRADE_WARNING: Couldn't resolve...
0
by: hitencontractor | last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003. I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About. The application...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.