mirror of
https://github.com/leozide/leocad
synced 2024-11-17 07:47:55 +01:00
Fixed camera name not drawing correctly.
This commit is contained in:
parent
72a9b9fc45
commit
f001916a05
4 changed files with 15 additions and 13 deletions
|
@ -145,7 +145,7 @@ void lcContext::CreateShaderPrograms()
|
|||
"}\n",
|
||||
// LC_PROGRAM_TEXTURE
|
||||
"#version 110\n"
|
||||
"in vec2 PixelTexCoord;\n"
|
||||
"varying vec2 PixelTexCoord;\n"
|
||||
"uniform sampler2D Texture;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
|
@ -153,7 +153,7 @@ void lcContext::CreateShaderPrograms()
|
|||
"}\n",
|
||||
// LC_PROGRAM_VERTEX_COLOR
|
||||
"#version 110\n"
|
||||
"in vec4 PixelColor;\n"
|
||||
"varying vec4 PixelColor;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor = PixelColor;\n"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "lc_global.h"
|
||||
#include <string.h>
|
||||
#include "texfont.h"
|
||||
#include "lc_context.h"
|
||||
|
||||
static const unsigned char TextureData[2048] =
|
||||
{
|
||||
|
@ -175,7 +176,7 @@ void TexFont::GetStringDimensions(int* cx, int* cy, const char* Text) const
|
|||
}
|
||||
}
|
||||
|
||||
void TexFont::PrintText(float Left, float Top, float Z, const char* Text) const
|
||||
void TexFont::PrintText(lcContext* Context, float Left, float Top, float Z, const char* Text) const
|
||||
{
|
||||
int Length = strlen(Text);
|
||||
|
||||
|
@ -217,13 +218,12 @@ void TexFont::PrintText(float Left, float Top, float Z, const char* Text) const
|
|||
Text++;
|
||||
}
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, 5 * sizeof(float), Verts);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, 5 * sizeof(float), Verts + 3);
|
||||
Context->SetVertexBufferPointer(Verts);
|
||||
Context->SetVertexFormat(0, 3, 2, 0);
|
||||
|
||||
glDrawArrays(GL_QUADS, 0, 4 * Length);
|
||||
Context->DrawPrimitives(GL_QUADS, 0, 4 * Length);
|
||||
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
Context->ClearVertexBuffer(); // context remove
|
||||
|
||||
delete[] Verts;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
bool Load();
|
||||
void Release();
|
||||
|
||||
void PrintText(float Left, float Top, float Z, const char* Text) const;
|
||||
void PrintText(lcContext* Context, float Left, float Top, float Z, const char* Text) const;
|
||||
void GetGlyphQuad(float Left, float Top, float Z, int Glyph, float* Buffer) const;
|
||||
void GetStringDimensions(int* cx, int* cy, const char* Text) const;
|
||||
|
||||
|
|
|
@ -986,7 +986,7 @@ void View::DrawRotateOverlay()
|
|||
break;
|
||||
};
|
||||
|
||||
lcMatrix44 WorldMatrix = lcMul(RelativeRotation, lcMatrix44Translation(OverlayCenter));
|
||||
lcMatrix44 WorldMatrix = lcMul(RelativeRotation, lcMatrix44Translation(OverlayCenter));
|
||||
WorldMatrix = lcMul(lcMatrix44FromAxisAngle(lcVector3(Rotation[1], Rotation[2], Rotation[3]), Rotation[0] * LC_DTOR), WorldMatrix);
|
||||
mContext->SetWorldMatrix(WorldMatrix);
|
||||
|
||||
|
@ -1033,7 +1033,7 @@ void View::DrawRotateOverlay()
|
|||
gTexFont.GetStringDimensions(&cx, &cy, buf);
|
||||
|
||||
mContext->SetColor(0.8f, 0.8f, 0.0f, 1.0f);
|
||||
gTexFont.PrintText(ScreenPos[0] - (cx / 2), ScreenPos[1] + (cy / 2), 0.0f, buf);
|
||||
gTexFont.PrintText(mContext, ScreenPos[0] - (cx / 2), ScreenPos[1] + (cy / 2), 0.0f, buf);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
@ -1461,7 +1461,6 @@ void View::DrawAxes()
|
|||
|
||||
void View::DrawViewport()
|
||||
{
|
||||
mContext->SetProgram(LC_PROGRAM_SIMPLE);
|
||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
||||
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
||||
mContext->SetProjectionMatrix(lcMatrix44Ortho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f));
|
||||
|
@ -1472,6 +1471,7 @@ void View::DrawViewport()
|
|||
|
||||
if (gMainWindow->GetActiveView() == this)
|
||||
{
|
||||
mContext->SetProgram(LC_PROGRAM_SIMPLE);
|
||||
mContext->SetColor(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
float Verts[8] = { 0.0f, 0.0f, mWidth - 1.0f, 0.0f, mWidth - 1.0f, mHeight - 1.0f, 0.0f, mHeight - 1.0f };
|
||||
|
||||
|
@ -1486,14 +1486,16 @@ void View::DrawViewport()
|
|||
|
||||
if (CameraName[0])
|
||||
{
|
||||
mContext->SetProgram(LC_PROGRAM_TEXTURE);
|
||||
mContext->SetColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
gTexFont.MakeCurrent();
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
gTexFont.PrintText(3.0f, (float)mHeight - 1.0f - 6.0f, 0.0f, CameraName);
|
||||
gTexFont.PrintText(mContext, 3.0f, (float)mHeight - 1.0f - 6.0f, 0.0f, CameraName);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
|
Loading…
Reference in a new issue