Fix rendering: GL3+ needs VAO, initialize screen_width/screen_height

*yay* it works now *dances*
This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2014-06-27 00:51:57 +03:00
parent 6d6cf7d055
commit 531863bca4
3 changed files with 23 additions and 1 deletions

View File

@ -904,8 +904,11 @@ void SetMVS_Mode(u32 mv_mode,ISP_Modvol ispc)
}
}
void SetupMainVBO()
{
glBindVertexArray(gl.vbo.vao);
glBindBuffer(GL_ARRAY_BUFFER, gl.vbo.geometry); glCheck();
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, gl.vbo.idxs); glCheck();
@ -925,6 +928,8 @@ void SetupMainVBO()
void SetupModvolVBO()
{
glBindVertexArray(gl.vbo.vao);
glBindBuffer(GL_ARRAY_BUFFER, gl.vbo.modvols); glCheck();
//setup vertex buffers attrib pointers

View File

@ -583,6 +583,12 @@ bool gl_init(void* hwnd, void* hdc)
if (rv) {
rv = gl3wInit() != -1 && gl3wIsSupported(3, 1);
}
RECT r;
GetClientRect((HWND)hwnd, &r);
screen_width = r.right - r.left;
screen_height = r.bottom - r.top;
return rv;
}
#include <Wingdi.h>
@ -785,6 +791,14 @@ GLuint osd_font;
bool gl_create_resources()
{
#ifndef GLES
//create vao
//This is really not "proper", vaos are suposed to be defined once
//i keep updating the same one to make the es2 code work in 3.1 context
glGenVertexArrays(1, &gl.vbo.vao);
#endif
//create vbos
glGenBuffers(1, &gl.vbo.geometry);
glGenBuffers(1, &gl.vbo.modvols);

View File

@ -26,7 +26,7 @@
#endif
#define glCheck() false
#define glCheck() verify(glGetError()==GL_NO_ERROR)
#define eglCheck() false
#define VERTEX_POS_ARRAY 0
@ -86,6 +86,9 @@ struct gl_ctx
struct
{
GLuint geometry,modvols,idxs,idxs2;
#ifndef GLES
GLuint vao;
#endif
} vbo;