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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:36:42+00:00 2026-05-26T19:36:42+00:00

I just started working with OpenGL, but I ran into a problem after implementing

  • 0

I just started working with OpenGL, but I ran into a problem after implementing a Font system.

My plan is to simply visualize several Pathfinding Algorithms.

Currently OpenGL gets set up like this (OnSize gets called once on window creation manually):

void GLWindow::OnSize(GLsizei width, GLsizei height)
{
    // set size
    glViewport(0,0,width,height);

    // orthographic projection
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0.0,width,height,0.0,-1.0,1.0);
    glMatrixMode(GL_MODELVIEW);

    m_uiWidth = width;
    m_uiHeight = height;
}

void GLWindow::InitGL()
{
    // enable 2D texturing
    glEnable(GL_TEXTURE_2D);
    // choose a smooth shading model
    glShadeModel(GL_SMOOTH);
    // set the clear color to black
    glClearColor(0.0, 0.0, 0.0, 0.0);

    glEnable(GL_ALPHA_TEST);
    glAlphaFunc(GL_GREATER, 0.0f);  
}

In theory I don’t need blending, because I will only use untextured Quads to visualize obstacles and line etc to draw paths… So everything will be untextured, except the fonts…

The Font Class has a push and pop function, that look like this (if I remember right my Font system is based on a NeHe Tutorial that I was following quite a while ago):

inline void GLFont::pushScreenMatrix()
{
    glPushAttrib(GL_TRANSFORM_BIT);
    GLint   viewport[4];
    glGetIntegerv(GL_VIEWPORT, viewport);
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    glOrtho(viewport[0],viewport[2],viewport[1],viewport[3], -1.0, 1.0);
    glPopAttrib();
}

inline void GLFont::popProjectionMatrix()
{
    glPushAttrib(GL_TRANSFORM_BIT);
    glMatrixMode(GL_PROJECTION);
    glPopMatrix();
    glPopAttrib();
}

So the Problem:
If I don’t draw a Text I can see the Quads I want to draw, but they are quite dark, so there must be something wrong with my general OpenGL Matrix Properties.
If I draw Text (so the font related push and pop functions get called) I can’t see any Quads.

The question:
How do I solve this problem and some background information why this happened would also be nice, because I am still a beginner/student, who just started.

  • 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-26T19:36:43+00:00Added an answer on May 26, 2026 at 7:36 pm

    If your quads are untextured, you will run into undefined behaviour. What will probably happen is that any previous texture will be used, and the colour at point (0,0) will be used, which could be what is causing them to be invisible.

    Really, you need to disable texturing before trying to draw untextured quads using glDisable(GL_TEXTURE_2D). Again, if you don’t, it’ll just use the previous texture and texture co-ordinates, which without seeing your draw() loop, I’m assuming to be undefined.

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

Sidebar

Related Questions

Just started working with android and ran into a small problem. I am have
I just started working with Javascript and I ran into an error with Visual
Just started working with .NET and MVC(1). I'm having a problem wherein in my
I just started working in a .Net company and I saw this code but
I have just started working on NASA world Wind Application in C#. But I
I just started working with the Android NDK but I keep getting SIGSEGV when
I've just started working with the acts_as_taggable gem. Really liking it so far, but
Just started working on a basic grid analysis algorithm in JavaScript but I have
Just started working with Mercurial a few days ago and there's something I don't
I just started working for a pretty large company and my group manages all

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.