bullet3/examples/TinyRenderer/our_gl.h
erwin coumans 03bdcc8737 patch TinyRenderer so it software-renders in an OpenGL texture, for testing
fix texture support: flip texture to make OpenGL happy (lower-left is origin)
add path prefix to .obj loader, so materials/textures are loaded ok.
2016-04-26 20:52:52 -07:00

23 lines
614 B
C

#ifndef __OUR_GL_H__
#define __OUR_GL_H__
#include "tgaimage.h"
#include "geometry.h"
Matrix viewport(int x, int y, int w, int h);
Matrix projection(float coeff=0.f); // coeff = -1/c
Matrix lookat(Vec3f eye, Vec3f center, Vec3f up);
struct IShader {
virtual ~IShader();
virtual Vec4f vertex(int iface, int nthvert) = 0;
virtual bool fragment(Vec3f bar, TGAColor &color) = 0;
};
//void triangle(Vec4f *pts, IShader &shader, TGAImage &image, float *zbuffer);
void triangle(mat<4,3,float> &pts, IShader &shader, TGAImage &image, float *zbuffer, const Matrix& viewPortMatrix);
#endif //__OUR_GL_H__