I have made some stuff with using my own matrices. Now I want to create the same things only with the sceGum matrix functions. So i thought i will make a small example of it but I just can't seem to get it to work :s
It renders nothing (what I can see on the screen) hope that you guys can see something wrong :s (the clearing of the screen works and it gets the purple color as supplied in code)
Code: Select all
void GameApp::Render() {
// render information.
sceGuStart(GU_DIRECT,list);
// clear screen
sceGuClearColor(0xff00ff);
sceGuClearDepth(0);
sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
// setting the view
sceGumMatrixMode(GU_VIEW);
sceGumLoadIdentity();
ScePspFVector3 pos = {0,0,500};
ScePspFVector3 view = {0,0,0};
ScePspFVector3 up = {0,1,0};
sceGumLookAt(&pos,&view,&up);
// model
triangle->Render();
// ending rendering
sceGuFinish();
sceGuSync(0,0);
sceDisplayWaitVblankStart();
sceGuSwapBuffers();
}
Code: Select all
#include "Triangle.h"
#include <pspgu.h>
#include <pspgum.h>
#include "stdio.h"
#include "malloc.h"
Triangle::Triangle() {
triangle = (vertex*)memalign(16,3 * sizeof(vertex));
triangle[0].color = 0xff00ff00;
triangle[0].x = 0.0f;
triangle[0].y = 272.0f;
triangle[0].z = 0.0f;
triangle[1].color = 0xff00ff00;
triangle[1].x = 240.0f;
triangle[1].y = 0.0f;
triangle[1].z = 0.0f;
triangle[2].color = 0xff00ff00;
triangle[2].x = 480.0f;
triangle[2].y = 272.0f;
triangle[2].z = 0.0f;
rot = 0.0f;
}
Triangle::~Triangle() {
delete(triangle);
}
void Triangle::Render() {
rot += 0.5f;
sceGumMatrixMode(GU_MODEL);
sceGumLoadIdentity();
sceGumRotateY(rot);
sceGuDrawArray(GU_TRIANGLES, GU_COLOR_8888 | GU_VERTEX_32BITF | GU_TRANSFORM_3D, 3, 0, triangle);
}
Code: Select all
// setting the projection
sceGumMatrixMode(GU_PROJECTION);
sceGumLoadIdentity();
sceGumPerspective(45.0f,16.0f/9.0f,10.0f,1000.0f);