Thread: What's wrong with this( if not everything )?

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    40

    What's wrong with this( if not everything )?

    Code:
    #include <windows.h>
    #include <GL/gl.h>
    #include <GL/glu.h>
    int APIENTRY WinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPSTR     lpCmdLine,
                         int       nCmdShow)
    {
    glClearColor (0.0, 0.0, 0.0, 0.0);
    glClear (GL_COLOR_BUFFER_BIT);
    glColor3f (1.0, 1.0, 1.0);
    glOrtho(0.0, 1.0, 0.0, 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();
    glFlush();
    }
    Am I close?
    I'm using Dev-C++ and I don't get an error when I compile it but I get something else. I'd show it but I get an error message when I try. IM me on AIM and I can show you what it is.
    NaRutoMeTis
    Last edited by ShadowMetis; 03-22-2004 at 08:58 PM.
    Code:
    #include <iostream.h>
    int var;
    int test();
    int main() { 
     cout << "Please input your language:\n 1. C (C,C++,C#)\n 2. VB\n 3. Other\n";
     cin >> var;
     return test(); }
    int test() {  
     if(var == 1) {
      cout << "Y0u 4r3 t3h 1337\n";
      system("PAUSE");
      return main(); }
     else if(var == 2) {
      cout << "N00B3R!\n";
      system("PAUSE");
      return main(); }
     else if(var == 3) {
      cout << "You were not thought of.\n";
      system("PAUSE");
      return main(); }
     else {      
      return 0; }}

  2. #2
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    I use glut, but I don't see a glMatrixMode, glLoadIdentity, and I don't know if you need to create a window like in glut. But that is what I see. example code in glut to compare
    Code:
    #include <GL/gl.h>
    #include <GL/glut.h>
    
    void init(void){
         glClearColor(0.0,0.0,0.0,0.0);
         glShadeModel(GL_FLAT);
    }
    
    void display(void){
         glClear(GL_COLOR_BUFFER_BIT);
         glColor3f(0.0,0.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();
         glFlush();
    }
    
    int main(int argc,char **argv){
         glutInit(&argc,argv);
         glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
         glutInitWindowSize(250,250);
         glutInitWindowPosition(100,100);
         glutCreateWindow("Hey");
         init();
         glMatrixMode(GL_PROJECTION);
         glLoadIdentity();
         glOrtho(0.0,1.0,0.0,1.0,-1.0,0.0);
         glutDisplayFunc(display);
         glutMainLoop();
         return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 07-15-2004, 03:30 PM
  2. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 10:50 PM
  3. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  5. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM