5 Replies - 2081 Views - Last Post: 28 May 2010 - 12:19 AM Rate Topic: -----

#1 Guest_Jake*


Reputation:

OpenGL In devc++

Posted 26 May 2010 - 10:04 PM

I am trying to learn OpenGL from a Book called Addison.Wesley.OpenGL.Programming.Guide.7th.Ed

But my question is

Can I write the OpenGL code in devc++ ?

And What should I do So i can Compile it

How should I add library Can anybody give me a reference or step by step info
Is This A Good Question/Topic? 0

Replies To: OpenGL In devc++

#2 Guest_Jake*


Reputation:

Re: OpenGL In devc++

Posted 26 May 2010 - 10:14 PM

This thing actually isnt working I copied it from the book
Addison.Wesley.OpenGL.Programming.Guide.7th.Ed

And trying it I included windows.h and <GL3/gl3.h>

But still not working please help

  
void display(void) 
{ 
/*  clear all pixels  */ 
     glClear(GL_COLOR_BUFFER_BIT); 


/*   draw white polygon (rectangle) with corners at 
            *   (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0) 
            */ 
                glColor3f(1.0, 1.0, 1.0); 
                glBegin(GL_POLYGON); 
                    glVertex3f(0.25, 0.25, 0.0); 
                    glVertex3f(0.75, 0.25, 0.0); 
                    glVertex3f(0.75, 0.75, 0.0); 
                    glVertex3f(0.25, 0.75, 0.0); 
                glEnd(); 

           /*   don’t wait! 
            *   start processing buffered OpenGL routines 
            */ 
                glFlush(); 
           } 

           void init(void) 
           { 
           /*   select clearing (background) color               */ 
                glClearColor(0.0, 0.0, 0.0, 0.0); 

           /*   initialize viewing values  */ 
                glMatrixMode(GL_PROJECTION); 
                glLoadIdentity(); 
                glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); 
           } 

           /* 
            *   Declare initial window size, position, and display mode 
            *   (single buffer and RGBA).  Open window with “hello” 
            *   in its title bar.  Call initialization routines. 
            *   Register callback function to display graphics. 
            *   Enter main loop and process events. 
            */ 
           int main(int argc, char** argv) 
           { 
                glutInit(&argc, argv); 
                glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); 
                glutInitWindowSize(250, 250); 
                glutInitWindowPosition(100, 100); 
                glutCreateWindow(“hello”); 
                init(); 
                glutDisplayFunc(display); 
                glutMainLoop(); 
                return 0;     /* ISO C requires main to return int. */ 
           } 




I don't know i posted it in correct secion or not please check it and move to appropriate
Was This Post Helpful? 0

#3 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: OpenGL In devc++

Posted 26 May 2010 - 10:34 PM

Quote

Can I write the OpenGL code in devc++ ?
Yes, but I wouldn't. Just use Visual C++ 2010.

Quote

And What should I do So i can Compile it
Just like any other program.

Quote

How should I add library Can anybody give me a reference or step by step info
Search online for compiler specific instructions.

Quote

This thing actually isnt working
Define "not working". Do your home lights flicker? Do you see big red words on the screen that says "NOT WORKING"?

Please give observations. Without information, we cannot help you.
Was This Post Helpful? 0
  • +
  • -

#4 Guest_jake*


Reputation:

Re: OpenGL In devc++

Posted 26 May 2010 - 10:43 PM

Quote

Define "not working". Do your home lights flicker? Do you see big red words on the screen that says "NOT WORKING"?

Please give observations. Without information, we cannot help you.


Sorry man but i am trying to learn it and this is the first program I entered in Which i actually copied But it isn't giving output It says this not defined that not defined

And i don't even have a tiny bit Of idea bout What OpenGL is so how can i tell u what is the observation?

Can u please tell me anything more about it ? and why it is not working

And one more thing i didn't found any thing about adding library to dev c++ still i am searching
Was This Post Helpful? 0

#5 janotte  Icon User is offline

  • code > sword
  • member icon

Reputation: 990
  • View blog
  • Posts: 5,141
  • Joined: 28-September 06

Re: OpenGL In devc++

Posted 27 May 2010 - 03:07 AM

I think you may have started too far into the challenge.

Before you do all this OpenGL stuff you need to master the basics of compiling code, reading and understanding error messages and warning messages.

Until you have these foundations in place you will be knocking yourself out trying to do too much all at once.

Put your current book on the shelf for a couple of months and go get yourself a better book to start with.

Have a read here for a selection to choose from:
http://www.dreaminco...ns-for-c-books/
Was This Post Helpful? 0
  • +
  • -

#6 taylorc8  Icon User is offline

  • B&

Reputation: 149
  • View blog
  • Posts: 1,572
  • Joined: 21-July 09

Re: OpenGL In devc++

Posted 28 May 2010 - 12:19 AM

Well, do you have GLUT installed? Is that your problem?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1