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 7521515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:14:54+00:00 2026-05-30T02:14:54+00:00

I am learning OpenGL these days, and I tried to compile the example code

  • 0

I am learning OpenGL these days, and I tried to compile the example code on the book(OpenGL SuperBible)

The code likes this: first use glEnable(GL_LINE_STIPPLE) to open the GL_LINE_STIPPLE, and then glLineStipple(2, (GLushort)0x00ff), last I draw some lines, but when executed, it just displayed the normal lines. (in Ubuntu)

However, I compiled the same code in windows, it worked!!

Why? Are there any different details between Windows and Linux?

#include <QtGui>
#include "GLWidget.h"
GLWidget::GLWidget(QWidget *parent)
    : QGLWidget(parent)
{
    setFormat(QGLFormat(QGL::DoubleBuffer));
}
GLWidget::~GLWidget()
{
}
void GLWidget::initializeGL()
{
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glEnable(GL_LINE_STIPPLE);
}
void GLWidget::resizeGL(int w, int h)
{
    if(h == 0)
        h = 1;
    glViewport(0, 0, w, h);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-100, 100, -100, 100, -1, +1);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}
void GLWidget::paintGL()
{
    glClear(GL_COLOR_BUFFER_BIT);
    drawLine();
}
void GLWidget::drawLine()
{
    GLint factor = 1;
    GLushort pattern = 0x00ff;
    glColor3f(1.0f, 1.0f, 1.0f);
    for(GLfloat i = -90.0f; i < 90.0f; i += 20.0f)
    {
        glLineStipple(factor, pattern);
        glLineWidth(5.0);
        glBegin(GL_LINES);
            glVertex2f(-80.0f, i);
            glVertex2f(+80.0f, i);
        glEnd();
        factor++;
    }
}
  • 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-05-30T02:14:57+00:00Added an answer on May 30, 2026 at 2:14 am

    I’ve seen from your comment answer to @Lefteris that you’re using the Mesa3D/DRI based “radeon” driver. I suggest you download AMD’s propritary driver (fglrx) fron their website, install that and try again.

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

Sidebar

Related Questions

I've slightly modified the iPhone SDK's GLSprite example while learning OpenGL ES and it
I'm interested in learning to use OpenGL and I had the idea of writing
I have enjoyed learning to use OpenGL under the context of games programming, and
I'm currently learning OpenGL and got my first bunch of geometry and textures displayed.
I'm learning OpenGL, and I am reading a book to help me a long.
I'm learning GLSL. I tried to use a function glCreateShader. but there is no
I have a question - I am learning OpenGL ES 2.0 from this tutorial
I've been learning OpenGL for a few days now by following some tutorials and
So I am learning OpenGL with as the main resource having the Red book.
So I have begun learning OpenGL, reading from the book OpenGL Super Bible 5

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.