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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:48:31+00:00 2026-06-14T09:48:31+00:00

I can see the screen has been cleared to red,but no point in the

  • 0

I can see the screen has been cleared to red,but no point in the center of the screen,any way here is the full code:

#include "GL/glfw.h"
void render_loop()
{
    glClearColor ( .7, .1, .1, 1.0f );
    glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    glViewport(0,0,1024,768);
    glMatrixMode(GL_PROJECTION);
    //gluPerspective( 65.0, (double)1024/(double)768, 1.0, 60.0 );
    glOrtho(0,1024,768,0,100,-100);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glPointSize(10);
    glBegin(GL_POINTS);
    glColor4f(1,1,1,1);
    glVertex3f(512,384,0);
    glEnd();

    glfwSwapBuffers();

}
int main ( int argc, char* argv[] )
{
    //init glfw
    glfwInit();

    glfwOpenWindow ( 1024, 768, 8, 8, 8, 8, 24, 0, GLFW_WINDOW );

    do {
        render_loop();
    } while ( glfwGetWindowParam ( GLFW_OPENED ) );

    glfwTerminate();
}

compiled using:

john@Linux:~> gcc --version
gcc (SUSE Linux) 4.7.1 20120723 [gcc-4_7-branch revision 189773]
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

if I compile it use gluPerspective( 65.0, (double)1024/(double)768, 1.0, 60.0 ); still the same,no point in the center of the screen,I use this makefile to compile it:

#makefile for example1 on linux

CC=gcc  -std=c99  -Wno-unused-function -Wno-unused-variable


SRC=\
a.c \

OBJS=$(SRC:.c=.o)

NAME=testglpoints

CFLAGS =   -Wall $(INCLUDE) 

LFLAGS =\
-lGL \
-lglut \
-lGLU \
-lGLEW \
-ldl \
-lpthread \
-lm \
-lglfw


all: debug

debug:override CFLAGS = -g3 -O0 -Wall 

debug:$(OBJS)
    $(CC)  $(CFLAGS) $(LFLAGS)   $(SRC)    -o $(NAME) 

clean:
    @rm -f *.o
  • 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-14T09:48:32+00:00Added an answer on June 14, 2026 at 9:48 am

    You need a glLoadIdentity() before glOrtho().

    glOrtho() doesn’t set the current matrix, it multiplies by it. So set the current matrix to a known-good value (the identity matrix, via glLoadIdentity()) before calling it.

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

Sidebar

Related Questions

I'm having problems sending email via my Ruby code. You can see my full
My app has a tab based layout. Before users can see the main screens
I can see that GD library is for images. But I can't see differences
I can see some potential difficulties with this concept but the idea is: I
I can see that Collections.unmodifiableSet returns an unmodifiable view of the given set but
I believe I have the code for determining if my application has been opened
There has been many Questions recently about drawing PDF's. Yes, you can render PDF's
I can see the Graphical Layout of the XML file within the /res/layout folder,
I can see it looks like an alias for an unsigned int pointer, right?
I can see where svn:keywords like Id, LastChangedDate and Author are used and replaced

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.