#include "PVRShell.h"
#include "PVRShellAPI.h"
class CLesson2 : public PVRShell
{
public:
virtual bool InitApplication();
virtual bool InitView();
virtual bool ReleaseView();
virtual bool QuitApplication();
virtual bool RenderScene();
protected:
private:
};
bool CLesson2::InitApplication()
{
return true;
}
bool CLesson2::QuitApplication()
{
return true;
}
GLuint ui32Vbo = 0;
GLuint uiQuatVbo = 0;
bool CLesson2::InitView()
{
float afVertices[] = { -0.4f,-0.4f,0.0f, // Position
0.0f,0.0f,0.0f,0.0f, // Colour
0.4f,-0.4f,0.0f,
0.0f,1.0f,0.00f,1.0f,
0.0f,0.4f,0.0f,
1.0f,1.0f,1.00f,1.0f};
glGenBuffers(1, &ui32Vbo);
glBindBuffer(GL_ARRAY_BUFFER,ui32Vbo);
unsigned int uiSize = 3 * (sizeof(float) * 7);
glBufferData(GL_ARRAY_BUFFER, uiSize, afVertices, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER,0);
return true;
}
bool CLesson2::ReleaseView()
{
return true;
}
PVRShell * NewDemo(void)
{
return new CLesson2();
}
bool CLesson2::RenderScene()
{
glLoadIdentity();
glClearColor(0.7, 0.7, 0.7, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glBindBuffer(GL_ARRAY_BUFFER,ui32Vbo);
glVertexPointer(3, GL_FLOAT, 7 * sizeof(float), 0);
glColorPointer(4, GL_FLOAT, 3*sizeof(float), (GLvoid*)(4*sizeof(float)));
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
return true;
}
(cr0_3) |