summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/render/graphics.cpp2
-rw-r--r--src/render/mgl.hpp18
-rw-r--r--src/render/mobileopengl2graphics.cpp50
-rw-r--r--src/render/mobileopenglgraphics.cpp56
-rw-r--r--src/render/modernopenglgraphics.cpp48
-rw-r--r--src/render/naclglfunctions.h10
6 files changed, 107 insertions, 77 deletions
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp
index 613a87b89..dd1dab84d 100644
--- a/src/render/graphics.cpp
+++ b/src/render/graphics.cpp
@@ -642,6 +642,8 @@ void Graphics::popClipArea()
#ifdef USE_OPENGL
void Graphics::setOpenGLFlags()
{
+ // here disable/enable probably need convert to mgl
+
glEnable(GL_SCISSOR_TEST);
glDisable(GL_MULTISAMPLE);
diff --git a/src/render/mgl.hpp b/src/render/mgl.hpp
index 0370cde74..50c1f8648 100644
--- a/src/render/mgl.hpp
+++ b/src/render/mgl.hpp
@@ -76,6 +76,24 @@ defName(glValidateProgram);
defName(glGetProgramInfoLog);
defName(glBindAttribLocation);
defName(glActiveTexture);
+
+#define mglDrawArrays(...) \
+ glDrawArrays(__VA_ARGS__)
+#define mglDisable(...) \
+ glDisable(__VA_ARGS__)
+#define mglHint(...) \
+ glHint(__VA_ARGS__)
+#define mglScissor(...) \
+ glScissor(__VA_ARGS__)
+#define mglEnable(...) \
+ glEnable(__VA_ARGS__)
+#define mglBindTexture(...) \
+ glBindTexture(__VA_ARGS__)
+#define mglGetIntegerv(...) \
+ glGetIntegerv(__VA_ARGS__)
+#define mglClear(...) \
+ glClear(__VA_ARGS__)
+
#endif
defName(glGetAttribLocation);
defName(glUniform3f);
diff --git a/src/render/mobileopengl2graphics.cpp b/src/render/mobileopengl2graphics.cpp
index 8a46f05fb..f165ec11a 100644
--- a/src/render/mobileopengl2graphics.cpp
+++ b/src/render/mobileopengl2graphics.cpp
@@ -287,7 +287,7 @@ void MobileOpenGL2Graphics::drawQuad(const int srcX, const int srcY,
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
void MobileOpenGL2Graphics::drawRescaledQuad(const int srcX, const int srcY,
@@ -318,7 +318,7 @@ void MobileOpenGL2Graphics::drawRescaledQuad(const int srcX, const int srcY,
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
void MobileOpenGL2Graphics::drawImage(const Image *const image,
@@ -375,7 +375,7 @@ void MobileOpenGL2Graphics::testDraw()
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
// glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, 0);
}
@@ -589,7 +589,7 @@ inline void MobileOpenGL2Graphics::drawVertexes(const
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLES, 0, *ivp / 4);
+ mglDrawArrays(GL_TRIANGLES, 0, *ivp / 4);
}
}
@@ -841,8 +841,6 @@ void MobileOpenGL2Graphics::updateScreen()
if (isGLNotNull(mglFrameTerminator))
mglFrameTerminator();
#endif
-// may be need clear?
-// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
BLOCK_END("Graphics::updateScreen")
}
@@ -850,8 +848,8 @@ void MobileOpenGL2Graphics::beginDraw()
{
setOpenGLFlags();
#ifndef __native_client__
- glDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
- glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB, GL_FASTEST);
+ mglDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
+ mglHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB, GL_FASTEST);
#endif
pushClipArea(Rect(0, 0, mRect.w, mRect.h));
}
@@ -887,7 +885,7 @@ SDL_Surface* MobileOpenGL2Graphics::getScreenshot()
GLubyte *const buf = new GLubyte[lineSize];
// Grap the pixel buffer and write it to the SDL surface
- glGetIntegerv(GL_PACK_ALIGNMENT, &pack);
+ mglGetIntegerv(GL_PACK_ALIGNMENT, &pack);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, screenshot->pixels);
@@ -923,7 +921,7 @@ void MobileOpenGL2Graphics::pushClipArea(const Rect &area)
Graphics::pushClipArea(area);
const ClipRect &clipArea = mClipStack.top();
- glScissor(clipArea.x * mScale,
+ mglScissor(clipArea.x * mScale,
(mRect.h - clipArea.y - clipArea.height) * mScale,
clipArea.width * mScale,
clipArea.height * mScale);
@@ -938,7 +936,7 @@ void MobileOpenGL2Graphics::popClipArea()
return;
const ClipRect &clipArea = mClipStack.top();
- glScissor(clipArea.x * mScale,
+ mglScissor(clipArea.x * mScale,
(mRect.h - clipArea.y - clipArea.height) * mScale,
clipArea.width * mScale,
clipArea.height * mScale);
@@ -958,7 +956,7 @@ void MobileOpenGL2Graphics::drawPoint(int x, int y)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_POINTS, 0, 1);
+ mglDrawArrays(GL_POINTS, 0, 1);
}
void MobileOpenGL2Graphics::drawLine(int x1, int y1, int x2, int y2)
@@ -976,7 +974,7 @@ void MobileOpenGL2Graphics::drawLine(int x1, int y1, int x2, int y2)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_LINES, 0, 2);
+ mglDrawArrays(GL_LINES, 0, 2);
}
void MobileOpenGL2Graphics::drawRectangle(const Rect& rect)
@@ -1001,7 +999,7 @@ void MobileOpenGL2Graphics::drawRectangle(const Rect& rect)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_LINE_LOOP, 0, 4);
+ mglDrawArrays(GL_LINE_LOOP, 0, 4);
}
void MobileOpenGL2Graphics::fillRectangle(const Rect& rect)
@@ -1026,7 +1024,7 @@ void MobileOpenGL2Graphics::fillRectangle(const Rect& rect)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
void MobileOpenGL2Graphics::setTexturingAndBlending(const bool enable)
@@ -1040,7 +1038,7 @@ void MobileOpenGL2Graphics::setTexturingAndBlending(const bool enable)
}
if (!mAlpha)
{
- glEnable(GL_BLEND);
+ mglEnable(GL_BLEND);
mAlpha = true;
}
}
@@ -1053,12 +1051,12 @@ void MobileOpenGL2Graphics::setTexturingAndBlending(const bool enable)
}
if (mAlpha && !mColorAlpha)
{
- glDisable(GL_BLEND);
+ mglDisable(GL_BLEND);
mAlpha = false;
}
else if (!mAlpha && mColorAlpha)
{
- glEnable(GL_BLEND);
+ mglEnable(GL_BLEND);
mAlpha = true;
}
}
@@ -1138,7 +1136,7 @@ void MobileOpenGL2Graphics::bindTexture2(const GLenum target,
if (mTextureBinded != texture)
{
mTextureBinded = texture;
- glBindTexture(target, texture);
+ mglBindTexture(target, texture);
if (mTextureWidth != image->mTexWidth ||
mTextureHeight != image->mTexHeight)
{
@@ -1158,7 +1156,7 @@ void MobileOpenGL2Graphics::bindTexture(const GLenum target A_UNUSED,
{
// for safty not storing textures because cant update size uniform
mTextureBinded = 0;
- glBindTexture(target, texture);
+ mglBindTexture(target, texture);
}
}
@@ -1220,7 +1218,7 @@ void MobileOpenGL2Graphics::dumpSettings()
test[1] = 0;
test[2] = 0;
test[3] = 0;
- glGetIntegerv(f, &test[0]);
+ mglGetIntegerv(f, &test[0]);
if (test[0] || test[1] || test[2] || test[3])
{
logger->log("\n%d = %d, %d, %d, %d", f,
@@ -1246,7 +1244,9 @@ void MobileOpenGL2Graphics::calcImageRect(ImageVertexes *const vert,
void MobileOpenGL2Graphics::clearScreen() const
{
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ mglClear(GL_COLOR_BUFFER_BIT |
+ GL_DEPTH_BUFFER_BIT |
+ GL_STENCIL_BUFFER_BIT);
}
void MobileOpenGL2Graphics::createGLContext()
@@ -1312,7 +1312,7 @@ void MobileOpenGL2Graphics::drawTriangleArray(const int size)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLES, 0, size / 4);
+ mglDrawArrays(GL_TRIANGLES, 0, size / 4);
}
void MobileOpenGL2Graphics::drawTriangleArray(const GLfloat *const array,
@@ -1323,7 +1323,7 @@ void MobileOpenGL2Graphics::drawTriangleArray(const GLfloat *const array,
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLES, 0, size / 4);
+ mglDrawArrays(GL_TRIANGLES, 0, size / 4);
}
void MobileOpenGL2Graphics::drawLineArrays(const int size)
@@ -1333,7 +1333,7 @@ void MobileOpenGL2Graphics::drawLineArrays(const int size)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_LINES, 0, size / 4);
+ mglDrawArrays(GL_LINES, 0, size / 4);
}
#ifdef DEBUG_BIND_TEXTURE
diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp
index 75d13f9cd..995a36c84 100644
--- a/src/render/mobileopenglgraphics.cpp
+++ b/src/render/mobileopenglgraphics.cpp
@@ -202,7 +202,7 @@ static inline void drawQuad(const Image *const image,
#ifdef DEBUG_DRAW_CALLS
MobileOpenGLGraphics::mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
}
@@ -254,7 +254,7 @@ static inline void drawRescaledQuad(const Image *const image,
#ifdef DEBUG_DRAW_CALLS
MobileOpenGLGraphics::mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
}
@@ -889,8 +889,6 @@ void MobileOpenGLGraphics::updateScreen()
if (isGLNotNull(mglFrameTerminator))
mglFrameTerminator();
#endif
-// may be need clear?
-// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
BLOCK_END("Graphics::updateScreen")
}
@@ -916,9 +914,9 @@ void MobileOpenGLGraphics::beginDraw()
glLoadIdentity();
setOpenGLFlags();
- glDisable(GL_LIGHTING);
- glDisable(GL_FOG);
- glDisable(GL_COLOR_MATERIAL);
+ mglDisable(GL_LIGHTING);
+ mglDisable(GL_FOG);
+ mglDisable(GL_COLOR_MATERIAL);
glShadeModel(GL_FLAT);
@@ -926,10 +924,10 @@ void MobileOpenGLGraphics::beginDraw()
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
#ifndef ANDROID
- glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
- glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
- glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
- glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
+ mglHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
+ mglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
+ mglHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
+ mglHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
#endif
pushClipArea(Rect(0, 0, mRect.w, mRect.h));
@@ -966,7 +964,7 @@ SDL_Surface* MobileOpenGLGraphics::getScreenshot()
GLubyte *const buf = new GLubyte[lineSize];
// Grap the pixel buffer and write it to the SDL surface
- glGetIntegerv(GL_PACK_ALIGNMENT, &pack);
+ mglGetIntegerv(GL_PACK_ALIGNMENT, &pack);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, screenshot->pixels);
@@ -1020,7 +1018,7 @@ void MobileOpenGLGraphics::pushClipArea(const Rect &area)
glTranslatef(static_cast<GLfloat>(transX),
static_cast<GLfloat>(transY), 0);
}
- glScissor(clipArea.x * mScale,
+ mglScissor(clipArea.x * mScale,
(mRect.h - clipArea.y - clipArea.height) * mScale,
clipArea.width * mScale,
clipArea.height * mScale);
@@ -1048,7 +1046,7 @@ void MobileOpenGLGraphics::popClipArea()
glTranslatef(static_cast<GLfloat>(transX),
static_cast<GLfloat>(transY), 0);
}
- glScissor(clipArea.x * mScale,
+ mglScissor(clipArea.x * mScale,
(mRect.h - clipArea.y - clipArea.height) * mScale,
clipArea.width * mScale,
clipArea.height * mScale);
@@ -1101,14 +1099,14 @@ void MobileOpenGLGraphics::setTexturingAndBlending(const bool enable)
{
if (!mTexture)
{
- glEnable(OpenGLImageHelper::mTextureType);
+ mglEnable(OpenGLImageHelper::mTextureType);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
mTexture = true;
}
if (!mAlpha)
{
- glEnable(GL_BLEND);
+ mglEnable(GL_BLEND);
mAlpha = true;
}
}
@@ -1117,18 +1115,18 @@ void MobileOpenGLGraphics::setTexturingAndBlending(const bool enable)
mTextureBinded = 0;
if (mAlpha && !mColorAlpha)
{
- glDisable(GL_BLEND);
+ mglDisable(GL_BLEND);
mAlpha = false;
}
else if (!mAlpha && mColorAlpha)
{
- glEnable(GL_BLEND);
+ mglEnable(GL_BLEND);
mAlpha = true;
}
if (mTexture)
{
- glDisable(OpenGLImageHelper::mTextureType);
+ mglDisable(OpenGLImageHelper::mTextureType);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
mTexture = false;
}
@@ -1163,7 +1161,7 @@ void MobileOpenGLGraphics::drawRectangle(const Rect& rect,
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
else
{
@@ -1179,7 +1177,7 @@ void MobileOpenGLGraphics::drawRectangle(const Rect& rect,
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_LINE_LOOP, 0, 4);
+ mglDrawArrays(GL_LINE_LOOP, 0, 4);
}
BLOCK_END("Graphics::drawRectangle")
}
@@ -1243,7 +1241,7 @@ void MobileOpenGLGraphics::bindTexture(const GLenum target,
if (mTextureBinded != texture)
{
mTextureBinded = texture;
- glBindTexture(target, texture);
+ mglBindTexture(target, texture);
}
}
@@ -1255,7 +1253,7 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfs(const int size)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLES, 0, size / 2);
+ mglDrawArrays(GL_TRIANGLES, 0, size / 2);
}
inline void MobileOpenGLGraphics::drawTriangleArrayfsCached(const int size)
@@ -1266,7 +1264,7 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfsCached(const int size)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLES, 0, size / 2);
+ mglDrawArrays(GL_TRIANGLES, 0, size / 2);
}
inline void MobileOpenGLGraphics::drawTriangleArrayfs(const GLshort *const
@@ -1281,7 +1279,7 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfs(const GLshort *const
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLES, 0, size / 2);
+ mglDrawArrays(GL_TRIANGLES, 0, size / 2);
}
inline void MobileOpenGLGraphics::drawLineArrays(const int size)
@@ -1291,7 +1289,7 @@ inline void MobileOpenGLGraphics::drawLineArrays(const int size)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_LINES, 0, size / 2);
+ mglDrawArrays(GL_LINES, 0, size / 2);
}
void MobileOpenGLGraphics::dumpSettings()
@@ -1305,7 +1303,7 @@ void MobileOpenGLGraphics::dumpSettings()
test[1] = 0;
test[2] = 0;
test[3] = 0;
- glGetIntegerv(f, &test[0]);
+ mglGetIntegerv(f, &test[0]);
if (test[0] || test[1] || test[2] || test[3])
{
logger->log("\n%d = %d, %d, %d, %d", f,
@@ -1354,7 +1352,9 @@ void MobileOpenGLGraphics::calcImageRect(ImageVertexes *const vert,
void MobileOpenGLGraphics::clearScreen() const
{
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ mglClear(GL_COLOR_BUFFER_BIT |
+ GL_DEPTH_BUFFER_BIT |
+ GL_STENCIL_BUFFER_BIT);
}
#ifdef DEBUG_BIND_TEXTURE
diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp
index 8bfe30200..1e07810ed 100644
--- a/src/render/modernopenglgraphics.cpp
+++ b/src/render/modernopenglgraphics.cpp
@@ -283,7 +283,7 @@ void ModernOpenGLGraphics::drawQuad(const int srcX, const int srcY,
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
void ModernOpenGLGraphics::drawRescaledQuad(const int srcX, const int srcY,
@@ -311,7 +311,7 @@ void ModernOpenGLGraphics::drawRescaledQuad(const int srcX, const int srcY,
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
void ModernOpenGLGraphics::drawImage(const Image *const image,
@@ -368,7 +368,7 @@ void ModernOpenGLGraphics::testDraw()
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
// glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, 0);
}
@@ -580,7 +580,7 @@ inline void ModernOpenGLGraphics::drawVertexes(const
mDrawCalls ++;
#endif
// logger->log("draw from array: %u", *ivbo);
- glDrawArrays(GL_TRIANGLES, 0, *ivp / 4);
+ mglDrawArrays(GL_TRIANGLES, 0, *ivp / 4);
}
}
@@ -833,16 +833,14 @@ void ModernOpenGLGraphics::updateScreen()
if (isGLNotNull(mglFrameTerminator))
mglFrameTerminator();
#endif
-// may be need clear?
-// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
BLOCK_END("Graphics::updateScreen")
}
void ModernOpenGLGraphics::beginDraw()
{
setOpenGLFlags();
- glDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
- glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB, GL_FASTEST);
+ mglDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
+ mglHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB, GL_FASTEST);
pushClipArea(Rect(0, 0, mRect.w, mRect.h));
}
@@ -877,7 +875,7 @@ SDL_Surface* ModernOpenGLGraphics::getScreenshot()
GLubyte *const buf = new GLubyte[lineSize];
// Grap the pixel buffer and write it to the SDL surface
- glGetIntegerv(GL_PACK_ALIGNMENT, &pack);
+ mglGetIntegerv(GL_PACK_ALIGNMENT, &pack);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, screenshot->pixels);
@@ -913,7 +911,7 @@ void ModernOpenGLGraphics::pushClipArea(const Rect &area)
Graphics::pushClipArea(area);
const ClipRect &clipArea = mClipStack.top();
- glScissor(clipArea.x * mScale,
+ mglScissor(clipArea.x * mScale,
(mRect.h - clipArea.y - clipArea.height) * mScale,
clipArea.width * mScale,
clipArea.height * mScale);
@@ -928,7 +926,7 @@ void ModernOpenGLGraphics::popClipArea()
return;
const ClipRect &clipArea = mClipStack.top();
- glScissor(clipArea.x * mScale,
+ mglScissor(clipArea.x * mScale,
(mRect.h - clipArea.y - clipArea.height) * mScale,
clipArea.width * mScale,
clipArea.height * mScale);
@@ -949,7 +947,7 @@ void ModernOpenGLGraphics::drawPoint(int x, int y)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_POINTS, 0, 1);
+ mglDrawArrays(GL_POINTS, 0, 1);
}
void ModernOpenGLGraphics::drawLine(int x1, int y1, int x2, int y2)
@@ -968,7 +966,7 @@ void ModernOpenGLGraphics::drawLine(int x1, int y1, int x2, int y2)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_LINES, 0, 2);
+ mglDrawArrays(GL_LINES, 0, 2);
}
void ModernOpenGLGraphics::drawRectangle(const Rect& rect)
@@ -994,7 +992,7 @@ void ModernOpenGLGraphics::drawRectangle(const Rect& rect)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_LINE_LOOP, 0, 4);
+ mglDrawArrays(GL_LINE_LOOP, 0, 4);
}
void ModernOpenGLGraphics::fillRectangle(const Rect& rect)
@@ -1020,7 +1018,7 @@ void ModernOpenGLGraphics::fillRectangle(const Rect& rect)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
void ModernOpenGLGraphics::setTexturingAndBlending(const bool enable)
@@ -1034,7 +1032,7 @@ void ModernOpenGLGraphics::setTexturingAndBlending(const bool enable)
}
if (!mAlpha)
{
- glEnable(GL_BLEND);
+ mglEnable(GL_BLEND);
mAlpha = true;
}
}
@@ -1047,12 +1045,12 @@ void ModernOpenGLGraphics::setTexturingAndBlending(const bool enable)
}
if (mAlpha && !mColorAlpha)
{
- glDisable(GL_BLEND);
+ mglDisable(GL_BLEND);
mAlpha = false;
}
else if (!mAlpha && mColorAlpha)
{
- glEnable(GL_BLEND);
+ mglEnable(GL_BLEND);
mAlpha = true;
}
}
@@ -1131,7 +1129,7 @@ void ModernOpenGLGraphics::bindTexture(const GLenum target,
if (mTextureBinded != texture)
{
mTextureBinded = texture;
- glBindTexture(target, texture);
+ mglBindTexture(target, texture);
}
}
@@ -1226,7 +1224,7 @@ void ModernOpenGLGraphics::dumpSettings()
test[1] = 0;
test[2] = 0;
test[3] = 0;
- glGetIntegerv(f, &test[0]);
+ mglGetIntegerv(f, &test[0]);
if (test[0] || test[1] || test[2] || test[3])
{
logger->log("\n%d = %d, %d, %d, %d", f,
@@ -1252,7 +1250,9 @@ void ModernOpenGLGraphics::calcImageRect(ImageVertexes *const vert,
void ModernOpenGLGraphics::clearScreen() const
{
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ mglClear(GL_COLOR_BUFFER_BIT |
+ GL_DEPTH_BUFFER_BIT |
+ GL_STENCIL_BUFFER_BIT);
}
void ModernOpenGLGraphics::createGLContext()
@@ -1324,7 +1324,7 @@ void ModernOpenGLGraphics::drawTriangleArray(const int size)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLES, 0, size / 4);
+ mglDrawArrays(GL_TRIANGLES, 0, size / 4);
}
void ModernOpenGLGraphics::drawTriangleArray(const GLint *const array,
@@ -1336,7 +1336,7 @@ void ModernOpenGLGraphics::drawTriangleArray(const GLint *const array,
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_TRIANGLES, 0, size / 4);
+ mglDrawArrays(GL_TRIANGLES, 0, size / 4);
}
void ModernOpenGLGraphics::drawLineArrays(const int size)
@@ -1347,7 +1347,7 @@ void ModernOpenGLGraphics::drawLineArrays(const int size)
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
- glDrawArrays(GL_LINES, 0, size / 4);
+ mglDrawArrays(GL_LINES, 0, size / 4);
}
#ifdef DEBUG_BIND_TEXTURE
diff --git a/src/render/naclglfunctions.h b/src/render/naclglfunctions.h
index 310343283..83757f07c 100644
--- a/src/render/naclglfunctions.h
+++ b/src/render/naclglfunctions.h
@@ -88,6 +88,16 @@ extern PP_Resource gles2Context;
gles2Interface->CreateProgram(gles2Context)
#define mglGetProgramInfoLog(...) \
gles2Interface->GetProgramInfoLog(gles2Context, __VA_ARGS__)
+#define mglDisable(...) \
+ gles2Interface->Disable(gles2Context, __VA_ARGS__)
+#define mglHint(...) \
+ gles2Interface->Hint(gles2Context, __VA_ARGS__)
+#define mglScissor(...) \
+ gles2Interface->Scissor(gles2Context, __VA_ARGS__)
+#define mglEnable(...) \
+ gles2Interface->Enable(gles2Context, __VA_ARGS__)
+#define mglGetIntegerv(...) \
+ gles2Interface->GetIntegerv(gles2Context, __VA_ARGS__)
#endif // defined(__native_client__) && defined(USE_OPENGL)
#endif // RENDER_NACLGLFUNCTIONS_H