fix Linux build
This commit is contained in:
@@ -40,7 +40,7 @@ void SimpleResizeCallback( float width, float height)
|
||||
{
|
||||
gApp->m_instancingRenderer->resize(width,height);
|
||||
gApp->m_primRenderer->setScreenSize(width,height);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static GLuint BindFont(const CTexFont *_Font)
|
||||
@@ -76,7 +76,7 @@ SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height)
|
||||
ci.m_width = width;
|
||||
ci.m_height = height;
|
||||
m_window->createWindow(ci);
|
||||
|
||||
|
||||
m_window->setWindowTitle(title);
|
||||
glClearColor(1,1,1,1);
|
||||
m_window->startRendering();
|
||||
@@ -85,7 +85,7 @@ SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height)
|
||||
#endif
|
||||
|
||||
m_primRenderer = new GLPrimitiveRenderer(width,height);
|
||||
|
||||
|
||||
m_instancingRenderer = new GLInstancingRenderer(128*1024,4*1024*1024);
|
||||
m_instancingRenderer->init();
|
||||
m_instancingRenderer->resize(width,height);
|
||||
@@ -103,7 +103,7 @@ SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height)
|
||||
|
||||
{
|
||||
GLint err;
|
||||
|
||||
|
||||
int datasize;
|
||||
|
||||
float sx,sy,dx,dy,lh;
|
||||
@@ -141,25 +141,25 @@ struct sth_stash* SimpleOpenGL3App::getFontStash()
|
||||
|
||||
void SimpleOpenGL3App::drawText( const char* txt, int posX, int posY)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
//printf("str = %s\n",unicodeText);
|
||||
|
||||
float dx=0;
|
||||
|
||||
|
||||
int measureOnly=0;
|
||||
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
||||
|
||||
if (1)//m_useTrueTypeFont)
|
||||
{
|
||||
bool measureOnly = false;
|
||||
|
||||
|
||||
float fontSize= 64;//512;//128;
|
||||
sth_draw_text(m_data->m_fontStash,
|
||||
m_data->m_droidRegular,fontSize,posX,posY,
|
||||
@@ -173,13 +173,13 @@ void SimpleOpenGL3App::drawText( const char* txt, int posX, int posY)
|
||||
float color[]={0.2f,0.2,0.2f,1.f};
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D,m_data->m_fontTextureId);
|
||||
|
||||
|
||||
//float width = r.x;
|
||||
float extraSpacing = 0.;
|
||||
|
||||
int startX = posX;
|
||||
int startY = posY;
|
||||
|
||||
|
||||
|
||||
while (txt[pos])
|
||||
{
|
||||
@@ -191,7 +191,7 @@ void SimpleOpenGL3App::drawText( const char* txt, int posX, int posY)
|
||||
//Gwen::Rect rect = r;
|
||||
//Translate( rect );
|
||||
|
||||
|
||||
|
||||
float currentColor[]={0.2f,0.2,0.2f,1.f};
|
||||
|
||||
m_primRenderer->drawTexturedRect(startX, startY, endX, endY, currentColor,g_DefaultNormalFont->m_CharU0[c],g_DefaultNormalFont->m_CharV0[c],g_DefaultNormalFont->m_CharU1[c],g_DefaultNormalFont->m_CharV1[c]);
|
||||
@@ -201,24 +201,27 @@ void SimpleOpenGL3App::drawText( const char* txt, int posX, int posY)
|
||||
|
||||
startX = endX;
|
||||
//startY = endY;
|
||||
|
||||
|
||||
pos++;
|
||||
|
||||
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D,0);
|
||||
}
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
int SimpleOpenGL3App::registerCubeShape(float halfExtentsX,float halfExtentsY, float halfExtentsZ)
|
||||
{
|
||||
struct GfxVertex
|
||||
|
||||
struct GfxVertex
|
||||
{
|
||||
float x,y,z,w;
|
||||
float nx,ny,nz;
|
||||
float u,v;
|
||||
};
|
||||
|
||||
|
||||
int SimpleOpenGL3App::registerCubeShape(float halfExtentsX,float halfExtentsY, float halfExtentsZ)
|
||||
{
|
||||
|
||||
|
||||
int strideInBytes = 9*sizeof(float);
|
||||
int numVertices = sizeof(cube_vertices)/strideInBytes;
|
||||
int numIndices = sizeof(cube_indices)/sizeof(int);
|
||||
@@ -237,7 +240,7 @@ int SimpleOpenGL3App::registerCubeShape(float halfExtentsX,float halfExtentsY, f
|
||||
verts[i].u = cube_vertices[i*9+7];
|
||||
verts[i].v = cube_vertices[i*9+8];
|
||||
}
|
||||
|
||||
|
||||
int shapeId = m_instancingRenderer->registerShape(&verts[0].x,numVertices,cube_indices,numIndices);
|
||||
return shapeId;
|
||||
}
|
||||
@@ -245,11 +248,11 @@ int SimpleOpenGL3App::registerCubeShape(float halfExtentsX,float halfExtentsY, f
|
||||
|
||||
int SimpleOpenGL3App::registerGraphicsSphereShape(float radius, bool usePointSprites, int largeSphereThreshold, int mediumSphereThreshold)
|
||||
{
|
||||
|
||||
|
||||
int strideInBytes = 9*sizeof(float);
|
||||
|
||||
|
||||
int graphicsShapeIndex = -1;
|
||||
|
||||
|
||||
if (radius>=largeSphereThreshold)
|
||||
{
|
||||
int numVertices = sizeof(detailed_sphere_vertices)/strideInBytes;
|
||||
@@ -257,7 +260,7 @@ int SimpleOpenGL3App::registerGraphicsSphereShape(float radius, bool usePointSpr
|
||||
graphicsShapeIndex = m_instancingRenderer->registerShape(&detailed_sphere_vertices[0],numVertices,detailed_sphere_indices,numIndices);
|
||||
} else
|
||||
{
|
||||
|
||||
|
||||
if (usePointSprites)
|
||||
{
|
||||
int numVertices = sizeof(point_sphere_vertices)/strideInBytes;
|
||||
@@ -283,22 +286,22 @@ int SimpleOpenGL3App::registerGraphicsSphereShape(float radius, bool usePointSpr
|
||||
|
||||
void SimpleOpenGL3App::drawGrid(int gridSize, float yOffset)
|
||||
{
|
||||
|
||||
|
||||
b3Vector3 gridColor = b3MakeVector3(0.5,0.5,0.5);
|
||||
for(int i=-gridSize;i<=gridSize;i++)
|
||||
{
|
||||
|
||||
|
||||
GLint err = glGetError();
|
||||
b3Assert(err==GL_NO_ERROR);
|
||||
|
||||
|
||||
m_instancingRenderer->drawLine(b3MakeVector3(float(i),yOffset,float(-gridSize)),b3MakeVector3(float(i),yOffset,float(gridSize)),gridColor);
|
||||
|
||||
|
||||
err = glGetError();
|
||||
b3Assert(err==GL_NO_ERROR);
|
||||
|
||||
|
||||
m_instancingRenderer->drawLine(b3MakeVector3(float(-gridSize),yOffset,float(i)),b3MakeVector3(float(gridSize),yOffset,float(i)),gridColor);
|
||||
}
|
||||
|
||||
|
||||
m_instancingRenderer->drawLine(b3MakeVector3(0,0,0),b3MakeVector3(1,0,0),b3MakeVector3(1,0,0),3);
|
||||
m_instancingRenderer->drawLine(b3MakeVector3(0,0,0),b3MakeVector3(0,1,0),b3MakeVector3(0,1,0),3);
|
||||
m_instancingRenderer->drawLine(b3MakeVector3(0,0,0),b3MakeVector3(0,0,1),b3MakeVector3(0,0,1),3);
|
||||
@@ -327,4 +330,4 @@ void SimpleOpenGL3App::swapBuffer()
|
||||
{
|
||||
m_window->endRendering();
|
||||
m_window->startRendering();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user