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 7053357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:29:43+00:00 2026-05-28T03:29:43+00:00

My project is consisted of two initializations, one init is for the user interface

  • 0

My project is consisted of two initializations, one init is for the user interface ( menu and the buttons ) and the other one is for the displaying pictures( bitmap pics ), all written using openGL. Now, where is the glitch, when I build it, complier doesn’t report any errors, but my app lacks picture, i.e. it doesn’t show it, however my user interface openGl objects shows.

First of all, as you can see, I have added texture coordinates to the vertices of the polygons that I wanted to apply a texture to, then initialization of the texture is applied also, plus it’s integration so I can’t see where it stuck. Where does the problem lie? And, is it possible for compiler to handle integration of the objects in this form, i.e. is it possible to buffer two initializations using different integrations?

/*
 * Method InitUI() used for initialization of the user interface
 *
 */
 void InitUI()
 {
myInterfaceSetDefaultStyle ( MYINTERFACESTYLE_SMALL_SHADED ) ;
myInterfaceSetDefaultColourScheme( 0.5f, 0.7f, 0.9f );

MenuFunctionA();
    ButtonFUnctionA();
 }


 /*
  * Method onDraw is used for integration of the cotures of the object itself
  *
  */

  void OnDraw() {

glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);

glLoadIdentity();

// binds the texture to any geometry about to be rendered
glBindTexture(GL_TEXTURE_2D,g_Texture);

// whenever you apply a texture to an object, you will need
// to specify texture co-ordinates which define the placement
// of the texture on the polygons. Changing the value of the
// tex coords changes the placement of the texture...
//
glBegin(GL_QUADS);
    glTexCoord2f(0,0);
    glVertex2f(-15,15);

    glTexCoord2f(0,1);
    glVertex2f(-15,-15);

    glTexCoord2f(1,1);
    glVertex2f(15,-15);

    glTexCoord2f(1,0);
    glVertex2f(15,15);
glEnd();

glutSwapBuffers();
 }

 /*
  * Method Display() used for making up of the user interface.
  *
  */
  void Display()
  {

    glClear(GL_COLOR_BUFFER_BIT);

/* display the user interface */

    myInterfaceDisplay();


    glutSwapBuffers();
  }

  /*
   * Method OnInit() used for initialization of the texture bitmap
   */

   void OnInit() {

// enable the depth test and 2D texturing
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);

// load texture as compressed
g_Texture = LoadTexture("texture.bmp");

// outputs the size of the texture
    // I used this method just to test if this function is integrated at all, and suprisingly it is, however no picture is displayed, even though I specifically stated it in this function 
std::cout << "Texture Size=" << (GetTextureSize(g_Texture)/1024.0f) << "Kb"<<                std::endl;
  }


/* 
* Method Init() used for custom OpenGL initialization ( background of the application )
*/
   void Init()
{
glClearColor(0.5f,0.5f,0.5f,0.5f);
}

/* 
 * Method main used for integration and initialization of all the components involved  in building the application
*/ 
int main(int argc,char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE);
glutInitWindowSize(640,480);
glutInitWindowPosition(300,100);
glutCreateWindow(" OpenGL Double buffering ");

glutDisplayFunc(Display);
glutDisplayFunc(onDraw);
glutMouseFunc(MouseButton);
glutMotionFunc(MouseMove);
glutKeyboardFunc(KeyBoard);
glutSpecialFunc(SpecialKeyBoard);

myInterfaceInit();
Init();
InitUI();
    onInit();

glutMainLoop();

}
  • 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-28T03:29:44+00:00Added an answer on May 28, 2026 at 3:29 am

    Double buffer is used to display one “image” before the second one is rendering. Then swap them and render the first one.

    I’d do it in one callback for glut (glutDisplay doesn’t support multiple callbacks), such as:

    void Display() {
        glLoadIdentity();
        DrawOne();
        DrawOther();
        glutSwapBuffers();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My team literally consists of just myself and one or two other people. I
I have a project that's consisted of two branches: STABLE and DEVELOPMENT. As the
I have a C# project with two namespaces in one solution. I've documented all
I have a university project which is already 99% completed. It consists of two
My solution consists of two projects: a class library project (named as DataAccess )
I'm working on a project where there are two sets of XML schema-generated objects
In my project I use two libraries, v8 and boost . Boost uses the
I had solution which consisted of two projects - ProjectName and ProjectName v2.0 At
I have a Java Project , for which I'm now creating a Web interface,
I have two projects in one solution : Class Library for my BLL and

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.