Advertisement Jump to content
Sign in to follow this  
chilun

C++ OPENGL help wanted to port glbegin and end

This topic is 1904 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;

 

I have this code in openGL, which works, but I would like to eliminate the glbegin and glend to meet OpenGL ES standards.

Can anyone out there assist me on figuring out how to do this? Thanks

 

#include "painter.hpp"
#include "GL/glut.h"


void Painter::bar(int x1, int y1, int x2, int y2)
{
  glColor3f(0, 1, 0);
  glBegin(GL_QUADS);
  glVertex2f(x1, y1);
  glVertex2f(x2, y1);
  glVertex2f(x2, y2);
  glVertex2f(x1, y2);
  glEnd();
}

void Painter::circle(int x, int y, int radius)
{
  glColor3f(1, 0, 0);
  glBegin(GL_POLYGON);
  glVertex2f(x + radius, y);
  glVertex2f(x, y + radius);
  glVertex2f(x - radius, y); 
  glVertex2f(x, y - radius);
  glEnd();
}

 

Share this post


Link to post
Share on other sites
Advertisement
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!