示例#1
0
void display(SDL_Window *win,RECT menu[], TTF_Font *font, SDL_Rect v)
{
  glClearColor(1, 1, 1, 1);
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(0.0, 0.0, 0.0);
//glLineWidth(3);
  glMatrixMode(GL_MODELVIEW);
  glPushMatrix();
  glLoadIdentity();
  gluOrtho2D((GLfloat)v.x,(GLfloat)v.w,(GLfloat)v.y,(GLfloat)v.h);

  glMatrixMode(GL_PROJECTION);
  glPushMatrix();
  glLoadIdentity();
  draw_menu(menu, font);
  glPopMatrix();

  draw_fun();
  SDL_GL_SwapWindow(win);
}
示例#2
0
文件: main.cpp 项目: chuck1/c-testing
	void		draw(void(*draw_fun)()) {
		//-------------------------
		//and now you can render to GL_TEXTURE_2D
		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
		//-------------------------
		//std::cout << "prepare to render" << std::endl;

		prep_ortho();

		//-------------------------
		glDisable(GL_TEXTURE_2D);
		glDisable(GL_BLEND);
		glEnable(GL_DEPTH_TEST);
		//-------------------------
		
		draw_fun();
		//render_tri();

		//Bind 0, which means render to back buffer
		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

	}