ManaPlus
Public Member Functions | Private Attributes
NormalOpenGLGraphics Class Reference

#include <normalopenglgraphics.h>

Inheritance diagram for NormalOpenGLGraphics:
Graphics

Public Member Functions

 NormalOpenGLGraphics ()
 
 ~NormalOpenGLGraphics ()
 
void drawQuadArrayfi (const int size) A_INLINE
 
void drawQuadArrayfiCached (const int size) A_INLINE
 
void drawQuadArrayfi (const GLint *const intVertArray, const GLfloat *const floatTexArray, const int size) A_INLINE
 
void drawQuadArrayii (const int size) A_INLINE
 
void drawQuadArrayiiCached (const int size) A_INLINE
 
void drawQuadArrayii (const GLint *const intVertArray, const GLint *const intTexArray, const int size) A_INLINE
 
void drawLineArrayi (const int size) A_INLINE
 
void drawLineArrayf (const int size) A_INLINE
 
void testDraw ()
 
- Public Member Functions inherited from Graphics
virtual ~Graphics ()
 
void setWindow (SDL_Surface *const window, const int width, const int height)
 
SDL_Surface * getWindow () const
 
void setSync (const bool sync)
 
bool getSync () const
 
virtual bool setVideoMode (const int w, const int h, const int scale, const int bpp, const bool fs, const bool hwaccel, const bool resize, const bool noFrame, const bool allowHighDPI)=0
 
bool setFullscreen (const bool fs)
 
virtual bool resizeScreen (const int width, const int height)
 
virtual void restoreContext ()
 
virtual void drawRescaledImage (const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight)=0
 
virtual void drawPattern (const Image *const image, const int x, const int y, const int w, const int h)=0
 
virtual void drawRescaledPattern (const Image *const image, const int x, const int y, const int w, const int h, const int scaledWidth, const int scaledHeight)=0
 
virtual void drawImageRect (const int x, const int y, const int w, const int h, const ImageRect &imgRect)=0
 
virtual void calcPattern (ImageVertexes *const vert, const Image *const image, const int x, const int y, const int w, const int h) const =0
 
virtual void calcPattern (ImageCollection *const vert, const Image *const image, const int x, const int y, const int w, const int h) const =0
 
virtual void calcTileVertexes (ImageVertexes *const vert, const Image *const image, int x, int y) const =0
 
virtual void calcTileSDL (ImageVertexes *const vert, int x, int y) const
 
virtual void drawTileVertexes (const ImageVertexes *const vert)=0
 
virtual void drawTileCollection (const ImageCollection *const vertCol)=0
 
virtual void calcTileCollection (ImageCollection *const vertCol, const Image *const image, int x, int y)=0
 
virtual void calcWindow (ImageCollection *const vertCol, const int x, const int y, const int w, const int h, const ImageRect &imgRect)=0
 
virtual void fillRectangle (const Rect &rectangle)=0
 
virtual void updateScreen ()=0
 
void setWindowSize (const int width, const int height)
 
int getWidth () const
 
int getHeight () const
 
int getMemoryUsage () const
 
virtual void drawNet (const int x1, const int y1, const int x2, const int y2, const int width, const int height)
 
ClipRectgetTopClip () const
 
void setRedraw (const bool n)
 
bool getRedraw () const
 
void setSecure (const bool n)
 
bool getSecure () const
 
int getBpp () const
 
bool getFullScreen () const
 
bool getHWAccel () const
 
bool getDoubleBuffer () const
 
RenderType getOpenGL () const
 
void setNoFrame (const bool n)
 
const std::string & getName () const
 
virtual void initArrays (const int vertCount)
 
virtual void setColor (const Color &color)
 
const ColorgetColor () const
 
virtual void drawImage (const Image *const image, int dstX, int dstY)=0
 
virtual void copyImage (const Image *const image, int dstX, int dstY)=0
 
virtual void drawImageCached (const Image *const image, int srcX, int srcY)=0
 
virtual void drawPatternCached (const Image *const image, const int x, const int y, const int w, const int h)=0
 
virtual void completeCache ()=0
 
int getScale () const
 
virtual bool isAllowScale () const
 
void setScale (int scale)
 
virtual void pushClipArea (const Rect &area)
 
virtual void popClipArea ()
 
virtual void drawLine (int x1, int y1, int x2, int y2)=0
 
virtual void drawRectangle (const Rect &rectangle)=0
 
virtual void createGLContext (const bool custom)
 
virtual void drawPoint (int x, int y)=0
 
virtual void beginDraw ()
 
virtual void endDraw ()
 
virtual void clearScreen () const
 
virtual void deleteArrays ()
 
virtual void postInit ()
 
virtual void finalize (ImageCollection *const col)
 
virtual void finalize (ImageVertexes *const vert)
 
virtual void removeArray (const uint32_t sz, uint32_t *const arr)
 
virtual void screenResized ()
 

Private Attributes

GLfloat * mFloatTexArray
 
GLint * mIntTexArray
 
GLint * mIntVertArray
 
GLfloat * mFloatTexArrayCached
 
GLint * mIntTexArrayCached
 
GLint * mIntVertArrayCached
 
float mAlphaCached
 
int mVpCached
 
bool mTexture
 
bool mIsByteColor
 
Color mByteColor
 
GLuint mImageCached
 
float mFloatColor
 
int mMaxVertices
 
bool mColorAlpha
 
FBOInfo mFbo
 

Additional Inherited Members

- Public Types inherited from Graphics
enum  Alignment { LEFT = 0 , CENTER , RIGHT }
 
- Static Public Member Functions inherited from Graphics
static void cleanUp ()
 
- Data Fields inherited from Graphics
int mWidth
 
int mHeight
 
int mActualWidth
 
int mActualHeight
 
- Protected Member Functions inherited from Graphics
 Graphics ()
 
void setMainFlags (const int w, const int h, const int scale, const int bpp, const bool fs, const bool hwaccel, const bool resize, const bool noFrame, const bool allowHighDPI)
 
int getOpenGLFlags () const
 
int getSoftwareFlags () const
 
bool setOpenGLMode ()
 
void updateMemoryInfo ()
 
bool videoInfo ()
 
void setOpenGLFlags ()
 
- Protected Attributes inherited from Graphics
MStack< ClipRectmClipStack
 
SDL_Surface * mWindow
 
int mBpp
 
bool mAlpha
 
bool mFullscreen
 
bool mHWAccel
 
bool mRedraw
 
bool mDoubleBuffer
 
SDL_Rect mRect
 
bool mSecure
 
RenderType mOpenGL
 
bool mEnableResize
 
bool mNoFrame
 
bool mAllowHighDPI
 
std::string mName
 
int mStartFreeMem
 
bool mSync
 
int mScale
 
Color mColor
 
- Static Protected Attributes inherited from Graphics
static void * mGLContext = 0
 

Detailed Description

Definition at line 64 of file normalopenglgraphics.h.

Constructor & Destructor Documentation

◆ NormalOpenGLGraphics()

NormalOpenGLGraphics::NormalOpenGLGraphics ( )

Definition at line 100 of file normalopenglgraphics.cpp.

100  :
101  mFloatTexArray(nullptr),
102  mIntTexArray(nullptr),
103  mIntVertArray(nullptr),
104  mFloatTexArrayCached(nullptr),
105  mIntTexArrayCached(nullptr),
106  mIntVertArrayCached(nullptr),
107  mAlphaCached(1.0F),
108  mVpCached(0),
109  mTexture(false),
110  mIsByteColor(false),
111  mByteColor(),
112  mImageCached(0),
113  mFloatColor(1.0F),
114  mMaxVertices(500),
115  mColorAlpha(false),
116 #ifdef DEBUG_BIND_TEXTURE
117  mOldTexture(),
118  mOldTextureId(0),
119 #endif // DEBUG_BIND_TEXTURE
120  mFbo()
121 {
123  mName = "normal OpenGL";
124 }
RenderType mOpenGL
Definition: graphics.h:545
std::string mName
Definition: graphics.h:549
@ RENDER_NORMAL_OPENGL
Definition: rendertype.h:28

References Graphics::mName, Graphics::mOpenGL, and RENDER_NORMAL_OPENGL.

◆ ~NormalOpenGLGraphics()

NormalOpenGLGraphics::~NormalOpenGLGraphics ( )

Definition at line 126 of file normalopenglgraphics.cpp.

127 {
129 }
void deleteArraysInternal() restrict2

References deleteArraysInternal().

Member Function Documentation

◆ drawLineArrayf()

void NormalOpenGLGraphics::drawLineArrayf ( const int  size)
inline

Definition at line 1679 of file normalopenglgraphics.cpp.

1680 {
1681  glVertexPointer(2, GL_FLOAT, 0, mFloatTexArray);
1682  vertPtr = nullptr;
1683 #ifdef DEBUG_DRAW_CALLS
1684  mDrawCalls ++;
1685 #endif // DEBUG_DRAW_CALLS
1686 
1687  glDrawArrays(GL_LINES, 0, size / 2);
1688 #ifdef OPENGLERRORS
1690 #endif // OPENGLERRORS
1691 }
static void logError()
GraphicsManager graphicsManager
int size()
Definition: emotedb.cpp:306

References graphicsManager, GraphicsManager::logError(), EmoteDB::size(), and anonymous_namespace{normalopenglgraphics.cpp}::vertPtr.

◆ drawLineArrayi()

void NormalOpenGLGraphics::drawLineArrayi ( const int  size)
inline

Definition at line 1665 of file normalopenglgraphics.cpp.

1666 {
1667  glVertexPointer(2, GL_INT, 0, mIntVertArray);
1668  vertPtr = nullptr;
1669 #ifdef DEBUG_DRAW_CALLS
1670  mDrawCalls ++;
1671 #endif // DEBUG_DRAW_CALLS
1672 
1673  glDrawArrays(GL_LINES, 0, size / 2);
1674 #ifdef OPENGLERRORS
1676 #endif // OPENGLERRORS
1677 }

References graphicsManager, GraphicsManager::logError(), EmoteDB::size(), and anonymous_namespace{normalopenglgraphics.cpp}::vertPtr.

◆ drawQuadArrayfi() [1/2]

void NormalOpenGLGraphics::drawQuadArrayfi ( const GLint *const  intVertArray,
const GLfloat *const  floatTexArray,
const int  size 
)
inline

Definition at line 1600 of file normalopenglgraphics.cpp.

1605 {
1606  vertPtr = intVertArray;
1607  glVertexPointer(2, GL_INT, 0, intVertArray);
1608  glTexCoordPointer(2, GL_FLOAT, 0, floatTexArray);
1609 #ifdef DEBUG_DRAW_CALLS
1610  mDrawCalls ++;
1611 #endif // DEBUG_DRAW_CALLS
1612 
1613  glDrawArrays(GL_QUADS, 0, size / 2);
1614 #ifdef OPENGLERRORS
1616 #endif // OPENGLERRORS
1617 }

References graphicsManager, GraphicsManager::logError(), EmoteDB::size(), and anonymous_namespace{normalopenglgraphics.cpp}::vertPtr.

◆ drawQuadArrayfi() [2/2]

void NormalOpenGLGraphics::drawQuadArrayfi ( const int  size)
inline

Definition at line 1573 of file normalopenglgraphics.cpp.

1574 {
1576 #ifdef DEBUG_DRAW_CALLS
1577  mDrawCalls ++;
1578 #endif // DEBUG_DRAW_CALLS
1579 
1580  glDrawArrays(GL_QUADS, 0, size / 2);
1581 #ifdef OPENGLERRORS
1583 #endif // OPENGLERRORS
1584 }
static void bindPointerIntFloat(const GLint *const vert, const GLfloat *const tex) A_INLINE

References bindPointerIntFloat(), graphicsManager, GraphicsManager::logError(), and EmoteDB::size().

◆ drawQuadArrayfiCached()

void NormalOpenGLGraphics::drawQuadArrayfiCached ( const int  size)
inline

Definition at line 1586 of file normalopenglgraphics.cpp.

1588 {
1590 #ifdef DEBUG_DRAW_CALLS
1591  mDrawCalls ++;
1592 #endif // DEBUG_DRAW_CALLS
1593 
1594  glDrawArrays(GL_QUADS, 0, size / 2);
1595 #ifdef OPENGLERRORS
1597 #endif // OPENGLERRORS
1598 }

References bindPointerIntFloat(), graphicsManager, GraphicsManager::logError(), and EmoteDB::size().

◆ drawQuadArrayii() [1/2]

void NormalOpenGLGraphics::drawQuadArrayii ( const GLint *const  intVertArray,
const GLint *const  intTexArray,
const int  size 
)
inline

Definition at line 1646 of file normalopenglgraphics.cpp.

1651 {
1652  vertPtr = intVertArray;
1653  glVertexPointer(2, GL_INT, 0, intVertArray);
1654  glTexCoordPointer(2, GL_INT, 0, intTexArray);
1655 #ifdef DEBUG_DRAW_CALLS
1656  mDrawCalls ++;
1657 #endif // DEBUG_DRAW_CALLS
1658 
1659  glDrawArrays(GL_QUADS, 0, size / 2);
1660 #ifdef OPENGLERRORS
1662 #endif // OPENGLERRORS
1663 }

References graphicsManager, GraphicsManager::logError(), EmoteDB::size(), and anonymous_namespace{normalopenglgraphics.cpp}::vertPtr.

◆ drawQuadArrayii() [2/2]

void NormalOpenGLGraphics::drawQuadArrayii ( const int  size)
inline

Definition at line 1619 of file normalopenglgraphics.cpp.

1620 {
1622 #ifdef DEBUG_DRAW_CALLS
1623  mDrawCalls ++;
1624 #endif // DEBUG_DRAW_CALLS
1625 
1626  glDrawArrays(GL_QUADS, 0, size / 2);
1627 #ifdef OPENGLERRORS
1629 #endif // OPENGLERRORS
1630 }
static void bindPointerInt(const GLint *const vert, const GLint *const tex) A_INLINE

References bindPointerInt(), graphicsManager, GraphicsManager::logError(), and EmoteDB::size().

◆ drawQuadArrayiiCached()

void NormalOpenGLGraphics::drawQuadArrayiiCached ( const int  size)
inline

Definition at line 1632 of file normalopenglgraphics.cpp.

1634 {
1636 #ifdef DEBUG_DRAW_CALLS
1637  mDrawCalls ++;
1638 #endif // DEBUG_DRAW_CALLS
1639 
1640  glDrawArrays(GL_QUADS, 0, size / 2);
1641 #ifdef OPENGLERRORS
1643 #endif // OPENGLERRORS
1644 }

References bindPointerInt(), graphicsManager, GraphicsManager::logError(), and EmoteDB::size().

◆ testDraw()

void NormalOpenGLGraphics::testDraw ( )
virtual

Reimplemented from Graphics.

Definition at line 415 of file normalopenglgraphics.cpp.

