Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8498347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:22:38+00:00 2026-06-11T00:22:38+00:00

As you see — I have no idea why it’s not working at all.

  • 0

As you see — I have no idea why it’s not working at all.

When the program run, it will look like this:broken display

I’m using qt4-mac(v4.8.2) from macports. It seems that the package was pre-compiled.

And here’s the source:

main.cpp:

#include <iostream>

#include <QApplication>

#include "GLPlayerWindow.hpp"

int main(int argc, char *argv[])
{
     QApplication app(argc, argv);

     GLPlayerWindow window;
     window.show();
     window.resize(800, 600);

     return app.exec();
}

GLPlayerWindow.hpp:

#ifndef __GLPLAYERWINDOW__HPP__DEFINED__
#define __GLPLAYERWINDOW__HPP__DEFINED__

#include <string>

#include <QGLWidget>
#include <QMouseEvent>
#include <QKeyEvent>
#include <QTimer>

#include <SimpleAV_SDL.h>

class GLPlayerWindow : public QGLWidget
{
     Q_OBJECT

public:
     GLPlayerWindow(QWidget *parent = NULL);
     ~GLPlayerWindow();

protected slots:
     void paintGL();

protected:
     void initializeGL();
     void resizeGL(int w, int h);
     void keyPressEvent(QKeyEvent *event);
};

#endif

GLPlayerWindow.cpp:

#include <iostream>

#include "GLPlayerWindow.hpp"
#include <GL/glu.h>

GLPlayerWindow::GLPlayerWindow(QWidget *parent)
     : QGLWidget(parent) {
     setMouseTracking(true);
}

GLPlayerWindow::~GLPlayerWindow() {
}

void GLPlayerWindow::initializeGL() {
     glDisable(GL_DEPTH_TEST);
     glDisable(GL_COLOR_MATERIAL);
     glEnable(GL_TEXTURE_2D);
     glEnable(GL_BLEND);
     glEnable(GL_POLYGON_SMOOTH);
     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     glClearColor(1.0f, 0.0f, 0.0f, 0);
}

void GLPlayerWindow::resizeGL(int w, int h) {
     glViewport(0, 0, w, h);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     gluOrtho2D(0, w, 0, h); // set origin to top left corner
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
}

void GLPlayerWindow::paintGL() {
     glClear(GL_COLOR_BUFFER_BIT);
     return;
}

void GLPlayerWindow::keyPressEvent(QKeyEvent* event) {
}

And the .pro file:

QT += opengl
TEMPLATE = app
TARGET = 
DEPENDPATH += .
INCLUDEPATH += .

CONFIG += link_pkgconfig
PKGCONFIG += libavcodec libavformat libavutil libswscale SimpleAV_SDL sdl SDL_mixer gl glu

# LIBS += `pkg-config --libs SimpleAV_SDL SDL_mixer sdl`
# CFLAGS += -g -O2 -Wall -W `pkg-config --cflags SimpleAV_SDL SDL_mixer sdl`
CFLAGS += -g -O2 -Wall -W

# Input
HEADERS += GLPlayerWindow.hpp
SOURCES += GLPlayerWindow.cpp main.cpp
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:22:40+00:00Added an answer on June 11, 2026 at 12:22 am

    Ok guys if you are facing the same issue under Mac, try to link the GL implementation under /System/Library/Frameworks/AGL.framework/ . See this post for detail: Why glOrtho() works under Mac but gluOrtho2D() doesn't?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

See this question. How to show popup message like in stackoverflow I am trying
SEE EDIT UPDATES BELOW. Original question has been modified! I have a working window
see this link...: Exemple on this site i have this code <body> <div id=geral>
See this jsFiddle post for a working arc drawing; thanks to Simon Sarris for
See,I have this code: template<typename T=int>struct color { T red, green, blue; color(T r,
See Is there something wrong with this python code, why does it run so
See this demo from Filament Group using their Progressive Enhancement enhance.js library Modifying to
See the SQL Statements indicated in this SQL Profiler view. All these events are
See this page, Why doesnt it show like it does when you enter a
See working example at http://jsfiddle.net/xqwqH . I have a green div inside a red

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.