|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| Basics of GLUT |
|
![]() zunino Member since: 6/20/2000 From: Japan |
||||
|
|
||||
| I would just like to congratulate the author for the article. Being an absolute newbie at OpenGL and GLUT, I have found it to be very helpful and easy-to-follow. I am about to start reading the third and last of them, looking forward to the next batch! Perhaps covering textures next time? Regards, -- Ney André de Mello Zunino |
||||
|
||||
![]() ju Member since: 10/4/2001 From: Nivelles, Belgium |
||||
|
|
||||
| I knew glut but i read the articles and they are very good, newbies will like it and learn the basics! |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| Yeah, this article is a very good for newbies. I remember how i did begin to programming... i thing that this article will really helps to beginners... |
||||
|
||||
![]() Rob Loach Staff Member since: 12/2/2002 From: Toronto, Canada |
||||
|
|
||||
Great article... I decided to translate it to C#, using the Tao Framework:using System; using Tao.OpenGl; using Tao.FreeGlut; // By Ben Woodhouse, translated to C# and Tao by Rob Loach. namespace SimpleExample { /// <summary> /// Summary description for Class1. /// </summary> public class SimpleExample { public static void Run() { Glut.glutMainLoop(); } private static void Render() { Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT); //clears the colour and depth buffers Gl.glPushMatrix(); //saves the current matrix on the top of the matrix stack Gl.glTranslatef(0,0,-100); //translates the current matrix 0 in x, 0 in y and -100 in z Gl.glBegin(Gl.GL_TRIANGLES); //tells OpenGL that we're going to start drawing triangles Gl.glColor3f(1,0,0); //sets the current colour to red Gl.glVertex3f(-30,-30,0); //specifies the first vertex of our triangle Gl.glColor3f(0,1,0); //sets the current colour to green Gl.glVertex3f(30,-30,0); //specifies the second vertex of our triangle Gl.glColor3f(0,0,1); //sets the current colour to blue Gl.glVertex3f(-30,30,0); //specifies the third vertex of our triangle Gl.glEnd(); //tells OpenGL that we've finished drawing Gl.glPopMatrix(); //retrieves our saved matrix from the top of the matrix stack Glut.glutSwapBuffers(); //swaps the front and back buffers } static SimpleExample() { Glut.glutInit(); Glut.glutInitDisplayMode(Glut.GLUT_RGB | Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH); //sets up the display mode Glut.glutCreateWindow("My first GLUT program"); //creates a window Glut.glutDisplayFunc(new Glut.DisplayCallback(Render)); Gl.glMatrixMode(Gl.GL_PROJECTION); //changes the current matrix to the projection matrix //sets up the projection matrix for a perspective transform Glu.gluPerspective(45, //view angle 1.0, //aspect ratio 10.0, //near clip 200.0); //far clip Gl.glMatrixMode(Gl.GL_MODELVIEW); //changes the current matrix to the modelview matrix } public static void Main() { SimpleExample e = new SimpleExample(); e.Run(); } } } Rob Loach [Website] [Projects] [Contact] |
||||
|
||||
![]() markr Member since: 3/23/2004 From: Oxford, United Kingdom |
||||
|
|
||||
Surely, if you're using glut, the following:#include <windows.h> //header file for windows #include <gl\gl.h> //header file for openGL #include <gl\glu.h> //header file for the openGL utility library #include <gl\glut.h> //header file for GLUT Should really read: // Don't need windows.h #include <GL/gl.h> //header file for openGL #include <GL/glu.h> //header file for the openGL utility library #include <GL/glut.h> //header file for GLUT For proper cross-platform compatibility and correctness (well, never use backslashes in includes)? Mark |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| Dear Now i starting to learn OpenGL, I hope with this forum can help me to solve my problem. Before i try and training openGL, May i get sample example for openGL Code. And i have buy a book OpenGL but always shown error. The Message is GL\glut.h cannot open, file cannot loaded. Can you tell me why? thanx TC.SK.MM |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| Dear Now i starting to learn OpenGL, I hope with this forum can help me to solve my problem. Before i try and training openGL, May i get sample example for openGL Code. And i have buy a book OpenGL but always shown error. The Message is GL\glut.h cannot open, file cannot loaded. Can you tell me why? I hope you can reply to my e-mail : uhn_2006@gawab.com thanx TC.SK.MM |
||||
|
||||
![]() Boder Member since: 5/14/2004 From: Santa cruz, CA, United States |
||||
|
|
||||
| You need to download and install glut. http://www.xmission.com/~nate/glut.html |
||||
|
||||
![]() Fruny Moderator Member since: 11/16/2001 From: Paris, France |
||||
|
|
||||
Quote: It is better to pick one of the GLUT implementations that are actually actively maintained, like FreeGLUT |
||||
|
||||
![]() Boder Member since: 5/14/2004 From: Santa cruz, CA, United States |
||||
|
|
||||
| I was going to mention that, but I have never used it so I didn't know if there were any differences. I just looked at the OpenGL Forum FAQ, so Freeglut should probably be added to it. |
||||
|
||||
![]() dphoenix Member since: 4/6/2007 |
||||
|
|
||||
| Hello, I was trying to run the code for this tutorial using Dev C++, as a Win32 GUI application, but I got linker errors. I went to Project Options, Parameters, and under Linker I pasted -lopengl32 -lglut32 -lglu32 hoping that including all of those would cover all my bases. I still get [linker error] undefined reference errors. For example: [Linker error] undefined reference to `__glutInitWithExit@12' I followed the instructions about downloading the glut files and pasting them into the proper directories, and I double-checked to see that the files were all where they needed to be. What else am I missing? Thanks :) ETA: Never mind, problem solved :D [Edited by - dphoenix on April 7, 2007 8:59:35 PM] |
||||
|
||||
![]() taby Member since: 2/10/2005 From: Regina, Canada |
||||
|
|
||||
Quote: This version does not implement spaceball or overlays, just like Nate Robins' version. I'm not sure what the difference is, other than the name. |
||||
|
||||
![]() Stickybit Member since: 2/18/2009 From: Budapest, Hungary |
||||
|
|
||||
| Hi all! This can be a dumb question, but i have to ask. Is there a way to compile the glut source from here: http://www.xmission.com/~nate/glut.html some way it wont be a dynamic library? So i just link in the lib and the executable wont need the glut.dll. Im planning to make little greeting apps that rotates a shape or a text, but it is not so cool if i have to send a dll with a program of some hundred kilobytes. Please help me programmer gurus :)) |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|