question

rahmatsyah-0199 avatar image
0 Votes"
rahmatsyah-0199 asked SimpleSamples answered

why is glfwOpenWindow not running on this program

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 );
}

c++
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SimpleSamples avatar image
1 Vote"
SimpleSamples answered

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.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.