Exemplo n.º 1
0
void DrawBox(CPUTRenderParameters &renderParams, float3 position, float3 size, CPUTColor4 color)
{
	size *= 0.01f;
	float4x4 parentMatrix = float4x4Scale(size) * float4x4Translation(position);
	gUtilGlob.boxModel->SetParentMatrix(parentMatrix);
	gUtilGlob.boxModel->mUserData1 = color.ToFloat4();
	gUtilGlob.boxModel->Render(renderParams, 0);
}
Exemplo n.º 2
0
Arquivo: render.c Projeto: 10n1/rps
void render_draw_custom_quad(GLuint texture, GLuint vao, float x, float y, float width, float height) {
    float4x4 mWorld = float4x4translation(x, y, 0.0f);
    float4x4 mScale = float4x4Scale(width, height, 1.0f);
    mWorld = float4x4multiply(&mScale, &mWorld);
    
    glUniformMatrix4fv(_uniforms[UNIFORM_WORLD_MATRIX], 1, 0, (const GLfloat*)&mWorld);
    glUniformMatrix4fv(_uniforms[UNIFORM_VIEWPROJECTION_MATRIX], 1, 0, (const GLfloat*)&_projectionMatrix[_current_projection]);
    
#ifndef ANDROID
    glBindVertexArrayOES(vao);
#endif

    glBindTexture(GL_TEXTURE_2D, texture);
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL);
}
Exemplo n.º 3
0
Arquivo: render.c Projeto: 10n1/rps
void render_draw_custom_quad_vbo(GLuint texture, GLuint vertex_buffer, GLuint index_buffer, float x, float y, float width, float height )
{
    float4x4 mWorld = float4x4translation(x, y, 0.0f);
    float4x4 mScale = float4x4Scale(width, height, 1.0f);
    mWorld = float4x4multiply(&mScale, &mWorld);
    
    glUniformMatrix4fv(_uniforms[UNIFORM_WORLD_MATRIX], 1, 0, (const GLfloat*)&mWorld);
    glUniformMatrix4fv(_uniforms[UNIFORM_VIEWPROJECTION_MATRIX], 1, 0, (const GLfloat*)&_projectionMatrix[_current_projection]);
    
    glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer);
    
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(vertex_t), BUFFER_OFFSET(0));
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(vertex_t), BUFFER_OFFSET(12));
    
    glBindTexture(GL_TEXTURE_2D, texture);
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL);
}