Jump to content
  • Advertisement
Sign in to follow this  
Scribe

OpenGL OGL render loop

This topic is 4931 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, i recently made an program using opengl, it has in it a rendering loop. However, since rendering changes on a per frame basis, the speed is unbareable. How am i meant to be rendering things if i do it per frame? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Ah, sorry, i'll be more clear. I thought of that issue and so i have a loop system, that only runs when a change that could affect the gfx takes place, i.e. a key event, whilst i could make this a little more efficient, it runs far to slow for the constant updating to be effective. This is the code that i run everytime, to update a GUI image:

glEnable(GL_TEXTURE_2D);

//Load the texture
glBindTexture(GL_TEXTURE_2D, this->GUI_Bar);

glBegin(GL_QUADS);
//Top-left vertex (corner)
glTexCoord2f(0,1);
glVertex3f(0.0f, 768.0f-321.28f, 0.0f);

//Bottom-left vertex (corner)
glTexCoord2f(0,0);
glVertex3f(0.0f, 768.0f, 0.0f);

//Bottom-right vertex (corner)
glTexCoord2f(1,0);
glVertex3f(1024.0f, 768.0f, 0.0f);

//Top-right vertex (corner)
glTexCoord2f(1,1);
glVertex3f(1024.0f, 768.0f-321.28f, 0.0f);

glEnd();

//Disable texturing
glDisable(GL_TEXTURE_2D);


Any ideas on improving it?

Share this post


Link to post
Share on other sites
*Embaraced* lets just say out of control iteration and leave it at that :P

Also another quick question. I use this kind of code:

Menu_Object( Loop *Link ): Loop_Object( Link ){}

To expand the constructor of my base class by adding code from its child class. This doesnt seem to work for the destructor, any idea how to do that?

Thanks a load anyway guys.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!