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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:12:29+00:00 2026-05-22T15:12:29+00:00

void init (void) { glClearColor (1.0, 1.0, 1.0, 0.0); //glMatrixMode(GL_MODELVIEW); //gluLookAt(x0, y0, z0, xref,

  • 0
void init (void)
{
    glClearColor (1.0, 1.0, 1.0, 0.0);

    //glMatrixMode(GL_MODELVIEW);
    //gluLookAt(x0, y0, z0, xref, yref, zref, Vx, Vy, Vz);

    glMatrixMode(GL_PROJECTION);
    gluPerspective(45, 2, -1, 1);
    //glFrustum(xwMin, xwMax, ywMin, ywMax, dnear, dfar);
    //gluPerspective(45.0, 45, -1, 1);
}

void displayFcn (void)
{
    glClear(GL_COLOR_BUFFER_BIT);

    glColor3f(0.0, 1.0, 0.0);
    glPolygonMode(GL_FRONT, GL_FILL);
    glPolygonMode(GL_BACK, GL_LINE);

    glBegin(GL_TRIANGLES);
        glVertex3f(0.0, 0.0, 0.0);
        glVertex3f(0.1, 0.0, 0.0);
        glVertex3f(0.50, 0.866025, 0.0);    
    glEnd();

    glFlush();
}

void reshapeFcn(GLint newWidth, GLint newHeight)
{
    glViewport(0,0,newWidth, newHeight);

    winWidth = newWidth;
    winHeight = newHeight;

}
void main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
    glutInitWindowPosition(400,200);
    glutInitWindowSize(winWidth, winHeight);
    glutCreateWindow("Test");

    init();
    glutDisplayFunc(displayFcn);
    glutReshapeFunc(reshapeFcn);
    glutMainLoop();
}

Could someone explain a little bit and give suggestions how to make that triangle visible.

  • 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-22T15:12:30+00:00Added an answer on May 22, 2026 at 3:12 pm

    I don’t think that you’re allowed to set ‘zNear’ negative. That will do weird things to the depth buffer and mean that you see things behind the eye. Docs say it’s always positive. You’re also liable to get somewhat strange results if you fix the aspect ratio to 2, regardless of the aspect ratio of the window.

    You also need to set the current matrix back to MODEL_VIEW as datenwolf has shown. You don’t need to use gluLookAt, but you need to do something to move the triangle away from the origin where the eye is located. You could do that by setting the z component to some negative value, or by applying a translation before the vertices:

    glPushMatrix();
    glTranslated(0,0,-5);
    glBegin(GL_TRIANGLES);
        glVertex3f(0.0, 0.0, 0.0);
        glVertex3f(0.1, 0.0, 0.0);
        glVertex3f(0.50, 0.866025, 0.0);    
    glEnd();
    glPopMatrix();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

void init(void) { glEnable(GL_DEPTH_TEST); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); } void display(void) { glClearColor(1.0, 1.0, 1.0, 1.0);
void init(void) { glClearColor ((float)0.0, (float)0.0, (float)0.0, (float)0.0); glShadeModel (GL_FLAT); } The parameter of
I try to run the following code: public void Init(Url rootUrl) { var web
-(void) readProductsFromDatabase { // Setup the database object sqlite3 *database; // Init the animals
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Init(); backthread tr=new backthread(); tr.execute(0,0,0); } backthread
Trying to add init parameter names to a list in init(ServletConfig) method. public void
Consider the following class class A{ public void init(){ //do this first; } public
hello everyone I have this snippet of the code: void* Init(int N) { Hand
This is my applet public class TestApplet extends Applet{ public void init(){ } public
I built a custom class named game: .h -(void) init; here I have a

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.