Results 1 to 8 of 8

Thread: GLUT or general OpenGL program?

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2010
    Posts
    9

    GLUT or general OpenGL program?

    I'm trying to decide between using the GLUT IDE or creating a general OpenGL program, and I can't figure out which would be better for the project I am supposed to do.

    Quite simply, I am supposed to make a model of the solar system (in 3d of course), and it looks as though a general OpenGL program would be easier to do algorithmically - however - it also appears that the GLUT has built in functions for drawing spheres and doing background processing.

    What would be my best bet?
    Would really appreciate a hasty response; no time to waste.

    Thanks in advance to all who answer,
    ~Bitwize

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,654

    Re: GLUT or general OpenGL program?

    I would start with GLUT just to get going, and if you ever need something that is incompatible with GLUT, then at that time you can convert. You may not. And it's not like you'll have to rewrite your application. You just pop in a different init (a more complex one) and register your callbacks differently.

    Nice thing about using GLUT is that it is cross-platform by default.

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2010
    Posts
    9

    Re: GLUT or general OpenGL program?

    I'm currently getting an incredibly annoying issue with a GLUT enabled program, claiming:
    The procedure entry point _glutCreateWindowWithExit could not be located in the dynamic link library glut32.dll

    I linked in the appropriate libraries to use GLUT, and so I can't entirely understand why it's giving me an issue.
    I don't suppose you may know how to solve that issue? I could post the code I'm using if I have to

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Karachi, Pakistan
    Posts
    810

    Re: GLUT or general OpenGL program?

    Are u using freeglut or glut?
    Regards,
    Mobeen

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2010
    Posts
    9

    Re: GLUT or general OpenGL program?

    Quote Originally Posted by mobeen
    Are u using freeglut or glut?
    Using GLUT, but I found the error. Somehow the glut32.dll file that I had was from 1998 (I have no idea how that even happened (._.') )

    General question, if anyone is still reading this thread; I have the coordinates being calculated for it's x, y, z positions - and I was wondering how I would place spheres in this considering it's in polar coordinates?

    And better yet, what the function is. Do I use a move function, or just redraw the screen? I'm reading the documentation as best I can, but there is so much that it's hard to pinpoint precisely where I should look.

    EDIT:
    I just wanted to add that I'm using the glutSolidSphere function for creating spheres, and it only has parameters for it's radius, slices, and stacks.
    I found a small piece of code online that does virtually that same thing for drawing spheres
    Code :
    void drawSphere(double r, int lats, int longs) 
    {
    	int i, j;
    	for(i = 0; i <= lats; i++) 
    	{
    		double lat0 = PI * (-0.5 + (double) (i - 1) / lats);
    		double z0  = sin(lat0);
    		double zr0 =  cos(lat0);
     
    		double lat1 = PI * (-0.5 + (double) i / lats);
    		double z1 = sin(lat1);
    		double zr1 = cos(lat1);
     
    		glBegin(GL_QUAD_STRIP);
    		for(j = 0; j <= longs; j++) 
    		{
    			double lng = 2 * PI * (double) (j - 1) / longs;
    			double x = cos(lng);
    			double y = sin(lng);
     
    			glNormal3f(x * zr0, y * zr0, z0);
    			glVertex3f(x * zr0, y * zr0, z0);
    			glNormal3f(x * zr1, y * zr1, z1);
    			glVertex3f(x * zr1, y * zr1, z1);
    		}
    		glEnd();
    	}
    }
    but even that I don't entirely see how I could modify it to take x,y,z coordinates (I lack any knowledge of how to use polar)

  6. #6
    Senior Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Karachi, Pakistan
    Posts
    810

    Re: GLUT or general OpenGL program?

    All of the object drawing functions (like glutSolidSphere etc.) draw the object at origin. To place the object u need to apply the transformation matrix to the current modelview matrix.
    Regards,
    Mobeen

  7. #7
    Junior Member Newbie
    Join Date
    Dec 2010
    Posts
    9

    Re: GLUT or general OpenGL program?

    Sweet, I think I got everything now.
    Unless I have a misunderstanding of how they work, this:
    Code :
    glPushMatrix();
    glTranslatef(x, y, z);
    glutSolidSphere(radius, slices,stacks);
    glPopMatrix();
    seems to do exactly what I'm looking for.

    Of course, I have tested with a few objects and it seems to do exactly that, so I am hoping it is correct.

  8. #8
    Senior Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Karachi, Pakistan
    Posts
    810

    Re: GLUT or general OpenGL program?

    yep, a pre opengl 3.0 version. In 3.0 and above the fixd function pipeline (initially deprecated in v3.0)and now has been removed completely 3.3 and abovein the core profile though they are available in the compatability profile). You should opt for shaders now and use them instead of the old fashion way.

    Regards,
    Mobeen
    Regards,
    Mobeen

Similar Threads

  1. General structure of a Vulkan program?
    By xTimPugz in forum Vulkan
    Replies: 3
    Last Post: 06-23-2017, 02:31 AM
  2. Help with A simple OpenGL and glut program
    By babar in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-21-2009, 01:21 PM
  3. glut multiple windows general
    By true_atlantis in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-04-2005, 04:19 PM
  4. General fragment shader/program queries
    By charliejay in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-18-2004, 02:49 AM
  5. Anyway to program OpenGL/GLUT NOT in VC++
    By in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 08-16-2001, 02:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean