Solved

trying to rotate this triangle so that i can tell its 3d

Posted on 2003-10-30
4
243 Views
Last Modified: 2010-04-07
hmmm this is got me stumped. as far as i know this is right (obviously not tho) i cant seem to get the viewport or camera to shift back and the shape to rotate. Anyone care to shed any light on this problem?
0
Comment
Question by:rholding2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Author Comment

by:rholding2000
ID: 9649981
sorry forgot to post the code

#include <windows.h>                                    
#include <glut.h>
#include <gl\gl.h>                                          

GLfloat      rtri;

void renderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES);                                                
      glRotatef(rtri,0.0f,1.0f,0.0f);            
      glTranslatef(0.0f,0.0f,20.0f);
      glColor3f(1.0f,0.0f,0.0f);                              
      glVertex3f( 0.0f, 1.0f, 0.0f);
      glColor3f(0.0f,1.0f,0.0f);                              
      glVertex3f(-1.0f,-1.0f, 1.0f);
      glColor3f(0.0f,0.0f,1.0f);
glVertex3f( 1.0f,-1.0f, 1.0f);                              // Right Of Triangle (Front)
            glColor3f(1.0f,0.0f,0.0f);                                    // Red
            glVertex3f( 0.0f, 1.0f, 0.0f);                              // Top Of Triangle (Right)
            glColor3f(0.0f,0.0f,1.0f);                                    // Blue
            glVertex3f( 1.0f,-1.0f, 1.0f);                              // Left Of Triangle (Right)
            glColor3f(0.0f,1.0f,0.0f);                                    // Green
            glVertex3f( 1.0f,-1.0f, -1.0f);                              // Right Of Triangle (Right)
            glColor3f(1.0f,0.0f,0.0f);                                    // Red
            glVertex3f( 0.0f, 1.0f, 0.0f);                              // Top Of Triangle (Back)
            glColor3f(0.0f,1.0f,0.0f);                                    // Green
            glVertex3f( 1.0f,-1.0f, -1.0f);                              // Left Of Triangle (Back)
            glColor3f(0.0f,0.0f,1.0f);                                    // Blue
            glVertex3f(-1.0f,-1.0f, -1.0f);                              // Right Of Triangle (Back)
            glColor3f(1.0f,0.0f,0.0f);                                    // Red
            glVertex3f( 0.0f, 1.0f, 0.0f);                              // Top Of Triangle (Left)
            glColor3f(0.0f,0.0f,1.0f);                                    // Blue
            glVertex3f(-1.0f,-1.0f,-1.0f);                              // Left Of Triangle (Left)
            glColor3f(0.0f,1.0f,0.0f);                                    // Green
            glVertex3f(-1.0f,-1.0f, 1.0f);                              // Right Of Triangle (Left)
      glEnd();// Reset The Current Modelview Matrix
      glFlush();
      rtri+=0.2f;      


}


void main(int argc, char **argv)
{

glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("GLUT Initialisation Tutorial");
glutDisplayFunc(renderScene);
glutMainLoop();

}
0
 
LVL 1

Accepted Solution

by:
jadecc earned 100 total points
ID: 9727532
Hi,

  I know this is an older post but if you haven't figured this out by now, try moving the glRotatef and glTranslatef before the glBegin() statement. I think that will take care of the rotation problem.
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question