#include "testApp.h"


//--------------------------------------------------------------
void testApp::setup(){

    cout << (const char*)glGetString(GL_VERSION) << endl;
	cout << (const char*)glGetString( GL_COMPRESSED_TEXTURE_FORMATS ) << endl;
	cout << (const char*)glGetString( GL_NUM_COMPRESSED_TEXTURE_FORMATS ) << endl;


	#ifdef GL_EXT_texture_compression_dxt1
		printf("GL_EXT_texture_compression_dxt1\n");
	#endif

	#ifdef GL_EXT_texture_compression_s3tc
		printf("GL_EXT_texture_compression_s3tc\n");
	#endif


	glEnable( GL_TEXTURE_2D );
	dds.Create(ofToDataPath("bluebird.dds").c_str());
    glDisable( GL_TEXTURE_2D );

    GLenum errCode = glGetError();
    if(errCode != GL_NO_ERROR)
    {
        cout << "Warning -- loading compressed texture failed: ";
        cout << "\""<< gluErrorString(errCode) << "\"" << endl;
    }

    png.loadImage("bluebird.png");

    ofEnableAlphaBlending();
    ofBackground(200, 200, 200);
    ofSetColor(255, 255, 255);
}

//--------------------------------------------------------------
void testApp::update(){

}

//--------------------------------------------------------------
void testApp::draw(){



	png.draw(10, 10);
    ofDrawBitmapString("bluebird.png", 50, 280);


	glEnable(GL_TEXTURE_2D);
	glBindTexture( GL_TEXTURE_2D, dds.m_uiId );
	glPushMatrix();
	glTranslatef(266+(dds.m_iWidth/2), 10+(dds.m_iHeight/2), 0);
	glScalef(dds.m_iWidth, dds.m_iHeight, 1);
	glBegin(GL_QUADS);
	glTexCoord2f(0,0); glVertex2f(-.5f, -.5f);
	glTexCoord2f(1,0); glVertex2f(.5f, -.5f);
	glTexCoord2f(1,1); glVertex2f(.5f,.5f);
	glTexCoord2f(0,1); glVertex2f(-.5f, .5f);
	glEnd();
	glPopMatrix();
	glDisable(GL_TEXTURE_2D);
	ofDrawBitmapString("bluebird.dds", 356, 280);

}

//--------------------------------------------------------------
void testApp::keyPressed  (int key){

}

//--------------------------------------------------------------
void testApp::keyReleased  (int key){

}

//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){
}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
}

//--------------------------------------------------------------
void testApp::mouseReleased(){

}

