why is glfwOpenWindow not running on this program

rahmat syah 1 Reputation point
2021-06-08T08:20:17.007+00:00

include <GL\glew.h>

include <GLFW\glfw3.h>

include <iostream>

include <windows.h>

void mulaiOpenGL(void);
int main(void){

mRunning = TRUE;
mRunning = FALSE;
GLuint mRunning = GL_TRUE;
if( glfwInit() == GL_FALSE ){
MessageBox( NULL, "ERROR :: gagal menginisialisasi GLFW", "Error!", MB_OK);

return(0);}
if( glfwOpenWindow( 640, 480, 0, 0, 0, 0, 24, 0, GLFW_WINDOW ) == GL_FALSE ){
MessageBox( NULL, "ERROR :: gagal membuat window", "Error!", MB_OK );
glfwTerminate();
return(0);}
glfwSetWindowTitle("Praktikum Grafik Komputer LabTI");
glfwSwapInterval( 1 );
mulaiOpenGL();
int r;
while( mRunning ){
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glLoadIdentity();
gluLookAt (10,10,10,0, 0,0,0,1,0) ;
glRotatef(r++,0,0,1);
glBegin (GL_TRIANGLES) ;
glColor3f (1,0,0);
glVertex3f (0,5,0);
glVertex3f (4,5,0);
glVertex3f (2,0,2);
glColor3f (1,0,1);
glVertex3f (4,5,0);
glVertex3f (4,5,4);
glVertex3f (2,0,2);
glColor3f (1,1,0);
glVertex3f (4,5,4);
glVertex3f (0,5,4);
glVertex3f (2,0,2);
glColor3f (1,1,1);
glVertex3f (0,5,4);
glVertex3f (0,5,0);
glVertex3f (2,0,2);
glColor3f (1,1,1);
glVertex3f (0,5,0);
glVertex3f (4,5,0);
glVertex3f (2,10,2);
glColor3f (1,0,0);
glVertex3f (4,5,0);
glVertex3f (4,5,4);
glVertex3f (2,10,2);
glColor3f (1,1,1);
glVertex3f (4,5,4);
glVertex3f (0,5,4);
glVertex3f (2,10,2);
glColor3f (1,1,0);
glVertex3f (0,5,4);
glVertex3f (0,5,0);
glVertex3f (2,10,2);
glEnd ();
glfwSwapBuffers();
mRunning = !glfwGetKey( GLFW_KEY_ESC ) && glfwGetWindowParam( GLFW_OPENED );}
glfwTerminate();
return(0);}
void mulaiOpenGL(void){
glViewport( 0, 0, 640, 480 );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 60.0f, 640.0f/480.0f, 0.1f, 1000.0f );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glShadeModel( GL_SMOOTH );
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glClearDepth( 1.0f );
glEnable( GL_DEPTH_TEST );
glDepthFunc( GL_LEQUAL );
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
}

Developer technologies | C++
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sam of Simple Samples 5,546 Reputation points
    2021-06-09T00:21:11.46+00:00

    What does not running mean? Does it compile or do you get an error during execution?

    I am not an OpenGL expert but one problem seems to be that for version 3 we are supposed to use glfwCreateWindow instead of glfwOpenWindow. See GLFW: Moving from GLFW 2 to 3. I seem to have had success with the sample in Creating the OpenGL rendering window using GLFW - Learn OpenGL except I think I copied processInput from LearnOpenGL - Hello Window.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.