View Full Version : basic opengl beginner

04-12-2011, 10:58 PM
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() {

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

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

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);




04-13-2011, 02:32 AM
how you can What?... buddy

04-13-2011, 09:30 PM
i cant get it because m new in this tech...so,plz help me...

Alfonse Reinheart
04-13-2011, 10:13 PM
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.

04-14-2011, 09:37 AM
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?

04-15-2011, 11:21 PM
ok i get it i am having any query than plzzzzzzzzz give support

04-16-2011, 10:30 AM
Obviously you did not 'get it'.
Re-read MaxH post, do not come back until you provide 1+2+3.

04-17-2011, 12:53 AM
LoL , I know this guy from Unity3D forum.Seems he has got a strong problem to express himself :)

04-18-2011, 09:32 PM
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];
for(int i=0;i<24;++i)


Thanx in Advance

wat is problem inn this can any one can tell me

04-19-2011, 02:21 AM
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: What do you expect the code to do? What is the code doing?

04-19-2011, 10:31 PM
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];
for(int i=0;i<10;++i)


Thanx in Advance

04-19-2011, 11:45 PM
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.

04-21-2011, 10:07 PM
in above code error is coming that
x and y is not found

Thanx in Advance

04-21-2011, 10:29 PM
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


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

04-22-2011, 09:09 PM
ok CoolBeanJ u r doing in java

04-27-2011, 09:16 PM
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

04-27-2011, 10:27 PM
That sort of shape is called a lemniscate (http://en.wikipedia.org/wiki/Lemniscate). If you follow that link you will find equations for several varieties. I like this one (http://en.wikipedia.org/wiki/Lemniscate_of_Bernoulli). 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.

04-28-2011, 09:17 PM
ya Kelvin,
i have done that for drawing a simple triangle but i want to draw a wave shape for showing in flow motion