Click here to Skip to main content
15,886,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionResponds to a menu differently from the toolbar button associated Pin
Gagnon Claude23-Nov-09 16:47
Gagnon Claude23-Nov-09 16:47 
AnswerRe: Responds to a menu differently from the toolbar button associated Pin
Richard MacCutchan23-Nov-09 21:45
mveRichard MacCutchan23-Nov-09 21:45 
QuestionHow to create a owner draw menu without a frame shadow like Pros_UIS? Pin
kcynic23-Nov-09 16:29
kcynic23-Nov-09 16:29 
QuestionDownloading a File from the web ? Pin
Jacobb Michael23-Nov-09 16:25
Jacobb Michael23-Nov-09 16:25 
AnswerRe: Downloading a File from the web ? Pin
«_Superman_»23-Nov-09 16:28
professional«_Superman_»23-Nov-09 16:28 
GeneralRe: Downloading a File from the web ? Pin
Jacobb Michael23-Nov-09 19:36
Jacobb Michael23-Nov-09 19:36 
AnswerRe: Downloading a File from the web ? Pin
wangningyu23-Nov-09 16:32
wangningyu23-Nov-09 16:32 
Questionthe opengl code problem? [modified] Pin
thundersun23-Nov-09 16:19
thundersun23-Nov-09 16:19 
#include <windows.h>
#include <stdio.h>
#include <math.h> 
#include <gl\glew.h>
#include <gl\gl.h>
#include <gl\glut.h>
 
static GLfloat f1,f2,f3; 

static void initA(void) 
{ 
GLfloat fogColor[4]={0.0,0.25,0.25,1.0}; 
f1=1.0f; 
f2=5.0f; 
f3=10.0f; 
glEnable(GL_FOG); 
glFogi(GL_FOG_MODE,GL_EXP); 
glFogfv(GL_FOG_COLOR,fogColor); 
glFogf(GL_FOG_DENSITY,0.25); 
glHint(GL_FOG_HINT,GL_DONT_CARE); 
glFogi(GL_FOG_COORDINATE_SOURCE_EXT,GL_FOG_COORDINATE_EXT); 
glClearColor(0.0,0.25,0.25,1.0); 
} 

  void displayA(void) 
  { 
  glClear(GL_COLOR_BUFFER_BIT); 
  glColor3f(1.0,0.75,0.0); 
  glBegin(GL_TRIANGLES); 
  glFogCoordfEXT(f1); 
  glVertex3f(0.2f,0.2f,0.0f); 
  glFogCoordfEXT(f2); 
  glVertex3f(-0.2f,0.0f,-0.5f); 
  glFogCoordfEXT(f3); 
  glVertex3f(0.0f,0.2f,-1.0f); 
  glEnd(); 
  //glFlush(); 
  glutSwapBuffers(); 
  } 
void reshapeA(int w,int h) 
{ 
glViewport(0,0,(GLint)w,(GLint)h); 
glMatrixMode(GL_PROJECTION); 
glLoadIdentity(); 
gluPerspective(45.0,1.0,0.25,25.0); 
glMatrixMode(GL_MODELVIEW); 
glLoadIdentity(); 
glTranslatef(0.0,0.0,-5.0); 
} 
  void keyboardA(unsigned char key,int x,int y) 
  { 
  switch(key) 
  { 
  case 'c': 
        glFogi(GL_FOG_COORDINATE_SOURCE_EXT,GL_FRAGMENT_DEPTH); 
glutPostRedisplay(); 
break; 
  case 'C': 
  glFogi(GL_FOG_COORDINATE_SOURCE_EXT,GL_FOG_COORDINATE); 
  glutPostRedisplay(); 
break; 
case '1': 
f1=f1+0.25; 
  glutPostRedisplay(); 
break; 
case '2': 
f2=f2+0.25; 
  glutPostRedisplay(); 
break; 
case '3': 
f3=f3+0.25; 
  glutPostRedisplay(); 
break; 
case '8': 
if(f1&amp;amp;amp;amp;amp;amp;gt;0.25) 
{ 
f1=f1-0.25; 
    glutPostRedisplay(); 
} 
break; 
case '9': 
if(f2&amp;amp;amp;amp;amp;amp;gt;0.25) 
{ 
f2=f2-0.25; 
    glutPostRedisplay(); 
}   
break; 
case '0': 
  if(f3&amp;amp;amp;amp;amp;amp;gt;0.25) 
{ 
f3=f3-0.25; 
    glutPostRedisplay(); 
} 
break; 
case 'b': 
glMatrixMode(GL_MODELVIEW); 
glTranslatef(0.0,0.0,-0.25); 
glutPostRedisplay(); 
break; 
case 'f': 
glMatrixMode(GL_MODELVIEW); 
glTranslatef(0.0,0.0,0.25); 
glutPostRedisplay(); 
break; 
  case 27: 
  exit(0); 
  break; 
      default: 
  break; 
  } 
  } 
