mirror of
https://github.com/leozide/leocad
synced 2025-01-29 20:34:50 +01:00
Fixes for iOS.
This commit is contained in:
parent
0f2e808477
commit
6b3869ce90
12 changed files with 97 additions and 25 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -20,6 +20,9 @@ build
|
||||||
debug
|
debug
|
||||||
release
|
release
|
||||||
ipch
|
ipch
|
||||||
|
Debug*
|
||||||
|
.DS_Store
|
||||||
|
.qmake.stash
|
||||||
Makefile
|
Makefile
|
||||||
library.bin
|
library.bin
|
||||||
leocad_plugin_import.cpp
|
leocad_plugin_import.cpp
|
||||||
|
|
|
@ -7,6 +7,17 @@
|
||||||
#include "lc_mainwindow.h"
|
#include "lc_mainwindow.h"
|
||||||
#include "lc_library.h"
|
#include "lc_library.h"
|
||||||
|
|
||||||
|
#ifdef LC_OPENGLES
|
||||||
|
#define glEnableClientState(...)
|
||||||
|
#define glDisableClientState(...)
|
||||||
|
#define glVertexPointer(...)
|
||||||
|
#define glTexCoordPointer(...)
|
||||||
|
#define glColorPointer(...)
|
||||||
|
#define GL_ARRAY_BUFFER_ARB GL_ARRAY_BUFFER
|
||||||
|
#define GL_ELEMENT_ARRAY_BUFFER_ARB GL_ELEMENT_ARRAY_BUFFER
|
||||||
|
#define GL_STATIC_DRAW_ARB GL_STATIC_DRAW
|
||||||
|
#endif
|
||||||
|
|
||||||
lcProgram lcContext::mPrograms[LC_NUM_PROGRAMS];
|
lcProgram lcContext::mPrograms[LC_NUM_PROGRAMS];
|
||||||
|
|
||||||
static int lcOpaqueRenderMeshCompare(const void* Elem1, const void* Elem2)
|
static int lcOpaqueRenderMeshCompare(const void* Elem1, const void* Elem2)
|
||||||
|
@ -69,7 +80,9 @@ lcContext::lcContext()
|
||||||
|
|
||||||
mTexture = NULL;
|
mTexture = NULL;
|
||||||
mLineWidth = 1.0f;
|
mLineWidth = 1.0f;
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
mMatrixMode = GL_MODELVIEW;
|
mMatrixMode = GL_MODELVIEW;
|
||||||
|
#endif
|
||||||
|
|
||||||
mFramebufferObject = 0;
|
mFramebufferObject = 0;
|
||||||
mFramebufferTexture = 0;
|
mFramebufferTexture = 0;
|
||||||
|
@ -95,21 +108,35 @@ lcContext::~lcContext()
|
||||||
|
|
||||||
void lcContext::CreateShaderPrograms()
|
void lcContext::CreateShaderPrograms()
|
||||||
{
|
{
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
|
#define LC_SHADER_VERSION "#version 110\n"
|
||||||
|
#define LC_VERTEX_INPUT "attribute "
|
||||||
|
#define LC_VERTEX_OUTPUT "varying "
|
||||||
|
#define LC_PIXEL_INPUT "varying "
|
||||||
|
#define LC_PIXEL_OUTPUT
|
||||||
|
#else
|
||||||
|
#define LC_SHADER_VERSION "#version 300 es\n#define texture2D texture\n"
|
||||||
|
#define LC_VERTEX_INPUT "in "
|
||||||
|
#define LC_VERTEX_OUTPUT "out "
|
||||||
|
#define LC_PIXEL_INPUT "in mediump "
|
||||||
|
#define LC_PIXEL_OUTPUT "#define gl_FragColor FragColor\nout mediump vec4 gl_FragColor;\n"
|
||||||
|
#endif
|
||||||
|
|
||||||
const char* VertexShaders[LC_NUM_PROGRAMS] =
|
const char* VertexShaders[LC_NUM_PROGRAMS] =
|
||||||
{
|
{
|
||||||
// LC_PROGRAM_SIMPLE
|
// LC_PROGRAM_SIMPLE
|
||||||
"#version 110\n"
|
LC_SHADER_VERSION
|
||||||
"attribute vec3 VertexPosition;\n"
|
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||||
"}\n",
|
"}\n",
|
||||||
// LC_PROGRAM_TEXTURE
|
// LC_PROGRAM_TEXTURE
|
||||||
"#version 110\n"
|
LC_SHADER_VERSION
|
||||||
"attribute vec3 VertexPosition;\n"
|
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||||
"attribute vec2 VertexTexCoord;\n"
|
LC_VERTEX_INPUT "vec2 VertexTexCoord;\n"
|
||||||
"varying vec2 PixelTexCoord;\n"
|
LC_VERTEX_OUTPUT "vec2 PixelTexCoord;\n"
|
||||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -117,10 +144,10 @@ void lcContext::CreateShaderPrograms()
|
||||||
" PixelTexCoord = VertexTexCoord;\n"
|
" PixelTexCoord = VertexTexCoord;\n"
|
||||||
"}\n",
|
"}\n",
|
||||||
// LC_PROGRAM_VERTEX_COLOR
|
// LC_PROGRAM_VERTEX_COLOR
|
||||||
"#version 110\n"
|
LC_SHADER_VERSION
|
||||||
"attribute vec3 VertexPosition;\n"
|
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||||
"attribute vec4 VertexColor;\n"
|
LC_VERTEX_INPUT "vec4 VertexColor;\n"
|
||||||
"varying vec4 PixelColor;\n"
|
LC_VERTEX_OUTPUT "vec4 PixelColor;\n"
|
||||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -132,24 +159,27 @@ void lcContext::CreateShaderPrograms()
|
||||||
const char* FragmentShaders[LC_NUM_PROGRAMS] =
|
const char* FragmentShaders[LC_NUM_PROGRAMS] =
|
||||||
{
|
{
|
||||||
// LC_PROGRAM_SIMPLE
|
// LC_PROGRAM_SIMPLE
|
||||||
"#version 110\n"
|
LC_SHADER_VERSION
|
||||||
"uniform vec4 Color;\n"
|
LC_PIXEL_OUTPUT
|
||||||
|
"uniform mediump vec4 Color;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" gl_FragColor = Color;\n"
|
" gl_FragColor = Color;\n"
|
||||||
"}\n",
|
"}\n",
|
||||||
// LC_PROGRAM_TEXTURE
|
// LC_PROGRAM_TEXTURE
|
||||||
"#version 110\n"
|
LC_SHADER_VERSION
|
||||||
"varying vec2 PixelTexCoord;\n"
|
LC_PIXEL_INPUT "vec2 PixelTexCoord;\n"
|
||||||
"uniform vec4 Color;\n"
|
LC_PIXEL_OUTPUT
|
||||||
|
"uniform mediump vec4 Color;\n"
|
||||||
"uniform sampler2D Texture;\n"
|
"uniform sampler2D Texture;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" gl_FragColor = texture2D(Texture, PixelTexCoord) * Color;\n"
|
" gl_FragColor = texture2D(Texture, PixelTexCoord) * Color;\n"
|
||||||
"}\n",
|
"}\n",
|
||||||
// LC_PROGRAM_VERTEX_COLOR
|
// LC_PROGRAM_VERTEX_COLOR
|
||||||
"#version 110\n"
|
LC_SHADER_VERSION
|
||||||
"varying vec4 PixelColor;\n"
|
LC_PIXEL_INPUT "vec4 PixelColor;\n"
|
||||||
|
LC_PIXEL_OUTPUT
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" gl_FragColor = PixelColor;\n"
|
" gl_FragColor = PixelColor;\n"
|
||||||
|
@ -307,8 +337,10 @@ void lcContext::SetDefaultState()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
mMatrixMode = GL_MODELVIEW;
|
mMatrixMode = GL_MODELVIEW;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +436,7 @@ bool lcContext::BeginRenderToTexture(int Width, int Height)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
if (gSupportsFramebufferObjectEXT)
|
if (gSupportsFramebufferObjectEXT)
|
||||||
{
|
{
|
||||||
glGenFramebuffersEXT(1, &mFramebufferObject);
|
glGenFramebuffersEXT(1, &mFramebufferObject);
|
||||||
|
@ -435,6 +468,7 @@ bool lcContext::BeginRenderToTexture(int Width, int Height)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -453,6 +487,7 @@ void lcContext::EndRenderToTexture()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
if (gSupportsFramebufferObjectEXT)
|
if (gSupportsFramebufferObjectEXT)
|
||||||
{
|
{
|
||||||
glDeleteFramebuffersEXT(1, &mFramebufferObject);
|
glDeleteFramebuffersEXT(1, &mFramebufferObject);
|
||||||
|
@ -462,6 +497,7 @@ void lcContext::EndRenderToTexture()
|
||||||
glDeleteRenderbuffersEXT(1, &mDepthRenderbufferObject);
|
glDeleteRenderbuffersEXT(1, &mDepthRenderbufferObject);
|
||||||
mDepthRenderbufferObject = 0;
|
mDepthRenderbufferObject = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage lcContext::GetRenderToTextureImage(int Width, int Height)
|
QImage lcContext::GetRenderToTextureImage(int Width, int Height)
|
||||||
|
@ -879,6 +915,7 @@ void lcContext::FlushState()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
glColor4fv(mColor);
|
glColor4fv(mColor);
|
||||||
|
|
||||||
if (mWorldMatrixDirty || mViewMatrixDirty)
|
if (mWorldMatrixDirty || mViewMatrixDirty)
|
||||||
|
@ -905,6 +942,7 @@ void lcContext::FlushState()
|
||||||
glLoadMatrixf(mProjectionMatrix);
|
glLoadMatrixf(mProjectionMatrix);
|
||||||
mProjectionMatrixDirty = false;
|
mProjectionMatrixDirty = false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,4 +331,10 @@ void lcInitializeGLExtensions(const QGLContext* Context)
|
||||||
#endif
|
#endif
|
||||||
gSupportsShaderObjects = true;
|
gSupportsShaderObjects = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LC_OPENGLES
|
||||||
|
gSupportsVertexBufferObject = true;
|
||||||
|
gSupportsFramebufferObjectARB = true;
|
||||||
|
gSupportsShaderObjects = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -730,6 +730,7 @@ void lcMainWindow::ColorChanged(int ColorIndex)
|
||||||
|
|
||||||
void lcMainWindow::Print(QPrinter* Printer)
|
void lcMainWindow::Print(QPrinter* Printer)
|
||||||
{
|
{
|
||||||
|
#ifndef QT_NO_PRINTER
|
||||||
lcModel* Model = lcGetActiveModel();
|
lcModel* Model = lcGetActiveModel();
|
||||||
int DocCopies;
|
int DocCopies;
|
||||||
int PageCopies;
|
int PageCopies;
|
||||||
|
@ -993,6 +994,7 @@ void lcMainWindow::Print(QPrinter* Printer)
|
||||||
Model->SetTemporaryStep(PreviousTime);
|
Model->SetTemporaryStep(PreviousTime);
|
||||||
|
|
||||||
Context->EndRenderToTexture();
|
Context->EndRenderToTexture();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcMainWindow::ShowUpdatesDialog()
|
void lcMainWindow::ShowUpdatesDialog()
|
||||||
|
@ -1009,6 +1011,7 @@ void lcMainWindow::ShowAboutDialog()
|
||||||
|
|
||||||
void lcMainWindow::ShowPrintDialog()
|
void lcMainWindow::ShowPrintDialog()
|
||||||
{
|
{
|
||||||
|
#ifndef QT_NO_PRINTER
|
||||||
lcModel* Model = lcGetActiveModel();
|
lcModel* Model = lcGetActiveModel();
|
||||||
int Rows = lcGetProfileInt(LC_PROFILE_PRINT_ROWS);
|
int Rows = lcGetProfileInt(LC_PROFILE_PRINT_ROWS);
|
||||||
int Columns = lcGetProfileInt(LC_PROFILE_PRINT_COLUMNS);
|
int Columns = lcGetProfileInt(LC_PROFILE_PRINT_COLUMNS);
|
||||||
|
@ -1022,6 +1025,7 @@ void lcMainWindow::ShowPrintDialog()
|
||||||
|
|
||||||
if (PrintDialog.exec() == QDialog::Accepted)
|
if (PrintDialog.exec() == QDialog::Accepted)
|
||||||
Print(&Printer);
|
Print(&Printer);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: call dialogs directly
|
// todo: call dialogs directly
|
||||||
|
@ -1394,6 +1398,7 @@ void lcMainWindow::ResetViews()
|
||||||
|
|
||||||
void lcMainWindow::TogglePrintPreview()
|
void lcMainWindow::TogglePrintPreview()
|
||||||
{
|
{
|
||||||
|
#ifndef QT_NO_PRINTER
|
||||||
// todo: print preview inside main window
|
// todo: print preview inside main window
|
||||||
|
|
||||||
lcModel* Model = lcGetActiveModel();
|
lcModel* Model = lcGetActiveModel();
|
||||||
|
@ -1408,6 +1413,7 @@ void lcMainWindow::TogglePrintPreview()
|
||||||
QPrintPreviewDialog Preview(&Printer, this);
|
QPrintPreviewDialog Preview(&Printer, this);
|
||||||
connect(&Preview, SIGNAL(paintRequested(QPrinter*)), SLOT(Print(QPrinter*)));
|
connect(&Preview, SIGNAL(paintRequested(QPrinter*)), SLOT(Print(QPrinter*)));
|
||||||
Preview.exec();
|
Preview.exec();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcMainWindow::ToggleFullScreen()
|
void lcMainWindow::ToggleFullScreen()
|
||||||
|
|
|
@ -14,6 +14,9 @@ class lcQPartsTree;
|
||||||
class lcQColorList;
|
class lcQColorList;
|
||||||
class lcQPropertiesTree;
|
class lcQPropertiesTree;
|
||||||
class lcTimelineWidget;
|
class lcTimelineWidget;
|
||||||
|
#ifdef QT_NO_PRINTER
|
||||||
|
class QPrinter;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LC_MAX_RECENT_FILES 4
|
#define LC_MAX_RECENT_FILES 4
|
||||||
|
|
||||||
|
|
|
@ -1116,7 +1116,9 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
|
||||||
|
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
#endif
|
||||||
|
|
||||||
float ViewWidth = (float)Widget->mWidth;
|
float ViewWidth = (float)Widget->mWidth;
|
||||||
float ViewHeight = (float)Widget->mHeight;
|
float ViewHeight = (float)Widget->mHeight;
|
||||||
|
@ -1128,7 +1130,9 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
|
||||||
|
|
||||||
if (mProperties.mBackgroundType == LC_BACKGROUND_GRADIENT)
|
if (mProperties.mBackgroundType == LC_BACKGROUND_GRADIENT)
|
||||||
{
|
{
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
glShadeModel(GL_SMOOTH);
|
glShadeModel(GL_SMOOTH);
|
||||||
|
#endif
|
||||||
|
|
||||||
const lcVector3& Color1 = mProperties.mBackgroundGradientColor1;
|
const lcVector3& Color1 = mProperties.mBackgroundGradientColor1;
|
||||||
const lcVector3& Color2 = mProperties.mBackgroundGradientColor2;
|
const lcVector3& Color2 = mProperties.mBackgroundGradientColor2;
|
||||||
|
@ -1149,7 +1153,9 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
|
||||||
|
|
||||||
Context->ClearVertexBuffer(); // context remove
|
Context->ClearVertexBuffer(); // context remove
|
||||||
|
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
glShadeModel(GL_FLAT);
|
glShadeModel(GL_FLAT);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (mProperties.mBackgroundType == LC_BACKGROUND_IMAGE)
|
else if (mProperties.mBackgroundType == LC_BACKGROUND_IMAGE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -199,8 +199,8 @@ bool lcTexture::Load(Image* images, int NumLevels, int Flags)
|
||||||
int MipIndex = Flags & LC_TEXTURE_MIPMAPS ? 0 : 1;
|
int MipIndex = Flags & LC_TEXTURE_MIPMAPS ? 0 : 1;
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, mTexture);
|
glBindTexture(GL_TEXTURE_2D, mTexture);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (Flags & LC_TEXTURE_WRAPU) ? GL_REPEAT : GL_CLAMP);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (Flags & LC_TEXTURE_WRAPU) ? GL_REPEAT : GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (Flags & LC_TEXTURE_WRAPV) ? GL_REPEAT : GL_CLAMP);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (Flags & LC_TEXTURE_WRAPV) ? GL_REPEAT : GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filters[MipIndex][FilterIndex]);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filters[MipIndex][FilterIndex]);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filters[1][FilterIndex]);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filters[1][FilterIndex]);
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
|
|
@ -528,6 +528,7 @@ void lcLight::DrawPointLight(lcContext* Context) const
|
||||||
|
|
||||||
bool lcLight::Setup(int LightIndex)
|
bool lcLight::Setup(int LightIndex)
|
||||||
{
|
{
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
GLenum LightName = (GLenum)(GL_LIGHT0 + LightIndex);
|
GLenum LightName = (GLenum)(GL_LIGHT0 + LightIndex);
|
||||||
|
|
||||||
if (mState & LC_LIGHT_DISABLED)
|
if (mState & LC_LIGHT_DISABLED)
|
||||||
|
@ -567,6 +568,7 @@ bool lcLight::Setup(int LightIndex)
|
||||||
glLightf(LightName, GL_SPOT_EXPONENT, mSpotExponent);
|
glLightf(LightName, GL_SPOT_EXPONENT, mSpotExponent);
|
||||||
glLightfv(LightName, GL_SPOT_DIRECTION, Dir);
|
glLightfv(LightName, GL_SPOT_DIRECTION, Dir);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1658,7 +1658,9 @@ void Project::ExportPOVRay()
|
||||||
|
|
||||||
Arguments.append(QString::fromLatin1("/EXIT"));
|
Arguments.append(QString::fromLatin1("/EXIT"));
|
||||||
|
|
||||||
|
#ifndef QT_NO_PROCESS
|
||||||
QProcess::execute(Dialog.mPOVRayPath, Arguments);
|
QProcess::execute(Dialog.mPOVRayPath, Arguments);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,8 +113,6 @@ bool TexFont::Load()
|
||||||
|
|
||||||
glGenTextures(1, &mTexture);
|
glGenTextures(1, &mTexture);
|
||||||
glBindTexture(GL_TEXTURE_2D, mTexture);
|
glBindTexture(GL_TEXTURE_2D, mTexture);
|
||||||
glDisable(GL_TEXTURE_GEN_S);
|
|
||||||
glDisable(GL_TEXTURE_GEN_T);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
|
|
|
@ -565,12 +565,13 @@ void View::OnDraw()
|
||||||
mModel->DrawBackground(this);
|
mModel->DrawBackground(this);
|
||||||
|
|
||||||
const lcPreferences& Preferences = lcGetPreferences();
|
const lcPreferences& Preferences = lcGetPreferences();
|
||||||
const lcModelProperties& Properties = mModel->GetProperties();
|
|
||||||
|
|
||||||
mContext->SetViewMatrix(mCamera->mWorldView);
|
mContext->SetViewMatrix(mCamera->mWorldView);
|
||||||
mContext->SetProjectionMatrix(GetProjectionMatrix());
|
mContext->SetProjectionMatrix(GetProjectionMatrix());
|
||||||
mContext->SetProgram(LC_PROGRAM_SIMPLE); // todo: lighting
|
mContext->SetProgram(LC_PROGRAM_SIMPLE); // todo: lighting
|
||||||
|
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
|
const lcModelProperties& Properties = mModel->GetProperties();
|
||||||
if (Preferences.mLightingMode != LC_LIGHTING_FLAT)
|
if (Preferences.mLightingMode != LC_LIGHTING_FLAT)
|
||||||
{
|
{
|
||||||
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT);
|
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT);
|
||||||
|
@ -603,6 +604,7 @@ void View::OnDraw()
|
||||||
glFogfv(GL_FOG_COLOR, lcVector4(Properties.mFogColor, 1.0f));
|
glFogfv(GL_FOG_COLOR, lcVector4(Properties.mFogColor, 1.0f));
|
||||||
glEnable(GL_FOG);
|
glEnable(GL_FOG);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mContext->SetLineWidth(Preferences.mLineWidth);
|
mContext->SetLineWidth(Preferences.mLineWidth);
|
||||||
|
|
||||||
|
@ -611,6 +613,7 @@ void View::OnDraw()
|
||||||
|
|
||||||
mContext->UnbindMesh(); // context remove
|
mContext->UnbindMesh(); // context remove
|
||||||
|
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
if (Preferences.mLightingMode != LC_LIGHTING_FLAT)
|
if (Preferences.mLightingMode != LC_LIGHTING_FLAT)
|
||||||
{
|
{
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
@ -620,6 +623,7 @@ void View::OnDraw()
|
||||||
|
|
||||||
if (Properties.mFogEnabled)
|
if (Properties.mFogEnabled)
|
||||||
glDisable(GL_FOG);
|
glDisable(GL_FOG);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (DrawInterface)
|
if (DrawInterface)
|
||||||
{
|
{
|
||||||
|
@ -1554,7 +1558,9 @@ void View::DrawViewport()
|
||||||
|
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (gMainWindow->GetActiveView() == this)
|
if (gMainWindow->GetActiveView() == this)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ lcQAboutDialog::lcQAboutDialog(QWidget *parent) :
|
||||||
gMainWindow->GetActiveView()->MakeCurrent();
|
gMainWindow->GetActiveView()->MakeCurrent();
|
||||||
|
|
||||||
GLint Red, Green, Blue, Alpha, Depth, Stencil;
|
GLint Red, Green, Blue, Alpha, Depth, Stencil;
|
||||||
GLboolean DoubleBuffer, RGBA;
|
GLboolean DoubleBuffer = GL_TRUE, RGBA = GL_TRUE;
|
||||||
|
|
||||||
glGetIntegerv(GL_RED_BITS, &Red);
|
glGetIntegerv(GL_RED_BITS, &Red);
|
||||||
glGetIntegerv(GL_GREEN_BITS, &Green);
|
glGetIntegerv(GL_GREEN_BITS, &Green);
|
||||||
|
@ -24,8 +24,10 @@ lcQAboutDialog::lcQAboutDialog(QWidget *parent) :
|
||||||
glGetIntegerv(GL_ALPHA_BITS, &Alpha);
|
glGetIntegerv(GL_ALPHA_BITS, &Alpha);
|
||||||
glGetIntegerv(GL_DEPTH_BITS, &Depth);
|
glGetIntegerv(GL_DEPTH_BITS, &Depth);
|
||||||
glGetIntegerv(GL_STENCIL_BITS, &Stencil);
|
glGetIntegerv(GL_STENCIL_BITS, &Stencil);
|
||||||
|
#ifndef LC_OPENGLES
|
||||||
glGetBooleanv(GL_DOUBLEBUFFER, &DoubleBuffer);
|
glGetBooleanv(GL_DOUBLEBUFFER, &DoubleBuffer);
|
||||||
glGetBooleanv(GL_RGBA_MODE, &RGBA);
|
glGetBooleanv(GL_RGBA_MODE, &RGBA);
|
||||||
|
#endif
|
||||||
|
|
||||||
QString VersionFormat = tr("OpenGL Version %1 (GLSL %2)\n%3 - %4\n\n");
|
QString VersionFormat = tr("OpenGL Version %1 (GLSL %2)\n%3 - %4\n\n");
|
||||||
QString Version = VersionFormat.arg(QString((const char*)glGetString(GL_VERSION)), QString((const char*)glGetString(GL_SHADING_LANGUAGE_VERSION)), QString((const char*)glGetString(GL_RENDERER)), QString((const char*)glGetString(GL_VENDOR)));
|
QString Version = VersionFormat.arg(QString((const char*)glGetString(GL_VERSION)), QString((const char*)glGetString(GL_SHADING_LANGUAGE_VERSION)), QString((const char*)glGetString(GL_RENDERER)), QString((const char*)glGetString(GL_VENDOR)));
|
||||||
|
|
Loading…
Add table
Reference in a new issue