35 #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
42 #if defined(_WIN32) && !defined(APIENTRY)
43 #define APIENTRY __stdcall // It is customary to use APIENTRY for OpenGL function pointer declarations on all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
45 #if defined(_WIN32) && !defined(WINGDIAPI)
46 #define WINGDIAPI __declspec(dllimport) // Some Windows OpenGL headers need this
48 #if defined(__APPLE__)
49 #define GL_SILENCE_DEPRECATION
50 #include <OpenGL/gl.h>
88 glEnableClientState(GL_VERTEX_ARRAY);
89 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
90 glEnableClientState(GL_COLOR_ARRAY);
93 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
106 glMatrixMode(GL_PROJECTION);
110 glMatrixMode(GL_MODELVIEW);
123 if (fb_width == 0 || fb_height == 0)
131 GLint last_tex_env_mode; glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &last_tex_env_mode);
151 for (
int cmd_i = 0; cmd_i < cmd_list->
CmdBuffer.
Size; cmd_i++)
167 clip_rect.
x = (pcmd->
ClipRect.
x - clip_off.
x) * clip_scale.
x;
168 clip_rect.
y = (pcmd->
ClipRect.
y - clip_off.
y) * clip_scale.
y;
169 clip_rect.
z = (pcmd->
ClipRect.
z - clip_off.
x) * clip_scale.
x;
170 clip_rect.
w = (pcmd->
ClipRect.
w - clip_off.
y) * clip_scale.
y;
172 if (clip_rect.
x < fb_width && clip_rect.
y < fb_height && clip_rect.
z >= 0.0f && clip_rect.
w >= 0.0f)
175 glScissor((
int)clip_rect.
x, (
int)(fb_height - clip_rect.
w), (
int)(clip_rect.
z - clip_rect.
x), (
int)(clip_rect.
w - clip_rect.
y));
187 glDisableClientState(GL_COLOR_ARRAY);
188 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
189 glDisableClientState(GL_VERTEX_ARRAY);
191 glMatrixMode(GL_MODELVIEW);
193 glMatrixMode(GL_PROJECTION);
198 glScissor(last_scissor_box[0], last_scissor_box[1], (
GLsizei)last_scissor_box[2], (
GLsizei)last_scissor_box[3]);
199 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, last_tex_env_mode);