Skip to content

Commit e752f0d

Browse files
committed
#11371 Remove GLU dependency to fix Windows build error
GL/glu.h conflicts with Qt's OpenGL headers on Windows due to APIENTRY redefinition. Replace gluBuild2DMipmaps with glTexImage2D + glGenerateMipmap, and gluOrtho2D with glOrtho.
1 parent e23ba64 commit e752f0d

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

Fwk/VizFwk/LibRender/cvfOpenGL.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@
5151
QOpenGLExtraFunctions* cvfGL = QOpenGLContext::currentContext()->extraFunctions()
5252

5353
// Include standard OpenGL headers for constants and basic types
54+
// Note: Qt's QOpenGLFunctions headers already include the platform GL headers,
55+
// but we include them explicitly for clarity. GLU is not used.
5456
#if defined(WIN32) || defined(CVF_LINUX)
5557

5658
// Windows and Linux includes
5759
#include <GL/gl.h>
58-
#include <GL/glu.h>
5960

6061
#elif defined(CVF_ANDROID)
6162

@@ -73,7 +74,6 @@
7374

7475
// Mac OSX includes
7576
#include "OpenGL/gl.h"
76-
#include "OpenGL/glu.h"
7777

7878
#endif
7979

Fwk/VizFwk/LibRender/cvfTexture2D_FF.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ bool Texture2D_FF::setupTexture(OpenGLContext* oglContext)
146146
GLsizei width = static_cast<GLsizei>(m_image->width());
147147
GLsizei height = static_cast<GLsizei>(m_image->height());
148148
CVF_ASSERT(height > 0 && width > 0);
149-
//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_image->ptr());
150-
// Note: gluBuild2DMipmaps will scale the image to the closest power of 2 dimension, which is required by the software renderer
151-
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, width, height, GL_RGBA, GL_UNSIGNED_BYTE, m_image->ptr());
149+
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_image->ptr());
150+
cvfGL->glGenerateMipmap(GL_TEXTURE_2D);
152151

153152
if (CVF_TEST_AND_REPORT_OPENGL_ERROR(oglContext, "Setup texture"))
154153
{

Fwk/VizFwk/TestApps/Win32/Win32SnippetRunner/Win32SnippetRunner.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#include "Win32PropertiesPanel.h"
4444

4545
#include <GL/gl.h>
46-
#include <GL/glu.h>
4746

4847
#include "SnippetFactoryBasis.h"
4948

Fwk/VizFwk/Tests/SnippetsBasis/snipDepthPeelingFront.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ void DepthPeelingFront::drawQuad()
536536
glMatrixMode(GL_MODELVIEW);
537537
glPushMatrix();
538538
glLoadIdentity();
539-
gluOrtho2D(0.0, 1.0, 0.0, 1.0);
539+
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
540540
glBegin(GL_QUADS);
541541
{
542542
glVertex2f(0.0, 0.0);

Fwk/VizFwk/Tests/SnippetsBasis/snipIncrementalRenderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ void IncrementalRenderer::onPaintEvent(PostEventAction* postEventAction)
213213
//glViewport(0, 0, vpWidth, vpHeight);
214214
glMatrixMode(GL_PROJECTION);
215215
glLoadIdentity();
216-
gluOrtho2D(0, vpWidth, 0, vpHeight);
216+
glOrtho(0, vpWidth, 0, vpHeight, -1, 1);
217217

218218
glMatrixMode(GL_MODELVIEW);
219219
glLoadIdentity();

0 commit comments

Comments
 (0)