416 {
417  if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D)
418  {
419  GLfloat tex[] =
420  {
421  0.0F, 0.781250F,
422  0.0F, 0.781250F,
423  0.0F, 0.585938F,
424  0.0F, 0.585938F
425  };
426 
427  GLint vert[] =
428  {
429  0, 0,
430  800, 0,
431  800, 600,
432  0, 600
433  };
434 
435  bindPointerIntFloat(&vert[0], &tex[0]);
436 #ifdef DEBUG_DRAW_CALLS
437  NormalOpenGLGraphics::mDrawCalls ++;
438 #endif // DEBUG_DRAW_CALLS
439 
440  glDrawArrays(GL_QUADS, 0, 4);
441 #ifdef OPENGLERRORS
443 #endif // OPENGLERRORS
444  }
445  else
446  {
447  GLint tex[] =
448  {
449  0, 0,
450  800, 0,
451  800, 600,
452  0, 600
453  };
454 
455  GLint vert[] =
456  {
457  0, 0,
458  800, 0,
459  800, 600,
460  0, 600
461  };
462 
463  bindPointerInt(&vert[0], &tex[0]);
464 #ifdef DEBUG_DRAW_CALLS
465  NormalOpenGLGraphics::mDrawCalls ++;
466 #endif // DEBUG_DRAW_CALLS
467 
468  glDrawArrays(GL_QUADS, 0, 4);
469 #ifdef OPENGLERRORS
471 #endif // OPENGLERRORS
472  }
473 }

References bindPointerInt(), bindPointerIntFloat(), graphicsManager, GraphicsManager::logError(), and OpenGLImageHelper::mTextureType.

Field Documentation

◆ mAlphaCached

float NormalOpenGLGraphics::mAlphaCached
private

Definition at line 120 of file normalopenglgraphics.h.

◆ mByteColor

Color NormalOpenGLGraphics::mByteColor
private

Definition at line 125 of file normalopenglgraphics.h.

◆ mColorAlpha

bool NormalOpenGLGraphics::mColorAlpha
private

Definition at line 129 of file normalopenglgraphics.h.

◆ mFbo

FBOInfo NormalOpenGLGraphics::mFbo
private

Definition at line 137 of file normalopenglgraphics.h.

◆ mFloatColor

float NormalOpenGLGraphics::mFloatColor
private

Definition at line 127 of file normalopenglgraphics.h.

◆ mFloatTexArray

GLfloat* NormalOpenGLGraphics::mFloatTexArray
private

Definition at line 114 of file normalopenglgraphics.h.

◆ mFloatTexArrayCached

GLfloat* NormalOpenGLGraphics::mFloatTexArrayCached
private

Definition at line 117 of file normalopenglgraphics.h.

◆ mImageCached

GLuint NormalOpenGLGraphics::mImageCached
private

Definition at line 126 of file normalopenglgraphics.h.

◆ mIntTexArray

GLint* NormalOpenGLGraphics::mIntTexArray
private

Definition at line 115 of file normalopenglgraphics.h.

◆ mIntTexArrayCached

GLint* NormalOpenGLGraphics::mIntTexArrayCached
private

Definition at line 118 of file normalopenglgraphics.h.

◆ mIntVertArray

GLint* NormalOpenGLGraphics::mIntVertArray
private

Definition at line 116 of file normalopenglgraphics.h.

◆ mIntVertArrayCached

GLint* NormalOpenGLGraphics::mIntVertArrayCached
private

Definition at line 119 of file normalopenglgraphics.h.

◆ mIsByteColor

bool NormalOpenGLGraphics::mIsByteColor
private

Definition at line 124 of file normalopenglgraphics.h.

◆ mMaxVertices

int NormalOpenGLGraphics::mMaxVertices
private

Definition at line 128 of file normalopenglgraphics.h.

◆ mTexture

bool NormalOpenGLGraphics::mTexture
private

Definition at line 122 of file normalopenglgraphics.h.

◆ mVpCached

int NormalOpenGLGraphics::mVpCached
private

Definition at line 121 of file normalopenglgraphics.h.


The documentation for this class was generated from the following files: