simplify RENDER_TEXT logic
class RenderTextLabel for text rendering * consider texture alpha channel during rendering of shaders with qer_trans
This commit is contained in:
parent
4bc399fe56
commit
58eb6e61d2
|
|
@ -53,8 +53,8 @@ const unsigned int RENDER_TEXTURE = 1 << 18; // glEnable(GL_TEXTURE_2D)
|
||||||
const unsigned int RENDER_BUMP = 1 << 19;
|
const unsigned int RENDER_BUMP = 1 << 19;
|
||||||
const unsigned int RENDER_PROGRAM = 1 << 20;
|
const unsigned int RENDER_PROGRAM = 1 << 20;
|
||||||
const unsigned int RENDER_SCREEN = 1 << 21;
|
const unsigned int RENDER_SCREEN = 1 << 21;
|
||||||
const unsigned int RENDER_TEXT = 1 << 22;
|
const unsigned int RENDER_TEXT = 1 << 22; // override: globalstate |= RENDER_TEXTURE | RENDER_BLEND | RENDER_FILL
|
||||||
const unsigned int RENDER_OVERRIDE = 1 << 23;
|
const unsigned int RENDER_OVERRIDE = 1 << 23; // override: globalstate |= RENDER_FILL
|
||||||
typedef unsigned int RenderStateFlags;
|
typedef unsigned int RenderStateFlags;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,16 +26,16 @@
|
||||||
#include <pango/pango-utils.h>
|
#include <pango/pango-utils.h>
|
||||||
|
|
||||||
|
|
||||||
void gray_to_texture( const int x_max, const int y_max, const unsigned char *in, unsigned char *out, const unsigned int fontColorR, const unsigned int fontColorG, const unsigned int fontColorB ){ /* normal with shadow */
|
void gray_to_texture( const unsigned int x_max, const unsigned int y_max, const unsigned char *in, unsigned char *out, const unsigned char fontColorR, const unsigned char fontColorG, const unsigned char fontColorB ){ /* normal with shadow */
|
||||||
int x, y, bitmapIter = 0;
|
unsigned int x, y, bitmapIter = 0;
|
||||||
|
|
||||||
const unsigned int backgroundColorR = 0;
|
const unsigned char backgroundColorR = 0;
|
||||||
const unsigned int backgroundColorG = 0;
|
const unsigned char backgroundColorG = 0;
|
||||||
const unsigned int backgroundColorB = 0;
|
const unsigned char backgroundColorB = 0;
|
||||||
|
|
||||||
for( y = 0; y < y_max; y++ ) {
|
for( y = 0; y < y_max; y++ ) {
|
||||||
for( x = 0; x < x_max; x++ ) {
|
for( x = 0; x < x_max; x++ ) {
|
||||||
int iter = ( y * x_max + x ) * 4;
|
const unsigned int iter = ( y * x_max + x ) * 4;
|
||||||
if( x == 0 || y == 0 || x == 1 || y == 1 ) {
|
if( x == 0 || y == 0 || x == 1 || y == 1 ) {
|
||||||
out[iter] = fontColorB;
|
out[iter] = fontColorB;
|
||||||
out[iter + 1] = fontColorG;
|
out[iter + 1] = fontColorG;
|
||||||
|
|
@ -62,7 +62,7 @@ void gray_to_texture( const int x_max, const int y_max, const unsigned char *in,
|
||||||
bitmapIter = 0;
|
bitmapIter = 0;
|
||||||
for( y = 0; y < y_max; y++ ) {
|
for( y = 0; y < y_max; y++ ) {
|
||||||
for( x = 0; x < x_max; x++ ) {
|
for( x = 0; x < x_max; x++ ) {
|
||||||
int iter = ( y * x_max + x ) * 4;
|
const unsigned int iter = ( y * x_max + x ) * 4;
|
||||||
if( x == 0 || y == 0 || x == ( x_max - 1 ) || y == ( y_max - 1 ) ) {
|
if( x == 0 || y == 0 || x == ( x_max - 1 ) || y == ( y_max - 1 ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -75,8 +75,8 @@ void gray_to_texture( const int x_max, const int y_max, const unsigned char *in,
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
/* Calculate alpha (opacity). */
|
/* Calculate alpha (opacity). */
|
||||||
float opacityFont = in[bitmapIter] / 255.f;
|
const float opacityFont = in[bitmapIter] / 255.f;
|
||||||
float opacityBack = out[iter + 3] / 255.f;
|
const float opacityBack = out[iter + 3] / 255.f;
|
||||||
out[iter] = fontColorB * opacityFont + ( 1 - opacityFont ) * backgroundColorB;
|
out[iter] = fontColorB * opacityFont + ( 1 - opacityFont ) * backgroundColorB;
|
||||||
out[iter + 1] = fontColorG * opacityFont + ( 1 - opacityFont ) * backgroundColorG;
|
out[iter + 1] = fontColorG * opacityFont + ( 1 - opacityFont ) * backgroundColorG;
|
||||||
out[iter + 2] = fontColorR * opacityFont + ( 1 - opacityFont ) * backgroundColorR;
|
out[iter + 2] = fontColorR * opacityFont + ( 1 - opacityFont ) * backgroundColorR;
|
||||||
|
|
@ -114,7 +114,7 @@ void printString( const char *s ){
|
||||||
GlobalOpenGL().m_glCallLists( GLsizei( strlen( s ) ), GL_UNSIGNED_BYTE, reinterpret_cast<const GLubyte*>( s ) );
|
GlobalOpenGL().m_glCallLists( GLsizei( strlen( s ) ), GL_UNSIGNED_BYTE, reinterpret_cast<const GLubyte*>( s ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderString( const char *s, const GLuint& tex, const unsigned int colour[3], int& wid, int& hei ){
|
void renderString( const char *s, const GLuint& tex, const unsigned char colour[3], unsigned int& wid, unsigned int& hei ){
|
||||||
if( !m_ft2_context || m_pixelHeight == 0 ){
|
if( !m_ft2_context || m_pixelHeight == 0 ){
|
||||||
wid = hei = 0;
|
wid = hei = 0;
|
||||||
return;
|
return;
|
||||||
|
|
@ -132,7 +132,7 @@ void renderString( const char *s, const GLuint& tex, const unsigned int colour[3
|
||||||
if ( log_rect.width > 0 && log_rect.height > 0 ) {
|
if ( log_rect.width > 0 && log_rect.height > 0 ) {
|
||||||
hei = bitmap.rows = PANGO_PIXELS_CEIL( log_rect.height );//m_pixelAscent + m_pixelDescent;
|
hei = bitmap.rows = PANGO_PIXELS_CEIL( log_rect.height );//m_pixelAscent + m_pixelDescent;
|
||||||
wid = bitmap.width = PANGO_PIXELS_CEIL( log_rect.width );
|
wid = bitmap.width = PANGO_PIXELS_CEIL( log_rect.width );
|
||||||
// globalOutputStream() << width << " " << height << " rendering\n";
|
// globalOutputStream() << wid << " " << hei << " rendering\n";
|
||||||
bitmap.pitch = bitmap.width;
|
bitmap.pitch = bitmap.width;
|
||||||
unsigned char *boo = (unsigned char *) malloc( bitmap.rows * bitmap.width );
|
unsigned char *boo = (unsigned char *) malloc( bitmap.rows * bitmap.width );
|
||||||
memset( boo, 0, bitmap.rows * bitmap.width );
|
memset( boo, 0, bitmap.rows * bitmap.width );
|
||||||
|
|
@ -181,22 +181,21 @@ void renderString( const char *s, const GLuint& tex, const unsigned int colour[3
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if( withfond ){ /* with background rectangle */
|
if( withfond ){ /* with background rectangle */
|
||||||
int x_max = wid;
|
const unsigned int x_max = wid;
|
||||||
int y_max = hei;
|
const unsigned int y_max = hei;
|
||||||
int x, y, bitmapIter = 0;
|
unsigned int x, y, bitmapIter = 0;
|
||||||
|
|
||||||
unsigned int fontColorR = 255;
|
const unsigned char fontColorR = 255;
|
||||||
unsigned int fontColorG = 255;
|
const unsigned char fontColorG = 255;
|
||||||
unsigned int fontColorB = 0;
|
const unsigned char fontColorB = 0;
|
||||||
|
|
||||||
unsigned int backgroundColorR = 64;
|
const unsigned char backgroundColorR = 64;
|
||||||
unsigned int backgroundColorG = 64;
|
const unsigned char backgroundColorG = 64;
|
||||||
unsigned int backgroundColorB = 64;
|
const unsigned char backgroundColorB = 64;
|
||||||
float opacity;
|
|
||||||
|
|
||||||
for( y = 0; y < y_max; y++ ) {
|
for( y = 0; y < y_max; y++ ) {
|
||||||
for( x = 0; x < x_max; x++ ) {
|
for( x = 0; x < x_max; x++ ) {
|
||||||
int iter = ( y * x_max + x ) * 4;
|
const unsigned int iter = ( y * x_max + x ) * 4;
|
||||||
if( x == 0 || y == 0 || x == ( x_max - 1 ) || y == ( y_max - 1 ) ) {
|
if( x == 0 || y == 0 || x == ( x_max - 1 ) || y == ( y_max - 1 ) ) {
|
||||||
buf[iter] = backgroundColorB;
|
buf[iter] = backgroundColorB;
|
||||||
buf[iter + 1] = backgroundColorG;
|
buf[iter + 1] = backgroundColorG;
|
||||||
|
|
@ -213,7 +212,7 @@ void renderString( const char *s, const GLuint& tex, const unsigned int colour[3
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Calculate alpha (opacity). */
|
/* Calculate alpha (opacity). */
|
||||||
opacity = bitmap.buffer[bitmapIter] / 255.f;
|
const float opacity = bitmap.buffer[bitmapIter] / 255.f;
|
||||||
buf[iter] = fontColorB * opacity + ( 1 - opacity ) * backgroundColorB;
|
buf[iter] = fontColorB * opacity + ( 1 - opacity ) * backgroundColorB;
|
||||||
buf[iter + 1] = fontColorG * opacity + ( 1 - opacity ) * backgroundColorG;
|
buf[iter + 1] = fontColorG * opacity + ( 1 - opacity ) * backgroundColorG;
|
||||||
buf[iter + 2] = fontColorR * opacity + ( 1 - opacity ) * backgroundColorR;
|
buf[iter + 2] = fontColorR * opacity + ( 1 - opacity ) * backgroundColorR;
|
||||||
|
|
@ -225,24 +224,24 @@ void renderString( const char *s, const GLuint& tex, const unsigned int colour[3
|
||||||
}
|
}
|
||||||
#elif 0
|
#elif 0
|
||||||
if( 1 ){ /* normal with shadow */
|
if( 1 ){ /* normal with shadow */
|
||||||
int x_max = wid;
|
const unsigned int x_max = wid;
|
||||||
int y_max = hei;
|
const unsigned int y_max = hei;
|
||||||
int x, y, bitmapIter = 0;
|
unsigned int x, y, bitmapIter = 0;
|
||||||
|
|
||||||
// unsigned int fontColorR = 255;
|
// unsigned char fontColorR = 255;
|
||||||
// unsigned int fontColorG = 255;
|
// unsigned char fontColorG = 255;
|
||||||
// unsigned int fontColorB = 0;
|
// unsigned char fontColorB = 0;
|
||||||
unsigned int fontColorR = colour[0];
|
unsigned char fontColorR = colour[0];
|
||||||
unsigned int fontColorG = colour[1];
|
unsigned char fontColorG = colour[1];
|
||||||
unsigned int fontColorB = colour[2];
|
unsigned char fontColorB = colour[2];
|
||||||
|
|
||||||
unsigned int backgroundColorR = 0;
|
unsigned char backgroundColorR = 0;
|
||||||
unsigned int backgroundColorG = 0;
|
unsigned char backgroundColorG = 0;
|
||||||
unsigned int backgroundColorB = 0;
|
unsigned char backgroundColorB = 0;
|
||||||
|
|
||||||
for( y = 0; y < y_max; y++ ) {
|
for( y = 0; y < y_max; y++ ) {
|
||||||
for( x = 0; x < x_max; x++ ) {
|
for( x = 0; x < x_max; x++ ) {
|
||||||
int iter = ( y * x_max + x ) * 4;
|
const unsigned int iter = ( y * x_max + x ) * 4;
|
||||||
if( x == 0 || y == 0 || x == 1 || y == 1 ) {
|
if( x == 0 || y == 0 || x == 1 || y == 1 ) {
|
||||||
buf[iter] = fontColorB;
|
buf[iter] = fontColorB;
|
||||||
buf[iter + 1] = fontColorG;
|
buf[iter + 1] = fontColorG;
|
||||||
|
|
@ -269,7 +268,7 @@ void renderString( const char *s, const GLuint& tex, const unsigned int colour[3
|
||||||
bitmapIter = 0;
|
bitmapIter = 0;
|
||||||
for( y = 0; y < y_max; y++ ) {
|
for( y = 0; y < y_max; y++ ) {
|
||||||
for( x = 0; x < x_max; x++ ) {
|
for( x = 0; x < x_max; x++ ) {
|
||||||
int iter = ( y * x_max + x ) * 4;
|
const unsigned int iter = ( y * x_max + x ) * 4;
|
||||||
if( x == 0 || y == 0 || x == ( x_max - 1 ) || y == ( y_max - 1 ) ) {
|
if( x == 0 || y == 0 || x == ( x_max - 1 ) || y == ( y_max - 1 ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -282,8 +281,8 @@ void renderString( const char *s, const GLuint& tex, const unsigned int colour[3
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
/* Calculate alpha (opacity). */
|
/* Calculate alpha (opacity). */
|
||||||
float opacityFont = bitmap.buffer[bitmapIter] / 255.f;
|
const float opacityFont = bitmap.buffer[bitmapIter] / 255.f;
|
||||||
float opacityBack = buf[iter + 3] / 255.f;
|
const float opacityBack = buf[iter + 3] / 255.f;
|
||||||
buf[iter] = fontColorB * opacityFont + ( 1 - opacityFont ) * backgroundColorB;
|
buf[iter] = fontColorB * opacityFont + ( 1 - opacityFont ) * backgroundColorB;
|
||||||
buf[iter + 1] = fontColorG * opacityFont + ( 1 - opacityFont ) * backgroundColorG;
|
buf[iter + 1] = fontColorG * opacityFont + ( 1 - opacityFont ) * backgroundColorG;
|
||||||
buf[iter + 2] = fontColorR * opacityFont + ( 1 - opacityFont ) * backgroundColorR;
|
buf[iter + 2] = fontColorR * opacityFont + ( 1 - opacityFont ) * backgroundColorR;
|
||||||
|
|
@ -295,20 +294,20 @@ void renderString( const char *s, const GLuint& tex, const unsigned int colour[3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{ /* normal */
|
else{ /* normal */
|
||||||
int x_max = wid;
|
const unsigned int x_max = wid;
|
||||||
int y_max = hei;
|
const unsigned int y_max = hei;
|
||||||
int x, y, bitmapIter = 0;
|
unsigned int x, y, bitmapIter = 0;
|
||||||
|
|
||||||
// unsigned int fontColorR = 0;
|
// unsigned char fontColorR = 0;
|
||||||
// unsigned int fontColorG = 255;
|
// unsigned char fontColorG = 255;
|
||||||
// unsigned int fontColorB = 0;
|
// unsigned char fontColorB = 0;
|
||||||
unsigned int fontColorR = colour[0];
|
unsigned char fontColorR = colour[0];
|
||||||
unsigned int fontColorG = colour[1];
|
unsigned char fontColorG = colour[1];
|
||||||
unsigned int fontColorB = colour[2];
|
unsigned char fontColorB = colour[2];
|
||||||
|
|
||||||
for( y = 0; y < y_max; y++ ) {
|
for( y = 0; y < y_max; y++ ) {
|
||||||
for( x = 0; x < x_max; x++ ) {
|
for( x = 0; x < x_max; x++ ) {
|
||||||
int iter = ( y * x_max + x ) * 4;
|
const unsigned int iter = ( y * x_max + x ) * 4;
|
||||||
if( x == 0 || y == 0 || x == ( x_max - 1 ) || y == ( y_max - 1 ) ) {
|
if( x == 0 || y == 0 || x == ( x_max - 1 ) || y == ( y_max - 1 ) ) {
|
||||||
buf[iter] = fontColorB;
|
buf[iter] = fontColorB;
|
||||||
buf[iter + 1] = fontColorG;
|
buf[iter + 1] = fontColorG;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ virtual int getPixelHeight() const = 0;
|
||||||
virtual int getPixelAscent() const = 0;
|
virtual int getPixelAscent() const = 0;
|
||||||
virtual int getPixelDescent() const = 0;
|
virtual int getPixelDescent() const = 0;
|
||||||
virtual void printString( const char *s ) = 0;
|
virtual void printString( const char *s ) = 0;
|
||||||
virtual void renderString( const char *s, const GLuint& tex, const unsigned int colour[3], int& wid, int& hei ) = 0;
|
virtual void renderString( const char *s, const GLuint& tex, const unsigned char colour[3], unsigned int& wid, unsigned int& hei ) = 0;
|
||||||
virtual ~GLFont(){
|
virtual ~GLFont(){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1256,6 +1256,68 @@ inline void ArbitraryMeshTriangle_sumTangents( ArbitraryMeshVertex& a, Arbitrary
|
||||||
reinterpret_cast<Vector3&>( c.bitangent ) += t;
|
reinterpret_cast<Vector3&>( c.bitangent ) += t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class RenderTextLabel
|
||||||
|
{
|
||||||
|
unsigned int width;
|
||||||
|
unsigned int height;
|
||||||
|
public:
|
||||||
|
GLuint tex = 0;
|
||||||
|
Vector2 screenPos;
|
||||||
|
~RenderTextLabel(){
|
||||||
|
texFree();
|
||||||
|
}
|
||||||
|
void texAlloc( const char* text, const Vector3& color01 ){
|
||||||
|
glGenTextures( 1, &tex );
|
||||||
|
if( tex > 0 ){
|
||||||
|
const BasicVector3<unsigned char> colour = color01 * 255.f;
|
||||||
|
GlobalOpenGL().m_font->renderString( text, tex, colour.data(), width, height );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void texFree(){
|
||||||
|
if( tex > 0 ){
|
||||||
|
glDeleteTextures( 1, &tex );
|
||||||
|
tex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void render( unsigned int subTex ) const {
|
||||||
|
if( tex > 0 ){
|
||||||
|
glBindTexture( GL_TEXTURE_2D, tex );
|
||||||
|
//Here we draw the texturemaped quads.
|
||||||
|
//The bitmap that we got from FreeType was not
|
||||||
|
//oriented quite like we would like it to be,
|
||||||
|
//so we need to link the texture to the quad
|
||||||
|
//so that the result will be properly aligned.
|
||||||
|
#if 0
|
||||||
|
const float verts[4][2] = { { screenPos.x(), screenPos.y() },
|
||||||
|
{ screenPos.x(), screenPos.y() + height + .01f },
|
||||||
|
{ screenPos.x() + width + .01f, screenPos.y() + height + .01f },
|
||||||
|
{ screenPos.x() + width + .01f, screenPos.y() } };
|
||||||
|
const float coords[4][2] = { { subTex / 3.f, 1 },
|
||||||
|
{ subTex / 3.f, 0 },
|
||||||
|
{ ( subTex + 1 ) / 3.f, 0 },
|
||||||
|
{ ( subTex + 1 ) / 3.f, 1 } };
|
||||||
|
glVertexPointer( 2, GL_FLOAT, 0, verts );
|
||||||
|
glTexCoordPointer( 2, GL_FLOAT, 0, coords );
|
||||||
|
glDrawArrays( GL_QUADS, 0, 4 );
|
||||||
|
#else // this is faster :0
|
||||||
|
glBegin( GL_QUADS );
|
||||||
|
glTexCoord2f( subTex / 3.f, 1 );
|
||||||
|
glVertex2f( screenPos.x(), screenPos.y() );
|
||||||
|
glTexCoord2f( subTex / 3.f, 0 );
|
||||||
|
glVertex2f( screenPos.x(), screenPos.y() + height + .01f );
|
||||||
|
glTexCoord2f( ( subTex + 1 ) / 3.f, 0 );
|
||||||
|
glVertex2f( screenPos.x() + width + .01f, screenPos.y() + height + .01f );
|
||||||
|
glTexCoord2f( ( subTex + 1 ) / 3.f, 1 );
|
||||||
|
glVertex2f( screenPos.x() + width + .01f, screenPos.y() );
|
||||||
|
glEnd();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// check FBO completeness
|
// check FBO completeness
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ typedef MemberCaller1<NamedEntity, const char*, &NamedEntity::identifierChanged>
|
||||||
|
|
||||||
#include "renderable.h"
|
#include "renderable.h"
|
||||||
#include "cullable.h"
|
#include "cullable.h"
|
||||||
|
#include "render.h"
|
||||||
|
|
||||||
class RenderableNamedEntity : public OpenGLRenderable {
|
class RenderableNamedEntity : public OpenGLRenderable {
|
||||||
enum ENameMode{
|
enum ENameMode{
|
||||||
|
|
@ -103,80 +104,27 @@ class RenderableNamedEntity : public OpenGLRenderable {
|
||||||
|
|
||||||
NamedEntity& m_named;
|
NamedEntity& m_named;
|
||||||
const Vector3& m_position;
|
const Vector3& m_position;
|
||||||
GLuint m_tex;
|
mutable RenderTextLabel m_label;
|
||||||
int m_width;
|
const char* const m_exclude;
|
||||||
int m_height;
|
|
||||||
mutable float m_screenPos[2];
|
|
||||||
const char* m_exclude;
|
|
||||||
public:
|
public:
|
||||||
typedef Static<Shader*, RenderableNamedEntity> StaticShader;
|
typedef Static<Shader*, RenderableNamedEntity> StaticShader;
|
||||||
static Shader* getShader() {
|
static Shader* getShader() {
|
||||||
return StaticShader::instance();
|
return StaticShader::instance();
|
||||||
}
|
}
|
||||||
RenderableNamedEntity( NamedEntity& named, const Vector3& position, const char* exclude = 0 )
|
RenderableNamedEntity( NamedEntity& named, const Vector3& position, const char* exclude = 0 )
|
||||||
: m_named( named ), m_position( position ), m_tex( 0 ), m_exclude( exclude ) {
|
: m_named( named ), m_position( position ), m_exclude( exclude ) {
|
||||||
construct_textures( m_named.name() );
|
identifierChanged( m_named.name() );
|
||||||
m_named.attach( IdentifierChangedCaller( *this ) );
|
m_named.attach( IdentifierChangedCaller( *this ) );
|
||||||
}
|
}
|
||||||
bool excluded_not() const {
|
bool excluded_not() const {
|
||||||
return m_tex > 0;
|
return m_label.tex > 0;
|
||||||
}
|
|
||||||
private:
|
|
||||||
void construct_textures( const char* name ){
|
|
||||||
if( m_exclude && string_equal( m_exclude, name ) )
|
|
||||||
return;
|
|
||||||
glGenTextures( 1, &m_tex );
|
|
||||||
if( m_tex > 0 ) {
|
|
||||||
unsigned int colour[3];
|
|
||||||
colour[0] = static_cast<unsigned int>( m_named.color()[0] * 255.f );
|
|
||||||
colour[1] = static_cast<unsigned int>( m_named.color()[1] * 255.f );
|
|
||||||
colour[2] = static_cast<unsigned int>( m_named.color()[2] * 255.f );
|
|
||||||
GlobalOpenGL().m_font->renderString( name, m_tex, colour, m_width, m_height );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void delete_textures(){
|
|
||||||
glDeleteTextures( 1, &m_tex );
|
|
||||||
m_tex = 0;
|
|
||||||
}
|
|
||||||
void setMode( bool selected, bool childSelected ) const{
|
|
||||||
if( selected ){
|
|
||||||
m_nameMode = eNameSelected;
|
|
||||||
}
|
|
||||||
else if( childSelected ){
|
|
||||||
m_nameMode = eNameChildSelected;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
m_nameMode = eNameNormal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
void render( RenderStateFlags state ) const {
|
void render( RenderStateFlags state ) const {
|
||||||
if( m_tex > 0 ){
|
m_label.render( m_nameMode );
|
||||||
glBindTexture( GL_TEXTURE_2D, m_tex );
|
|
||||||
|
|
||||||
//Here we draw the texturemaped quads.
|
|
||||||
//The bitmap that we got from FreeType was not
|
|
||||||
//oriented quite like we would like it to be,
|
|
||||||
//so we need to link the texture to the quad
|
|
||||||
//so that the result will be properly aligned.
|
|
||||||
glBegin( GL_QUADS );
|
|
||||||
float xoffset0 = m_nameMode / 3.f;
|
|
||||||
float xoffset1 = ( m_nameMode + 1 ) / 3.f;
|
|
||||||
glTexCoord2f( xoffset0, 1 );
|
|
||||||
glVertex2f( m_screenPos[0], m_screenPos[1] );
|
|
||||||
glTexCoord2f( xoffset0, 0 );
|
|
||||||
glVertex2f( m_screenPos[0], m_screenPos[1] + m_height + .01f );
|
|
||||||
glTexCoord2f( xoffset1, 0 );
|
|
||||||
glVertex2f( m_screenPos[0] + m_width + .01f, m_screenPos[1] + m_height + .01f );
|
|
||||||
glTexCoord2f( xoffset1, 1 );
|
|
||||||
glVertex2f( m_screenPos[0] + m_width + .01f, m_screenPos[1] );
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void render( Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld, bool selected, bool childSelected = false ) const {
|
void render( Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld, bool selected, bool childSelected = false ) const {
|
||||||
setMode( selected, childSelected );
|
m_nameMode = selected? eNameSelected : childSelected? eNameChildSelected : eNameNormal;
|
||||||
|
|
||||||
if( volume.fill() ){
|
if( volume.fill() ){
|
||||||
const Matrix4& viewproj = volume.GetViewMatrix();
|
const Matrix4& viewproj = volume.GetViewMatrix();
|
||||||
|
|
@ -192,16 +140,16 @@ public:
|
||||||
matrix4_multiply_by_matrix4( object2screen, localToWorld );
|
matrix4_multiply_by_matrix4( object2screen, localToWorld );
|
||||||
matrix4_transform_vector4( object2screen, position );
|
matrix4_transform_vector4( object2screen, position );
|
||||||
// globalOutputStream() << position << " Projection\n";
|
// globalOutputStream() << position << " Projection\n";
|
||||||
position[0] /= position[3];
|
position.x() /= position.w();
|
||||||
position[1] /= position[3];
|
position.y() /= position.w();
|
||||||
position[2] /= position[3];
|
// position.z() /= position.w();
|
||||||
// globalOutputStream() << position << " Projection division\n";
|
// globalOutputStream() << position << " Projection division\n";
|
||||||
matrix4_transform_vector4( volume.GetViewport(), position );
|
matrix4_transform_vector4( volume.GetViewport(), position );
|
||||||
// globalOutputStream() << position << " Viewport\n";
|
// globalOutputStream() << position << " Viewport\n";
|
||||||
// globalOutputStream() << volume.GetViewport()[0] << " " << volume.GetViewport()[5] << " Viewport size\n";
|
// globalOutputStream() << volume.GetViewport()[0] << " " << volume.GetViewport()[5] << " Viewport size\n";
|
||||||
m_screenPos[0] = position[0];
|
m_label.screenPos.x() = position.x();
|
||||||
m_screenPos[1] = position[1];
|
m_label.screenPos.y() = position.y();
|
||||||
// globalOutputStream() << m_screenPos[0] << " " << m_screenPos[1] << "\n";
|
// globalOutputStream() << m_label.screenPos << "\n";
|
||||||
|
|
||||||
renderer.PushState();
|
renderer.PushState();
|
||||||
|
|
||||||
|
|
@ -216,11 +164,12 @@ public:
|
||||||
}
|
}
|
||||||
~RenderableNamedEntity(){
|
~RenderableNamedEntity(){
|
||||||
m_named.detach( IdentifierChangedCaller( *this ) );
|
m_named.detach( IdentifierChangedCaller( *this ) );
|
||||||
delete_textures();
|
|
||||||
}
|
}
|
||||||
void identifierChanged( const char* value ){
|
void identifierChanged( const char* value ){
|
||||||
delete_textures();
|
m_label.texFree();
|
||||||
construct_textures( value );
|
if( m_exclude && string_equal( m_exclude, value ) )
|
||||||
|
return;
|
||||||
|
m_label.texAlloc( value, m_named.color() );
|
||||||
}
|
}
|
||||||
typedef MemberCaller1<RenderableNamedEntity, const char*, &RenderableNamedEntity::identifierChanged> IdentifierChangedCaller;
|
typedef MemberCaller1<RenderableNamedEntity, const char*, &RenderableNamedEntity::identifierChanged> IdentifierChangedCaller;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -748,19 +748,12 @@ void Camera_motionDelta( int x, int y, unsigned int state, void* data ){
|
||||||
#define cam_draw_size_use_tex
|
#define cam_draw_size_use_tex
|
||||||
class CamDrawSize
|
class CamDrawSize
|
||||||
{
|
{
|
||||||
GLuint _texs[3];
|
|
||||||
int _widths[3];
|
|
||||||
int _heights[3];
|
|
||||||
Vector3 _extents;
|
Vector3 _extents;
|
||||||
|
RenderTextLabel m_labels[3];
|
||||||
public:
|
public:
|
||||||
CamDrawSize() : _extents( -99.9f, -99.9f, -99.9f ){
|
CamDrawSize() : _extents( -99.9f, -99.9f, -99.9f ){
|
||||||
_texs[0] = _texs[1] = _texs[2] = 0;
|
|
||||||
}
|
}
|
||||||
~CamDrawSize(){
|
void render( const AABB& bounds, const View& view ){
|
||||||
for( std::size_t i = 0; i < 3; ++i )
|
|
||||||
freeTex( _texs[i] );
|
|
||||||
}
|
|
||||||
void render( const AABB& bounds, const View view ){
|
|
||||||
setState();
|
setState();
|
||||||
|
|
||||||
Vector4 points[3] = { Vector4( bounds.origin - g_vector3_axes[1] * bounds.extents - g_vector3_axes[2] * bounds.extents, 1 ),
|
Vector4 points[3] = { Vector4( bounds.origin - g_vector3_axes[1] * bounds.extents - g_vector3_axes[2] * bounds.extents, 1 ),
|
||||||
|
|
@ -771,7 +764,7 @@ public:
|
||||||
matrix4_transform_vector4( view.GetViewMatrix(), points[i] );
|
matrix4_transform_vector4( view.GetViewMatrix(), points[i] );
|
||||||
points[i].x() /= points[i].w();
|
points[i].x() /= points[i].w();
|
||||||
points[i].y() /= points[i].w();
|
points[i].y() /= points[i].w();
|
||||||
points[i].z() /= points[i].w();
|
// points[i].z() /= points[i].w();
|
||||||
matrix4_transform_vector4( view.GetViewport(), points[i] );
|
matrix4_transform_vector4( view.GetViewport(), points[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -779,29 +772,10 @@ public:
|
||||||
if( points[i].w() > 0.005f ){
|
if( points[i].w() > 0.005f ){
|
||||||
#ifdef cam_draw_size_use_tex
|
#ifdef cam_draw_size_use_tex
|
||||||
updateTex( i, bounds.extents[i] );
|
updateTex( i, bounds.extents[i] );
|
||||||
if( _texs[i] > 0 ) {
|
m_labels[i].screenPos.x() = points[i].x();
|
||||||
glBindTexture( GL_TEXTURE_2D, _texs[i] );
|
m_labels[i].screenPos.y() = points[i].y();
|
||||||
|
m_labels[i].render( 0 );
|
||||||
//Here we draw the texturemaped quads.
|
|
||||||
//The bitmap that we got from FreeType was not
|
|
||||||
//oriented quite like we would like it to be,
|
|
||||||
//so we need to link the texture to the quad
|
|
||||||
//so that the result will be properly aligned.
|
|
||||||
glBegin( GL_QUADS );
|
|
||||||
const float xoffset0 = 0;
|
|
||||||
const float xoffset1 = 1.f / 3.f;
|
|
||||||
glTexCoord2f( xoffset0, 1 );
|
|
||||||
glVertex2f( points[i].x(), points[i].y() );
|
|
||||||
glTexCoord2f( xoffset0, 0 );
|
|
||||||
glVertex2f( points[i].x(), points[i].y() + _heights[i] + .01f );
|
|
||||||
glTexCoord2f( xoffset1, 0 );
|
|
||||||
glVertex2f( points[i].x() + _widths[i] + .01f, points[i].y() + _heights[i] + .01f );
|
|
||||||
glTexCoord2f( xoffset1, 1 );
|
|
||||||
glVertex2f( points[i].x() + _widths[i] + .01f, points[i].y() );
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
glBindTexture( GL_TEXTURE_2D, 0 );
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
StringOutputStream stream( 16 );
|
StringOutputStream stream( 16 );
|
||||||
stream << ( bounds.extents[i] * 2 );
|
stream << ( bounds.extents[i] * 2 );
|
||||||
|
|
@ -831,23 +805,11 @@ private:
|
||||||
}
|
}
|
||||||
void updateTex( const std::size_t i, const float extent ){
|
void updateTex( const std::size_t i, const float extent ){
|
||||||
if( extent != _extents[i] ){
|
if( extent != _extents[i] ){
|
||||||
freeTex( _texs[i] );
|
|
||||||
_extents[i] = extent;
|
_extents[i] = extent;
|
||||||
}
|
m_labels[i].texFree();
|
||||||
if( 0 == _texs[i] ){
|
|
||||||
glGenTextures( 1, &_texs[i] );
|
|
||||||
if( _texs[i] > 0 ){
|
|
||||||
StringOutputStream stream( 16 );
|
StringOutputStream stream( 16 );
|
||||||
stream << ( extent * 2 );
|
stream << ( extent * 2 );
|
||||||
BasicVector3<unsigned int> colour = getColor( i ) * 255.f;
|
m_labels[i].texAlloc( stream.c_str(), getColor( i ) );
|
||||||
GlobalOpenGL().m_font->renderString( stream.c_str(), _texs[i], colour.data(), _widths[i], _heights[i] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void freeTex( GLuint& tex ){
|
|
||||||
if( tex > 0 ){
|
|
||||||
glDeleteTextures( 1, &tex );
|
|
||||||
tex = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void setState() const {
|
void setState() const {
|
||||||
|
|
@ -859,7 +821,7 @@ private:
|
||||||
#endif
|
#endif
|
||||||
glDisable( GL_DEPTH_TEST );
|
glDisable( GL_DEPTH_TEST );
|
||||||
|
|
||||||
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||||
glDisableClientState( GL_NORMAL_ARRAY );
|
glDisableClientState( GL_NORMAL_ARRAY );
|
||||||
glDisableClientState( GL_COLOR_ARRAY );
|
glDisableClientState( GL_COLOR_ARRAY );
|
||||||
#ifdef cam_draw_size_use_tex
|
#ifdef cam_draw_size_use_tex
|
||||||
|
|
@ -2114,7 +2076,7 @@ void CamWnd::Cam_Draw(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int globalstate = RENDER_DEPTHTEST | RENDER_COLOURWRITE | RENDER_DEPTHWRITE | RENDER_ALPHATEST | RENDER_BLEND | RENDER_CULLFACE | RENDER_COLOURARRAY | RENDER_OFFSETLINE | RENDER_POLYGONSMOOTH | RENDER_LINESMOOTH | RENDER_FOG | RENDER_COLOURCHANGE | RENDER_TEXT;
|
unsigned int globalstate = RENDER_DEPTHTEST | RENDER_COLOURWRITE | RENDER_DEPTHWRITE | RENDER_ALPHATEST | RENDER_BLEND | RENDER_CULLFACE | RENDER_COLOURARRAY | RENDER_OFFSETLINE | RENDER_POLYGONSMOOTH | RENDER_LINESMOOTH | RENDER_FOG | RENDER_COLOURCHANGE;
|
||||||
switch ( m_Camera.draw_mode )
|
switch ( m_Camera.draw_mode )
|
||||||
{
|
{
|
||||||
case cd_wire:
|
case cd_wire:
|
||||||
|
|
|
||||||
|
|
@ -1314,7 +1314,7 @@ void render( RenderStateFlags globalstate, const Matrix4& modelview, const Matri
|
||||||
}
|
}
|
||||||
debug_string( "end rendering" );
|
debug_string( "end rendering" );
|
||||||
|
|
||||||
OpenGLState reset = current; /* popmatrix and reset stuff after RENDER_TEXT */
|
OpenGLState reset = current; /* popmatrix after RENDER_TEXT */
|
||||||
reset.m_state = current.m_state & ~RENDER_TEXT;
|
reset.m_state = current.m_state & ~RENDER_TEXT;
|
||||||
OpenGLState_apply( reset, current, globalstate );
|
OpenGLState_apply( reset, current, globalstate );
|
||||||
}
|
}
|
||||||
|
|
@ -1617,7 +1617,10 @@ void OpenGLState_apply( const OpenGLState& self, OpenGLState& current, unsigned
|
||||||
count_state();
|
count_state();
|
||||||
|
|
||||||
if ( self.m_state & RENDER_OVERRIDE ) {
|
if ( self.m_state & RENDER_OVERRIDE ) {
|
||||||
globalstate |= RENDER_FILL | RENDER_DEPTHWRITE;
|
globalstate |= RENDER_FILL;
|
||||||
|
}
|
||||||
|
if ( self.m_state & RENDER_TEXT ) {
|
||||||
|
globalstate |= RENDER_TEXTURE | RENDER_BLEND | RENDER_FILL | RENDER_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned int state = self.m_state & globalstate;
|
const unsigned int state = self.m_state & globalstate;
|
||||||
|
|
@ -1625,18 +1628,22 @@ void OpenGLState_apply( const OpenGLState& self, OpenGLState& current, unsigned
|
||||||
|
|
||||||
GlobalOpenGL_debugAssertNoErrors();
|
GlobalOpenGL_debugAssertNoErrors();
|
||||||
|
|
||||||
if ( delta & ~state & RENDER_TEXT ) { /* disabling in the beginning, so wont override other states */
|
if ( delta & state & RENDER_TEXT ) {
|
||||||
if ( GlobalOpenGL().GL_1_3() ) { ///~RENDER_TEXTURE
|
glMatrixMode( GL_PROJECTION );
|
||||||
glActiveTexture( GL_TEXTURE0 );
|
glPushMatrix();
|
||||||
glClientActiveTexture( GL_TEXTURE0 );
|
glLoadIdentity();
|
||||||
|
GLint viewprt[4];
|
||||||
|
glGetIntegerv( GL_VIEWPORT, viewprt );
|
||||||
|
//globalOutputStream() << viewprt[2] << " " << viewprt[3] << "\n";
|
||||||
|
glOrtho( 0, viewprt[2], 0, viewprt[3], -100, 100 );
|
||||||
|
glTranslated( double( viewprt[2] ) / 2.0, double( viewprt[3] ) / 2.0, 0 );
|
||||||
|
glMatrixMode( GL_MODELVIEW );
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
GlobalOpenGL_debugAssertNoErrors();
|
||||||
}
|
}
|
||||||
glDisable( GL_TEXTURE_2D );
|
else if ( delta & ~state & RENDER_TEXT ) {
|
||||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
|
||||||
|
|
||||||
glDisable( GL_BLEND ); ///~RENDER_BLEND
|
|
||||||
|
|
||||||
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); ///~RENDER_FILL
|
|
||||||
|
|
||||||
glMatrixMode( GL_PROJECTION );
|
glMatrixMode( GL_PROJECTION );
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glMatrixMode( GL_MODELVIEW );
|
glMatrixMode( GL_MODELVIEW );
|
||||||
|
|
@ -1733,7 +1740,7 @@ void OpenGLState_apply( const OpenGLState& self, OpenGLState& current, unsigned
|
||||||
if ( GlobalOpenGL().GL_1_3() ) {
|
if ( GlobalOpenGL().GL_1_3() ) {
|
||||||
glActiveTexture( GL_TEXTURE0 );
|
glActiveTexture( GL_TEXTURE0 );
|
||||||
}
|
}
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
|
// glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
|
||||||
// glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); //uses actual alpha channel, = invis, if qer_trans + empty alpha channel
|
// glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); //uses actual alpha channel, = invis, if qer_trans + empty alpha channel
|
||||||
GlobalOpenGL_debugAssertNoErrors();
|
GlobalOpenGL_debugAssertNoErrors();
|
||||||
}
|
}
|
||||||
|
|
@ -1742,7 +1749,7 @@ void OpenGLState_apply( const OpenGLState& self, OpenGLState& current, unsigned
|
||||||
if ( GlobalOpenGL().GL_1_3() ) {
|
if ( GlobalOpenGL().GL_1_3() ) {
|
||||||
glActiveTexture( GL_TEXTURE0 );
|
glActiveTexture( GL_TEXTURE0 );
|
||||||
}
|
}
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
// glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||||
GlobalOpenGL_debugAssertNoErrors();
|
GlobalOpenGL_debugAssertNoErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1855,35 +1862,6 @@ void OpenGLState_apply( const OpenGLState& self, OpenGLState& current, unsigned
|
||||||
current.m_alpharef = self.m_alpharef;
|
current.m_alpharef = self.m_alpharef;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( delta & state & RENDER_TEXT ) { /* enabling in the end, so other states can't affect */
|
|
||||||
if ( GlobalOpenGL().GL_1_3() ) { ///RENDER_TEXTURE
|
|
||||||
glActiveTexture( GL_TEXTURE0 );
|
|
||||||
glClientActiveTexture( GL_TEXTURE0 );
|
|
||||||
}
|
|
||||||
glEnable( GL_TEXTURE_2D );
|
|
||||||
glColor4fv( vector4_to_array( self.m_colour ) );
|
|
||||||
|
|
||||||
glEnable( GL_BLEND ); ///RENDER_BLEND
|
|
||||||
//glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
|
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); //uses actual alpha channel, = invis, if qer_trans + empty alpha channel
|
|
||||||
|
|
||||||
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); ///RENDER_FILL
|
|
||||||
|
|
||||||
glMatrixMode( GL_PROJECTION );
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
GLint viewprt[4];
|
|
||||||
glGetIntegerv( GL_VIEWPORT, viewprt );
|
|
||||||
//globalOutputStream() << viewprt[2] << " " << viewprt[3] << "\n";
|
|
||||||
glOrtho( 0, viewprt[2], 0, viewprt[3], -100, 100 );
|
|
||||||
glTranslated( double( viewprt[2] ) / 2.0, double( viewprt[3] ) / 2.0, 0 );
|
|
||||||
glMatrixMode( GL_MODELVIEW );
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
|
|
||||||
GlobalOpenGL_debugAssertNoErrors();
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
GLint texture0 = 0;
|
GLint texture0 = 0;
|
||||||
GLint texture1 = 0;
|
GLint texture1 = 0;
|
||||||
|
|
@ -2182,15 +2160,8 @@ void OpenGLShader::construct( const char* name ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( string_equal( name + 1, "TEXT" ) ) {
|
if ( string_equal( name + 1, "TEXT" ) ) {
|
||||||
state.m_colour[0] = 1.f;
|
state.m_state = RENDER_CULLFACE | RENDER_COLOURWRITE | RENDER_FILL | RENDER_TEXTURE | RENDER_BLEND | RENDER_TEXT;
|
||||||
state.m_colour[1] = 1.f;
|
|
||||||
state.m_colour[2] = 1.f;
|
|
||||||
state.m_colour[3] = 1.f;
|
|
||||||
state.m_state = RENDER_CULLFACE | RENDER_COLOURWRITE /*| RENDER_DEPTHTEST | RENDER_DEPTHWRITE*/ /*| RENDER_FILL | RENDER_TEXTURE | RENDER_BLEND */| RENDER_TEXT;
|
|
||||||
state.m_sort = OpenGLState::eSortText;
|
state.m_sort = OpenGLState::eSortText;
|
||||||
state.m_blend_src = GL_SRC_ALPHA;
|
|
||||||
state.m_blend_dst = GL_ONE_MINUS_SRC_ALPHA;
|
|
||||||
//state.m_depthfunc = GL_LEQUAL;
|
|
||||||
}
|
}
|
||||||
else if ( string_equal( name + 1, "POINT" ) ) {
|
else if ( string_equal( name + 1, "POINT" ) ) {
|
||||||
state.m_state = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_DEPTHWRITE;
|
state.m_state = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_DEPTHWRITE;
|
||||||
|
|
@ -2214,7 +2185,7 @@ void OpenGLShader::construct( const char* name ){
|
||||||
state.m_pointsize = 4;
|
state.m_pointsize = 4;
|
||||||
}
|
}
|
||||||
else if ( string_equal( name + 1, "BIGPOINT" ) ) {
|
else if ( string_equal( name + 1, "BIGPOINT" ) ) {
|
||||||
state.m_state = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_DEPTHWRITE | RENDER_OVERRIDE;
|
state.m_state = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_DEPTHWRITE;
|
||||||
state.m_sort = OpenGLState::eSortGUI1 + 1;
|
state.m_sort = OpenGLState::eSortGUI1 + 1;
|
||||||
state.m_pointsize = 6;
|
state.m_pointsize = 6;
|
||||||
}
|
}
|
||||||
|
|
@ -2351,15 +2322,15 @@ void OpenGLShader::construct( const char* name ){
|
||||||
#endif // 0
|
#endif // 0
|
||||||
else if ( string_equal( name + 1, "WIRE_OVERLAY" ) ) {
|
else if ( string_equal( name + 1, "WIRE_OVERLAY" ) ) {
|
||||||
#if 0
|
#if 0
|
||||||
state.m_state = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_DEPTHWRITE | RENDER_DEPTHTEST | RENDER_OVERRIDE;
|
state.m_state = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_DEPTHWRITE | RENDER_DEPTHTEST;
|
||||||
state.m_sort = OpenGLState::eSortOverlayFirst;
|
state.m_sort = OpenGLState::eSortOverlayFirst;
|
||||||
#else
|
#else
|
||||||
state.m_state = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_DEPTHWRITE | RENDER_DEPTHTEST | RENDER_OVERRIDE;
|
state.m_state = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_DEPTHWRITE | RENDER_DEPTHTEST;
|
||||||
state.m_sort = OpenGLState::eSortGUI1;
|
state.m_sort = OpenGLState::eSortGUI1;
|
||||||
state.m_depthfunc = GL_LEQUAL;
|
state.m_depthfunc = GL_LEQUAL;
|
||||||
|
|
||||||
OpenGLState& hiddenLine = appendDefaultPass();
|
OpenGLState& hiddenLine = appendDefaultPass();
|
||||||
hiddenLine.m_state = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_DEPTHWRITE | RENDER_DEPTHTEST | RENDER_OVERRIDE | RENDER_LINESTIPPLE;
|
hiddenLine.m_state = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_DEPTHWRITE | RENDER_DEPTHTEST | RENDER_LINESTIPPLE;
|
||||||
hiddenLine.m_sort = OpenGLState::eSortGUI0;
|
hiddenLine.m_sort = OpenGLState::eSortGUI0;
|
||||||
hiddenLine.m_depthfunc = GL_GREATER;
|
hiddenLine.m_depthfunc = GL_GREATER;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2309,7 +2309,7 @@ void XYWnd::XY_Draw(){
|
||||||
|
|
||||||
glLoadMatrixf( reinterpret_cast<const float*>( &m_modelview ) );
|
glLoadMatrixf( reinterpret_cast<const float*>( &m_modelview ) );
|
||||||
|
|
||||||
unsigned int globalstate = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_POLYGONSMOOTH | RENDER_LINESMOOTH | RENDER_TEXT;
|
unsigned int globalstate = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_POLYGONSMOOTH | RENDER_LINESMOOTH;
|
||||||
if ( !g_xywindow_globals.m_bNoStipple ) {
|
if ( !g_xywindow_globals.m_bNoStipple ) {
|
||||||
globalstate |= RENDER_LINESTIPPLE;
|
globalstate |= RENDER_LINESTIPPLE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user