ManaPlus
Macros | Functions | Variables
openglgraphicsdef.hpp File Reference

(986a3bf)

Go to the source code of this file.

Macros

#define RENDER_OPENGLGRAPHICSDEF_HPP
 

Functions

void drawRectangle (const Rect &restrict rect, const bool filled) restrict2
 
void drawNet (const int x1, const int y1, const int x2, const int y2, const int width, const int height) restrict2 override final
 
static void dumpSettings ()
 
int getMemoryUsage () restrict2 A_WARN_UNUSED
 
void updateTextureFormat () restrict2
 
bool isAllowScale () const restrict2 noexcept 2 override final
 
void clearScreen () const restrict2 override final
 
void deleteArrays () restrict2 override final
 
static void bindTexture (const GLenum target, const GLuint texture)
 
void enableTexturingAndBlending () restrict2
 
void disableTexturingAndBlending () restrict2
 
void setColorAlpha (const float alpha) restrict2 A_INLINE
 
void restoreColor () restrict2 A_INLINE
 

Variables

static GLuint mTextureBinded = 0U
 

Macro Definition Documentation

◆ RENDER_OPENGLGRAPHICSDEF_HPP

#define RENDER_OPENGLGRAPHICSDEF_HPP

Definition at line 24 of file openglgraphicsdef.hpp.

Function Documentation

◆ bindTexture()

static void bindTexture ( const GLenum  target,
const GLuint  texture 
)
static

◆ clearScreen()

void clearScreen ( ) const
finaloverride

◆ deleteArrays()

void deleteArrays ( )
finaloverride

◆ disableTexturingAndBlending()

void SafeOpenGLGraphics::disableTexturingAndBlending ( )
protected

Definition at line 1055 of file mobileopengl2graphics.cpp.

1056 {
1057  if (mTextureDraw)
1058  {
1059  mTextureDraw = false;
1060  mglUniform1f(mDrawTypeUniform, 0.0F);
1061  }
1062  if (mAlpha && !mColorAlpha)
1063  {
1064  mglDisable(GL_BLEND);
1065  mAlpha = false;
1066  }
1067  else if (!mAlpha && mColorAlpha)
1068  {
1069  mglEnable(GL_BLEND);
1070  mAlpha = true;
1071  }
1072 }
#define mglDisable(...)
Definition: mgl.hpp:85
#define mglEnable(...)
Definition: mgl.hpp:91

References Graphics::mAlpha, MobileOpenGL2Graphics::mColorAlpha, MobileOpenGL2Graphics::mDrawTypeUniform, mglDisable, mglEnable, and MobileOpenGL2Graphics::mTextureDraw.

◆ drawNet()

void drawNet ( const int  x1,
const int  y1,
const int  x2,
const int  y2,
const int  width,
const int  height 
)
finaloverride

◆ drawRectangle()

void drawRectangle ( const Rect &restrict  rect,
const bool  filled 
)

◆ dumpSettings()

void NullOpenGLGraphics::dumpSettings ( )
static

Definition at line 1223 of file mobileopengl2graphics.cpp.

1224 {
1225  GLint test[1000];
1226  logger->log("\n\n");
1227  logger->log("start opengl dump");
1228  for (int f = 0; f < 65535; f ++)
1229  {
1230  test[0] = 0;
1231  test[1] = 0;
1232  test[2] = 0;
1233  test[3] = 0;
1234  mglGetIntegerv(f, &test[0]);
1235  if (test[0] != 0 || test[1] != 0 || test[2] != 0 || test[3] != 0)
1236  {
1237  logger->log("\n%d = %d, %d, %d, %d", f,
1238  test[0], test[1], test[2], test[3]);
1239  }
1240  }
1241 }
void log(const char *const log_text,...)
Definition: logger.cpp:269
Logger * logger
Definition: logger.cpp:89
#define mglGetIntegerv(...)
Definition: mgl.hpp:95

References Logger::log(), logger, and mglGetIntegerv.

◆ enableTexturingAndBlending()

void SafeOpenGLGraphics::enableTexturingAndBlending ( )
protected

Definition at line 1041 of file mobileopengl2graphics.cpp.

1042 {
1043  if (!mTextureDraw)
1044  {
1045  mTextureDraw = true;
1046  mglUniform1f(mDrawTypeUniform, 1.0F);
1047  }
1048  if (!mAlpha)
1049  {
1050  mglEnable(GL_BLEND);
1051  mAlpha = true;
1052  }
1053 }

References Graphics::mAlpha, MobileOpenGL2Graphics::mDrawTypeUniform, mglEnable, and MobileOpenGL2Graphics::mTextureDraw.

◆ getMemoryUsage()

int getMemoryUsage ( )

◆ isAllowScale()

bool isAllowScale ( ) const
finaloverridenoexcept

Definition at line 40 of file openglgraphicsdef.hpp.

41  { return true; }

Referenced by Graphics::setScale().

◆ restoreColor()

void SafeOpenGLGraphics::restoreColor ( )
inlineprivate

Definition at line 1324 of file mobileopenglgraphics.cpp.

1325 {
1326  if (mIsByteColor && mByteColor == mColor)
1327  return;
1328 
1329  glColor4ub(static_cast<GLubyte>(mColor.r),
1330  static_cast<GLubyte>(mColor.g),
1331  static_cast<GLubyte>(mColor.b),
1332  static_cast<GLubyte>(mColor.a));
1333  mIsByteColor = true;
1334  mByteColor = mColor;
1335 }

References Color::a, Color::b, Color::g, MobileOpenGLGraphics::mByteColor, Graphics::mColor, MobileOpenGLGraphics::mIsByteColor, and Color::r.

◆ setColorAlpha()

void SafeOpenGLGraphics::setColorAlpha ( const float  alpha)
inlineprivate

Definition at line 269 of file mobileopengl2graphics.cpp.

270 {
271  if (mAlphaCached != alpha)
272  {
273  mAlphaCached = alpha;
274  mglUniform1f(mTextureColorUniform, alpha);
275  }
276 }

◆ updateTextureFormat()

void updateTextureFormat ( )

Variable Documentation

◆ mTextureBinded

GLuint SafeOpenGLGraphics::mTextureBinded = 0U
static

Definition at line 49 of file openglgraphicsdef.hpp.

Referenced by MobileOpenGL2Graphics::bindTexture2().