int main(int argc, char** argv)
{
	//freopen("out.txt","w",stdout);
	freopen("in.txt","r",stdin);

    BMPLoad("sin1.bmp",pic1);
    BMPLoad("sin3.bmp",pic2);
    BMPLoad("sin5.bmp",pic3);
    BMPLoad("sin7.bmp",pic4);

	glutInit(&argc, argv);
	init ();

	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	
	// Fourier Transform . . . . . .
	fourier_transform1();
	fourier_transform2();
	fourier_transform3();
	fourier_transform4();

	glutMainLoop();

	return 0;
}
Example #2
0
int main(int argc,char** argv)
{
	glutInit(&argc,argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
	glutCreateWindow("yrBMP");
	glutReshapeFunc(OnSize);
	glutDisplayFunc(OnDraw);

	//std::cout<<"Enter filename:";
	//std::string fname;
	//std::cin>>fname;
	//std::string fname("bmp16.bmp");
	std::string fname("NeHe.bmp");
	BMPClass bmp;
	BMPLoad(fname,bmp);
	
	glEnable(GL_TEXTURE_2D);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
	glTexImage2D(GL_TEXTURE_2D,0,3,bmp.width,bmp.height,0,GL_RGB,GL_UNSIGNED_BYTE,bmp.bytes);

	glutReshapeWindow(bmp.width,bmp.height);

	glutMainLoop();
	return 0;
}
Example #3
0
int main (int argc, char **argv)
{
	
	freopen("out.txt","w",stdout);

	//nam lekhar jonno...cursor..........
	name[0]='_';
	//texture  mapping-er  jonno.........	
	
	BMPLoad("menu.bmp",menu5);

	// GLUT initialization.
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
	glutInitWindowSize(width, height);
	glutCreateWindow("CAR RACING");
    initRendering();


	// Register call backs.
	glutDisplayFunc(display);
	glutReshapeFunc(reshapeMainWindow);

	//glutMouseFunc(mouse);
    glutTimerFunc(TIMERMSECS, timer, 0);
	//glutIdleFunc(keyCheck);

	// Enter GLUT loop.
	glutMainLoop();

	return 0;
}
//Loads the textures listed above into the video memory
void loadTextures() {

	glEnable(GL_TEXTURE_2D);

	glGenTextures(NUMBER_OF_TEXTURES, textureID);

	BMPClass* img = new BMPClass();

	for( int i = 0; i < NUMBER_OF_TEXTURES; i++) {

		glBindTexture(GL_TEXTURE_2D, textureID[i]);

		BMPLoad("images/" + textureName[i], img);

		//glTexImage2D(GL_TEXTURE_2D,0,3,img->width,img->height,0,GL_RGB,GL_UNSIGNED_BYTE,img->bytes);
		glTexImage2D(GL_TEXTURE_2D,0,4,img->width,img->height,0,GL_RGBA,GL_UNSIGNED_BYTE,img->transparencyBytes);


		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
	}

	delete img;

}
Example #5
0
BMPError BMPLoadGL(std::string fname)
{
	BMPClass bmp;
	BMPError e=BMPLoad(fname,bmp);
	if(e!=BMPNOERROR) return e;
		
	glEnable(GL_TEXTURE_2D);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
	glTexImage2D(GL_TEXTURE_2D,0,3,bmp.width,bmp.height,0,GL_RGB,GL_UNSIGNED_BYTE,bmp.bytes);

	return BMPNOERROR;
}
Example #6
0
Terrain::Terrain(char* path, int theSize, float theScale, float textureTile)
{
    size = theSize;
    scale = theScale;
    uTile = textureTile;
    vTile = textureTile;

    BMPClass *bmp = new BMPClass();
	BMPLoad(path, *bmp);

    // calculate the 3D heightfield
    calculateHeightfield(bmp->bytes);

    //delete bmp;

}
Example #7
0
BMPError BMPLoadGL(std::string fname)
{
	BMPClass bmp;
	BMPError e=BMPLoad(fname,bmp);
	if(e!=BMPNOERROR) return e;
	
    glGenTextures(1, &glCountTexture);
    printf("TexID: %d\n", glCountTexture);
    printf("Filename: %s\n", fname.c_str());
	glBindTexture(GL_TEXTURE_2D, glCountTexture);
	glEnable(GL_TEXTURE_2D);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
    //glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
	glTexImage2D(GL_TEXTURE_2D,0,3,bmp.width,bmp.height,0,GL_RGB,GL_UNSIGNED_BYTE,bmp.bytes);
    //gluBuild2DMipmaps(GL_TEXTURE_2D, 3, bmp.width, bmp.height, GL_RGB, GL_UNSIGNED_BYTE, bmp.bytes);
            
	return BMPNOERROR;
}
Example #8
0
/*
* Request double buffer display mode.
* Register mouse input callback functions
*/
int main(int argc, char** argv)
{
	freopen("out.txt","w",stdout);

    BMPLoad("menu.bmp",menu5);

	glutInit(&argc, argv);
	init ();

	// Input .............

	freopen("in.txt","r",stdin);

	point p,p1;
	scanf("%lf %lf",&p.x,&p.y);
	s=p;
	scanf("%lf %lf",&p.x,&p.y);
	d=p;

	scanf("%d",&n);

	for(int i=1;i<=n;i++){
		scanf("%lf %lf",&p.x,&p.y);
		scanf("%lf %lf",&p1.x,&p1.y);
		rects[i]=rect(p,p1);
	}

	//  ...................

	glutDisplayFunc(display);
	glutReshapeFunc(reshape);

	glutMainLoop();

	return 0;
}
Example #9
0
BMPError BMPLoad(std::string fname){BMPClass bmp;return BMPLoad(fname,bmp);}
void Context::Initialize( WINDOW_HANDLE windowHandle )
{
    Assert( !sIsInitialized );

    // initialize rtgi
    rtgi::Initialize( windowHandle );

    rtgi::BeginRender();
    rtgi::ClearColorBuffer( rtgi::ColorRGBA( 0, 0, 0, 1 ) );
    rtgi::ClearDepthBuffer();
    rtgi::ClearStencilBuffer();
    rtgi::EndRender();
    rtgi::Present();

    rtgi::GetViewport( sInitialViewportWidth, sInitialViewportHeight );
    rtgi::CreateSharedShaderParameter( "modelViewProjectionMatrix",  rtgi::SharedShaderParameterType_Matrix44 );
    rtgi::CreateSharedShaderParameter( "objectSpaceLightPosition",   rtgi::SharedShaderParameterType_Vector3  );
    rtgi::CreateSharedShaderParameter( "objectSpaceCameraPosition",  rtgi::SharedShaderParameterType_Vector3  );

    // initialize matrices
    sTransform.SetToIdentity();
    sView.SetToIdentity();
    sProjection.SetToIdentity();

    // load debug/default content
    content::LoadManager::InstallLoader( new TextureLoader  );
    content::LoadManager::InstallLoader( new EffectLoader   );
    content::LoadManager::InstallLoader( new MaterialLoader );
    content::LoadManager::InstallLoader( new GeometryLoader );
    content::LoadManager::InstallLoader( new SceneLoader    );

    sInventory = new content::Inventory();
    sInventory->AddRef();

    content::LoadManager::Load( "runtime/art/DebugCamera.dae",   sInventory );
    content::LoadManager::Load( "runtime/art/DebugMaterial.dae", sInventory );
    content::LoadManager::Load( "runtime/art/PhongEffect.dae",   sInventory );

    sDebugCamera   = sInventory->Find< Camera >      ( "debugCameraShape" );
    sDebugMaterial = sInventory->Find< Material >    ( "debugMaterial" );
    sPhongEffect   = sInventory->Find< rtgi::Effect >( "phongEffect" );
    sCamera        = sDebugCamera;

    BMPClass bmp;
    BMPError errorCode = BMPLoad( "runtime/art/DebugTexture.bmp", bmp );
    Assert( errorCode == BMPNOERROR );

    rtgi::TextureDataDesc textureDataDesc;
    textureDataDesc.dimensions                   = rtgi::TextureDimensions_2D;
    textureDataDesc.pixelFormat                  = rtgi::TexturePixelFormat_R8_G8_B8_UI_NORM;
    textureDataDesc.data                         = bmp.bytes;
    textureDataDesc.width                        = bmp.width;
    textureDataDesc.height                       = bmp.height;
    textureDataDesc.generateMipMaps              = true;

    sDebugTexture = rtgi::CreateTexture( textureDataDesc );
    sDebugTexture->AddRef();

    sDebugTextFont = rtgi::CreateTextFont();
    sDebugTextFont->AddRef();

    sIsInitialized = true;
}