Click here to Skip to main content
15,900,973 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CBitmapButton::Loadbitmap Pin
Hristo-Bojilov10-Jun-10 8:13
Hristo-Bojilov10-Jun-10 8:13 
QuestionMoving object (cube) along given points. Pin
RohitBapat10-Jun-10 6:53
RohitBapat10-Jun-10 6:53 
AnswerRe: Moving object (cube) along given points. PinPopular
Chris Losinger10-Jun-10 7:11
professionalChris Losinger10-Jun-10 7:11 
GeneralRe: Moving object (cube) along given points. Pin
RohitBapat10-Jun-10 7:14
RohitBapat10-Jun-10 7:14 
GeneralRe: Moving object (cube) along given points. Pin
David Crow10-Jun-10 9:16
David Crow10-Jun-10 9:16 
GeneralRe: Moving object (cube) along given points. Pin
RohitBapat10-Jun-10 9:31
RohitBapat10-Jun-10 9:31 
GeneralRe: Moving object (cube) along given points. Pin
RohitBapat10-Jun-10 11:17
RohitBapat10-Jun-10 11:17 
GeneralRe: Moving object (cube) along given points. Pin
RohitBapat12-Jun-10 17:21
RohitBapat12-Jun-10 17:21 
Hi David I have stopped using gluTranslatef() now I am working with glLookAt(). I read coordinates from the text file and assign those to glLookAt() function. I know my code to read the coordinates is working fine but I cant see my camera moving on those points . "Rather my computer shows a transparent window OMG | :OMG: WTF | :WTF: " What can be possible reason for that ? I am not getting why this happens I doubt it's because less graphic capability ...

But when I give a general for() loop to change z coordinate just to test It Works fine WTF | :WTF: Confused | :confused:
I don't know how to make it work. Can you help me to solve this issue ?!

I am posting my code
#include <math.h>
#include <GL/glut.h>
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <time.h>
#include <dos.h>
#include <windows.h>
using namespace std;

float angle=0.0,deltaAngle = 0.0,ratio;
float x=0.0f,y=1.75f,z=5.0f;
float lx=0.0f,ly=0.0f,lz=-1.0f;
GLint snowman_display_list;
int deltaMove = 0;
float a = 0.0f;
int b = 0;

void changeSize(int w, int h)
	{

	// Prevent a divide by zero, when window is too short
	// (you cant make a window of zero width).
	if(h == 0)
		h = 1;

	ratio = 1.0f * w / h;
	// Reset the coordinate system before modifying
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	// Set the viewport to be the entire window
    glViewport(0, 0, w, h);

	// Set the clipping volume
	gluPerspective(45,ratio,1,1000);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}
void renderScene(void) 
{

		
  FILE *file;
  float numbers[3]; 
  float rx,ry,rz;
  int i;
	
  file = fopen("C:\\Users\\RoBa\\Desktop\\test.txt", "r");

  while(feof(file)== NULL)
        {	//b = 0;
			fscanf(file, "%f %f %f ", &numbers[b],&numbers[b+1], &numbers[b+2]);
			
			    rx = (numbers[b])/10;
				ry = (numbers[b+1])/10;
				rz = (numbers[b+2])/10;
			cout<<rx<<endl;
			cout<<ry<<endl;
			cout<<rz<<endl;
			glLoadIdentity();
			gluLookAt(rx , ry , rz , 0.0f,0.0f,0.f,0.0f,1.0f,0.0f);
				
        }
		 fclose(file);
		cout<<rx<<endl;
		cout<<ry<<endl;
		cout<<rz<<endl;



	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glutWireCube(2.0f);
	glutSwapBuffers();
}


int main(int argc, char **argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowPosition(100,100);
	glutInitWindowSize(640,360);
	glutCreateWindow("My animation");
	glutDisplayFunc(renderScene);
	glutReshapeFunc(changeSize);

	glutMainLoop();

	return(0);
}


Thank you
Rohit
QuestionCode Review Tool Pin
john563210-Jun-10 2:21
john563210-Jun-10 2:21 
AnswerRe: Code Review Tool [modified] Pin
Aescleal10-Jun-10 2:28
Aescleal10-Jun-10 2:28 
AnswerRe: Code Review Tool Pin
Chris Losinger10-Jun-10 2:53
professionalChris Losinger10-Jun-10 2:53 
AnswerRe: Code Review Tool [modified] Pin
rp_suman10-Jun-10 6:07
rp_suman10-Jun-10 6:07 
AnswerRe: Code Review Tool Pin
molesworth10-Jun-10 7:27
molesworth10-Jun-10 7:27 
Questionhow to load texture on ball Pin
nearest10-Jun-10 2:04
nearest10-Jun-10 2:04 
AnswerRe: how to load texture on ball Pin
Rick York11-Jun-10 16:06
mveRick York11-Jun-10 16:06 
Questiondisplay unicode text from into text box from utf database record Pin
Jayapal Chandran10-Jun-10 1:39
Jayapal Chandran10-Jun-10 1:39 
AnswerRe: display unicode text from into text box from utf database record Pin
Richard MacCutchan10-Jun-10 5:52
mveRichard MacCutchan10-Jun-10 5:52 
GeneralRe: display unicode text from into text box from utf database record Pin
Jayapal Chandran21-Jun-10 6:50
Jayapal Chandran21-Jun-10 6:50 
GeneralRe: display unicode text from into text box from utf database record Pin
Richard MacCutchan21-Jun-10 7:29
mveRichard MacCutchan21-Jun-10 7:29 
GeneralRe: display unicode text from into text box from utf database record Pin
Jayapal Chandran22-Jun-10 3:07
Jayapal Chandran22-Jun-10 3:07 
GeneralRe: display unicode text from into text box from utf database record Pin
Richard MacCutchan22-Jun-10 4:14
mveRichard MacCutchan22-Jun-10 4:14 
GeneralRe: display unicode text from into text box from utf database record Pin
Jayapal Chandran22-Jun-10 5:11
Jayapal Chandran22-Jun-10 5:11 
GeneralRe: display unicode text from into text box from utf database record Pin
Richard MacCutchan22-Jun-10 5:59
mveRichard MacCutchan22-Jun-10 5:59 
QuestionMigration from VC 6.0 to Visual studio 2005 Pin
VC_RYK10-Jun-10 1:20
VC_RYK10-Jun-10 1:20 
AnswerRe: Migration from VC 6.0 to Visual studio 2005 Pin
Chris Losinger10-Jun-10 1:30
professionalChris Losinger10-Jun-10 1:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.