Home » Community » Forums » » Basics of GLUT
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 Basics of GLUT
Post Reply 
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


 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I knew glut but i read the articles and they are very good, newbies will like it and learn the basics!

 User Rating: 1090   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

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...


 User Rating: 1015    Report this Post to a Moderator | Link

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]

 User Rating: 1932   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

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

 User Rating: 1682   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

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



 User Rating: 1015    Report this Post to a Moderator | Link

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



 User Rating: 1015    Report this Post to a Moderator | Link

You need to download and install glut.

http://www.xmission.com/~nate/glut.html

 User Rating: 1517   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Quote:
Original post by Boder
You need to download and install glut.

http://www.xmission.com/~nate/glut.html


It is better to pick one of the GLUT implementations that are actually actively maintained, like FreeGLUT


 User Rating: 2027   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

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.

 User Rating: 1517   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

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]

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Quote:
Original post by Fruny
Quote:
Original post by Boder
You need to download and install glut.

http://www.xmission.com/~nate/glut.html


It is better to pick one of the GLUT implementations that are actually actively maintained, like FreeGLUT


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.

 User Rating: 1355   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

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

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: