Facebook
From Fabio Ramos, 2 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 119
  1. #include <GL\glut.h>
  2.  
  3. void desenho(){
  4.         glClear(GL_COLOR_BUFFER_BIT);
  5.        
  6.         glMatrixMode(GL_MODELVIEW);
  7.         glLoadIdentity();
  8.        
  9.         glLineWidth(0.5f);
  10.        
  11.         glColor3ub(0,255,0);
  12.        
  13.         //glutWireCube(50);
  14.         //glRotatef(-90,1,0,0);
  15.         //glutWireCone(20, 50, 50, 3);
  16.         //glutWireSphere(50,50,50);
  17.         glutWireTeapot(50);
  18.        
  19.         glFlush();
  20. }
  21.  
  22. void tela(GLsizei largura, GLsizei altura){
  23.         glMatrixMode(GL_PROJECTION);
  24.         glLoadIdentity();
  25.        
  26.         gluPerspective(50, largura/altura, 0.4f, 500);
  27.        
  28.         gluLookAt(0,0,200,
  29.                                 0,0,0,
  30.                                 0,1,0);
  31. }
  32.  
  33. int main(){
  34.         glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
  35.         glutInitWindowPosition(100,100);
  36.         glutInitWindowSize(800,800);
  37.         glutCreateWindow("3D");
  38.        
  39.         glutDisplayFunc(desenho);
  40.         glutReshapeFunc(tela);
  41.        
  42.         glClearColor(0,0,0,0);
  43.        
  44.         glutMainLoop();
  45.         return 0;
  46. }

Replies to 3D rss

Title Name Language When
Re: 3D Gentle Eider cpp 2 Years ago.