Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4001736
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:56:29+00:00 2026-05-20T07:56:29+00:00

I am really really new to opengl, and I am learning basics now. I

  • 0

I am really really new to opengl, and I am learning basics now. I have a high level question.
If I want to create an object, say a column which are all the options?

  1. Import a 3D mesh from any external program (like 3DStudio) and have it loaded in opengl
  2. Create 6 polygons using glVertex3f
  3. A glut call? (I have seen glutSolidCube but nothing like glutSolidColumn)

My questions are:

A) Is there any other way of doing it?

B) Which is the correct way of creating normal objects/ animated objects in opengl if you do NOT use a 3DStudio mesh?

C) Is this code correct to create a column in 2)? (In case it is, I will try to parametrize it using x,y,z variables to have a column for a given floor tile with a given height)

//Column
//Wall
glBegin(GL_POLYGON); 
    glVertex3f(150.0f, 250.0f,50);   // x1, y1 - top-left corner    
    glVertex3f(50.0f, 250.0f,50);   // x2, y1 - top-right corner
    glVertex3f(50.0f, 50.0f,50);        // x2, y2 - bottom-right corner
    glVertex3f(150.0f, 50.0f,50);    // x1, y2 - bottom-left corner

glEnd( );

//Wall
glBegin(GL_POLYGON); 
    glVertex3f(50.0f,  250.0f,0);   // x1, y1 - top-left corner 
    glVertex3f(150.0f, 250.0f,0);  // x2, y1 - top-right corner
    glVertex3f(150.0f, 50.0f,0);   // x2, y2 - bottom-right corner
    glVertex3f(50.0f,  50.0f,0);    // x1, y2 - bottom-left corner
glEnd( );

//Wall
glBegin(GL_POLYGON);
    glVertex3f(150.0f, 250.0f,0);       // x1, y1 - top-left corner 
    glVertex3f(150.0f, 250.0f,50.0f);   // x2, y1 - top-right corner
    glVertex3f(150.0f, 50.0f,50.0f);        // x2, y2 - bottom-right corner
    glVertex3f(150.0f, 50.0f,0);    // x1, y2 - bottom-left corner
glEnd( );

//Wall
glBegin(GL_POLYGON);
    glVertex3f(50.0f, 250.0f,50);       // x1, y1 - top-left corner 
    glVertex3f(50.0f, 250.0f,0);    // x2, y1 - top-right corner
    glVertex3f(50.0f, 50.0f,0);     // x2, y2 - bottom-right corner
    glVertex3f(50.0f, 50.0f,50);    // x1, y2 - bottom-left corner
glEnd( );

//Floor
glBegin(GL_POLYGON);
    glVertex3f(50.0f, 50.0f, 0);        // x1, y1 - top-left corner 
    glVertex3f(50.0f, 50.0f, 50);   // x2, y1 - top-right corner
    glVertex3f(0, 50.0f, 50);       // x2, y2 - bottom-right corner
    glVertex3f(0, 50.0f, 0);    // x1, y2 - bottom-left corner
glEnd( );

//Ceiling
glBegin(GL_POLYGON);
    glVertex3f(50.0f, 250.0f, 0);       // x1, y1 - top-left corner 
    glVertex3f(50.0f, 250.0f, 50);  // x2, y1 - top-right corner
    glVertex3f(0, 250.0f, 50);      // x2, y2 - bottom-right corner
    glVertex3f(0, 250.0f, 0);    // x1, y2 - bottom-left corner
glEnd( );
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:56:29+00:00Added an answer on May 20, 2026 at 7:56 am

    It depends on your definition of correct. To answer one by one:

    1. this would be the most normal way; however OpenGL is a rendering library only and it’s up to you to provide code to load the file formats you are interested in;
    2. glVertex3f is a poor choice; see exposition below;
    3. GLUT is not part of OpenGL, but yes — there are a variety of third party libraries that can draw primitive objects for you. GLUT is one.

    Re: glVertex3f and glBegin/glEnd calls. They’re fine, at present, when you’re learning, as a simple means to let you investigate other parts of the rendering pipeline. However, they’re deprecated and suboptimal so aren’t something you’d want to become permanently bound to. Because of this, they aren’t replicated in OpenGL ES or WebGL.

    There is a cost associated with any communication between the CPU and GPU. The more data you transfer in the communication, the greater the cost. However, even small calls cost quite a lot due to the temporary synchronisation required between the two asynchronous and parallel devices.

    glBegin/glVertex3f/glEnd are therefore bad because all data sits on the CPU and is transferred to the driver piecemeal, through lots of calls. As a first step, you probably want to switch to using glVertexPointer (to supply all vertex data in one step) and either glDrawArrays or glDrawElements (to perform the equivalent of all glBegin/glEnd calls in one step). From there you can move to storing the data on the GPU rather than the CPU via vertex array objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm really new to OpenGL but have quite a good grasp of basic trigonometry
im really new to linq-to-SQL so this may sound like a really dumb question,
I am really new to java (started learning 2 days ago). Sorry if this
I am really new to the programming but I am studying it. I have
I am really new with PHP and all I have to do is to
I'm new to OpenGL. I'm playing around with JOGL. I have a .obj model
I've been working with OpenGL for about a year now, and have learned a
I want to know the simplest method for using vbo's in OpenGL... I have
Total noob here learning openGL and I don't have any code to post because
I am new to OpenGL and Qt, and I am learning both simultaneously(3 days

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.