14 #if defined(_DEBUG) && defined(_WINDOWS)
15 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
36 : m_vertex_shader(
get_Video().create_Vertex_Shader(
"shaders/shader.vert")),
37 m_fragment_shader(
get_Video().create_Fragment_Shader(
"shaders/shader.frag")),
51 m_program->attach(*m_vertex_shader);
52 m_program->attach(*m_fragment_shader);
102 if(FAILED(vertexBuffer->Lock(0, 0, &data, 0)))
103 throw Error(
"Lock failed.");
105 vertexBuffer->Unlock();
108 if(FAILED(colorBuffer->Lock(0, 0, &data, 0)))
109 throw Error(
"Lock failed.");
111 colorBuffer->Unlock();
114 if(FAILED(indexBuffer->Lock(0, 0, &data, 0)))
115 throw Error(
"Lock failed.");
117 indexBuffer->Unlock();
124 if(dynamic_cast<Video_DX9 *>(&
get_Video())) {
126 indexBuffer->Release();
128 colorBuffer->Release();
130 vertexBuffer->Release();
132 vertexDecl->Release();
144 const Matrix4f modelViewMatrix = Matrix4f::Orthographic(0.0
f, 800.0
f, 600.0
f, 0.0
f, -1.0
f, 1.0
f);
196 throw Error(
"Setting modelViewProj failed.");
210 vdx.
get_d3d_device()->SetStreamSource(0, vertexBuffer, 0, 2 *
sizeof(
float));
211 vdx.
get_d3d_device()->SetStreamSource(1, colorBuffer, 0, 4 *
sizeof(
unsigned char));
239 auto_ptr<Shader> m_vertex_shader;
240 auto_ptr<Shader> m_fragment_shader;
241 auto_ptr<Program> m_program;
#define GL_STATIC_DRAW_ARB
LPD3DXCONSTANTTABLE get_constant_table() const
The Direct3D9 Rendering System.
LPDIRECT3DDEVICE9 & get_d3d_device()
See DirectX Documentation for details.
The Video Rendering Singleton.
#define D3DUSAGE_WRITEONLY
virtual void set_view_matrix(const Matrix4f &view)=0
Set the view Matrix4f.
bool get_key_state(const int &key) const
Get the state of a key.
GL_APICALL void GL_APIENTRY glEnableVertexAttribArray(GLuint index)
#define GL_UNSIGNED_SHORT
GL_APICALL int GL_APIENTRY glGetAttribLocation(GLuint program, const GLchar *name)
static void render(const Vertex_Buffer_Macrorenderer ¯orenderer, std::vector< Vertex_Buffer::Vertex_Buffer_Range * > &descriptors)
GL_APICALL int GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar *name)
#define GL_TRIANGLE_STRIP
Game & get_Game()
Get access to the singleton.
virtual void unset_program()=0
Disable a program.
GL_APICALL void GL_APIENTRY glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
#define GL_ELEMENT_ARRAY_BUFFER
#define GL_ELEMENT_ARRAY_BUFFER_ARB
#define glGetAttribLocationARB
GL_APICALL void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GL_APICALL void GL_APIENTRY glGenBuffers(GLsizei n, GLuint *buffers)
struct IDirect3DVertexBuffer9 * LPDIRECT3DVERTEXBUFFER9
#define glVertexAttribPointerARB
GLbitfield GLuint program
#define glUniformMatrix4fvARB
#define glDisableClientState
GL_APICALL void GL_APIENTRY glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr)
virtual void set_projection_matrix(const Matrix4f &projection)=0
Set the projection Matrix4f.
#define glEnableClientState
The base class for all gamestates.
struct IDirect3DVertexDeclaration9 * LPDIRECT3DVERTEXDECLARATION9
virtual void set_backface_culling(const bool &on)=0
Set backface culling on/off.
Video & get_Video()
Get access to the singleton.
#define glGetUniformLocationARB
A Featureful 4-Space Matrix Class.
GL_APICALL void GL_APIENTRY glDisableVertexAttribArray(GLuint index)
virtual void set_program(Program &program)=0
Enable a program.
GL_APICALL void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint *buffers)
GL_APICALL void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
#define GL_ARRAY_BUFFER_ARB
#define glEnableVertexAttribArrayARB
#define glDisableVertexAttribArrayARB
struct IDirect3DIndexBuffer9 * LPDIRECT3DINDEXBUFFER9
GLsizei GLenum const GLvoid * indices