void SetupRC() { // Background glClearColor(0.0f, 0.0f, 0.0f, 1.0f ); viewFrame.MoveForward(4.0f); shaderManager.InitializeStockShaders(); // Simple triangle // Load up a triangle GLfloat vVerts[] = { -0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f }; GLfloat vTexCoords [] = { 0.0f, 0.0f, 1.0f, 0.0f, 0.5f, 1.0f }; triangleBatch.Begin(GL_TRIANGLES, 3, 1); triangleBatch.CopyVertexData3f(vVerts); triangleBatch.CopyTexCoordData2f(vTexCoords, 0); triangleBatch.End(); texturedIdentity = gltLoadShaderPairWithAttributes("TexturedIdentity.vp", "TexturedIdentity.fp", 2, GLT_ATTRIBUTE_VERTEX, "vVertex", GLT_ATTRIBUTE_TEXTURE0, "vTexCoords"); glGenTextures(1, &stoneTexture); glBindTexture(GL_TEXTURE_2D, stoneTexture); LoadTGATexture("Stone.tga", GL_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE); }
/** * This function does any needed initialization on the rendering context. * This is the first opportunity to do any OpenGL related tasks. */ void SetupRC() { // Blue background glClearColor(0.0f, 0.0f, 1.0f, 1.0f ); shaderManager.init(); // load up a triangle GLfloat vVerts[] = { -0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f }; GLfloat vTexCoords[] = { 0.0f, 0.0f, 1.0f, 0.0f, 0.5f, 1.0f }; triangleBatch.begin(GL_TRIANGLES, 3, 1); triangleBatch.CopyVertexData3f(vVerts); triangleBatch.CopyTexCoordData2f(vTexCoords, 0); triangleBatch.end(); myTexturedIdentityShader = gltLoadShaderWithFileEx("TextureIndentity.vp", "TextureIndentity.fp", 2, GLT_ATTRIBUTE_VERTEX, "vVertex", GLT_ATTRIBUTE_TEXTURE0, "vTexCoords"); glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); gltLoadTextureTGA("stone.tga", GL_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE); }