int main(int argc,char** argv) 
{ 
glutInit(&amp;amp;amp;amp;amp;amp;amp;argc,argv); 
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); 
glutInitWindowSize(400,400); 
glutCreateWindow("Fog effect Demo"); 
initA(); 
glutReshapeFunc(reshapeA); 
glutKeyboardFunc(keyboardA); 
glutDisplayFunc(displayA); 
glutMainLoop(); 
return 0; 
}

The code can be impiled,but it can not run. when it runs, the operate system give an exception message.I use vc6.0 as a tool.

modified on Tuesday, November 24, 2009 4:02 AM

AnswerRe: the opengl code problem? Pin
Tim Craig23-Nov-09 18:28
Tim Craig23-Nov-09 18:28 
GeneralRe: the opengl code problem? Pin
thundersun23-Nov-09 19:29
thundersun23-Nov-09 19:29 
GeneralRe: the opengl code problem? Pin
Cedric Moonen23-Nov-09 20:26
Cedric Moonen23-Nov-09 20:26 
GeneralRe: the opengl code problem? Pin
thundersun23-Nov-09 22:06
thundersun23-Nov-09 22:06 
AnswerRe: the opengl code problem? Pin
Cedric Moonen24-Nov-09 1:29
Cedric Moonen24-Nov-09 1:29 
GeneralRe: the opengl code problem? Pin
thundersun24-Nov-09 14:17
thundersun24-Nov-09 14:17 
QuestionSending array through pipe Pin
forensicgeek23-Nov-09 13:43
forensicgeek23-Nov-09 13:43 
AnswerRe: Sending array through pipe Pin
«_Superman_»23-Nov-09 13:57
professional«_Superman_»23-Nov-09 13:57 
GeneralRe: Sending array through pipe Pin
forensicgeek23-Nov-09 15:36
forensicgeek23-Nov-09 15:36 
Questionsprintf Pin
su_marvel23-Nov-09 11:24
su_marvel23-Nov-09 11:24 
AnswerRe: sprintf Pin
Richard MacCutchan23-Nov-09 12:18
mveRichard MacCutchan23-Nov-09 12:18 
AnswerRe: sprintf Pin
«_Superman_»23-Nov-09 12:32
professional«_Superman_»23-Nov-09 12:32 
GeneralRe: sprintf Pin
Richard MacCutchan23-Nov-09 13:30
mveRichard MacCutchan23-Nov-09 13:30 
GeneralRe: sprintf Pin
«_Superman_»23-Nov-09 13:32
professional«_Superman_»23-Nov-09 13:32 
GeneralRe: sprintf Pin
Richard MacCutchan23-Nov-09 14:02
mveRichard MacCutchan23-Nov-09 14:02 
GeneralRe: sprintf Pin
Tim Craig23-Nov-09 18:31
Tim Craig23-Nov-09 18:31 
QuestionCreate HDC from n image file? Pin
o m n i23-Nov-09 10:30
o m n i23-Nov-09 10:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.