basic opengl beginner

As I am using Visual Studio as IDE I am compile this code in OpenGL
Now how I can

//Draws the 3D scene
void drawScene() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(-_cameraAngle, 0.0f, 1.0f, 0.0f);
glTranslatef(0.0f, 1.0f,-5.0f);

glPushMatrix();
glTranslatef(0.0f, -1.0f, 0.0f);
glRotatef(_angle, 0.0f, 0.0f, -5.0f);

glBegin(GL_QUADS);
glColor3f(0.0f, .7f, 0.0f);

glVertex3f(0.10f, 0.20f, 0.0f);

glVertex3f(0.20f, 0.10f, 0.0f);

glVertex3f(0.20f, -0.10f, 0.0f);

glVertex3f(0.10f, -0.20f, 0.0f);

glVertex3f(-0.10f, -0.20f, 0.0f);

glVertex3f(-0.20f, -0.10f, 0.0f);

glVertex3f(-0.20f, 0.10f, 0.0f);

glVertex3f(-0.10f, 0.20f, 0.0f);

glEnd();

glPopMatrix();

glutSwapBuffers();

}

how you can What?.. buddy

i cant get it because m new in this tech…so,plz help me…

He’s asking what your problem is, because you didn’t say. We can’t help you unless you tell us what the problem is.

Help us to help you:

  1. When you post code, enclose it in {code} and {/code} tags (except use [] instead of {}). That will preserve your indentations making it easier for us to understand.

  2. Enclose the entire the program, not just the routine where you think the problem is occurring.

  3. Tell us what happens when you try to run your code. Does it compile? Does a graphics window open? What do you see in the window?

ok i get it i am having any query than plzzzzzzzzz give support

Obviously you did not ‘get it’.
Re-read MaxH post, do not come back until you provide 1+2+3.

LoL , I know this guy from Unity3D forum.Seems he has got a strong problem to express himself :slight_smile:

ok this is my small basic program in opengl

i am tryig to make a wave shape in opengl

can any one me what is problem in below so, that can move to next step

int n[25];
glBegin(GL_LINES);
{
for(int i=0;i<24;++i)
{
glVertex2f((x(n[i]),y(n[i]));

}
glEnd();

Thanx in Advance

wat is problem inn this can any one can tell me

There’s no problem in that code.
Or there could be many problems in it.
It’s impossible to say.

What we need to know is:[ul][]What do you expect the code to do?[]What is the code doing?[/ul]

i am tryig to make a wave shape in opengl

can any one me what is problem in below so, that can move to next step

int n[25];
glBegin(GL_LINES);
{
for(int i=0;i<10;++i)
{
glVertex2f((x(n[i]),y(n[i]));

}
glEnd();

Thanx in Advance

The information u r giving to us is incomplete. What do the functions x() and y() return? Why are u using an uninitialized array (n)? The above code is fine (sematically) apart from the redundant { after glBegin but whether it works or not depends on what u r doing in the x,y functions.

in above code error is coming that
x and y is not found

Thanx in Advance

I could be way off but if your using visual studio as the ide you will need to have some sort of OpenGL lib.

I use Tao. Why I say this is becuase you are using commands like

glBegin(GL_LINES);

and i’d expect to have seen Gl.glBegin(Gl.GL_LINES);

ok CoolBeanJ u r doing in java

by the above code i m trying to draw a wave shape line

that is horizontal “8”
i dnt have any of idea specifying x and y values

That sort of shape is called a lemniscate. If you follow that link you will find equations for several varieties. I like this one. You want the parametric equations, where you supply a sliding “t” parameter.

More commonly, you would pre-compute all the values and store them in a table, instead of doing lots of sines/cosines at run time. If none of the mathematical shapes look like what you want, then make your own table by drawing your shape on a piece of graph paper, and counting squares to find the x and y coordinates that you need.

ya Kelvin,
i have done that for drawing a simple triangle but i want to draw a wave shape for showing in flow motion