Click here to Skip to main content
15,897,226 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: _Connection as parameter in IDL file Pin
MrKBA27-Oct-09 9:31
MrKBA27-Oct-09 9:31 
GeneralRe: _Connection as parameter in IDL file Pin
Stuart Dootson27-Oct-09 9:37
professionalStuart Dootson27-Oct-09 9:37 
GeneralRe: _Connection as parameter in IDL file Pin
MrKBA27-Oct-09 9:44
MrKBA27-Oct-09 9:44 
GeneralRe: _Connection as parameter in IDL file Pin
MrKBA27-Oct-09 10:45
MrKBA27-Oct-09 10:45 
GeneralRe: _Connection as parameter in IDL file Pin
Stuart Dootson27-Oct-09 13:06
professionalStuart Dootson27-Oct-09 13:06 
QuestionMy texture Problem Pin
Archy_Yu25-Oct-09 21:43
Archy_Yu25-Oct-09 21:43 
AnswerRe: My texture Problem Pin
Cedric Moonen25-Oct-09 22:01
Cedric Moonen25-Oct-09 22:01 
GeneralRe: My texture Problem Pin
Archy_Yu26-Oct-09 4:43
Archy_Yu26-Oct-09 4:43 
unsigned int ID;                /** < 生成纹理的ID号 */ 
      int imageWidth;                  /** < 图像宽度 */ 
      int imageHeight;                /** < 图像高度 */ 
      unsigned char *image;            /** < 指向图像数据的指针 */ 
FILE *pFile = 0; 


BITMAPINFOHEADER bitmapInfoHeader; 
BITMAPFILEHEADER header; 
  
unsigned char textureColors = 0; 

pFile = fopen("桌面.bmp", "rb"); 
if(pFile == 0) return false; 

fread(&header, sizeof(BITMAPFILEHEADER), 1, pFile); 

if(header.bfType != BITMAP_ID) 
  { 
  fclose(pFile);            
  return false; 
  } 

fread(&bitmapInfoHeader, sizeof(BITMAPINFOHEADER), 1, pFile); 

imageWidth = bitmapInfoHeader.biWidth; 
    imageHeight = bitmapInfoHeader.biHeight; 

    
  if(bitmapInfoHeader.biSizeImage == 0) 
      bitmapInfoHeader.biSizeImage = bitmapInfoHeader.biWidth * 
      bitmapInfoHeader.biHeight * 3; 


fseek(pFile, header.bfOffBits, SEEK_SET); 


image = new unsigned char[bitmapInfoHeader.biSizeImage]; 


fread(image, 1, bitmapInfoHeader.biSizeImage, pFile); 


for(int index = 0; index < (int)bitmapInfoHeader.biSizeImage; index+=3) 
  { 
  textureColors = image[index]; 
  image[index] = image[index + 2]; 
  image[index + 2] = textureColors; 
  } 
  
fclose(pFile);    
    glPixelStorei(GL_UNPACK_ALIGNMENT,1); 

glGenTextures(1, &ID); 
    
    glBindTexture(GL_TEXTURE_2D, ID); 

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); 
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); 

    gluBuild2DMipmaps(GL_TEXTURE_2D, 3, imageWidth, 
                  imageHeight, GL_RGB, GL_UNSIGNED_BYTE, 
                  image); 

glEnable(GL_TEXTURE_2D); 
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE); 

glPushMatrix(); 
glScaled(45.0,30.0,0); 
glBindTexture(GL_TEXTURE_2D, ID); 
glBegin(GL_QUADS); 
glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.0f, -1.0f, 0.0f); 
glTexCoord2f(1.0f, 0.0f); glVertex3f(-2.0f,  1.0f, 0.0f); 
glTexCoord2f(1.0f, 1.0f); glVertex3f( 0.0f,  1.0f, 0.0f); 
glTexCoord2f(0.0f, 1.0f); glVertex3f( 0.0f, -1.0f, 0.0f); 

glEnd(); 
glPopMatrix(); 


GLvoid ReShapeGLScene( GLsizei width,GLsizei height ) 
{ 
glViewport(0,0,(GLsizei)width,(GLsizei)height); 
glMatrixMode(GL_PROJECTION); 
glLoadIdentity(); 
glOrtho((GLdouble)-450.0,(GLdouble)450.0,(GLdouble)-300.0,(GLdouble)300.0,50.0,-10.0); 
glMatrixMode(GL_MODELVIEW); 
glLoadIdentity(); 
} 


static PIXELFORMATDESCRIPTOR  pfd = 
{ 
sizeof(PIXELFORMATDESCRIPTOR), 
1, 
PFD_DRAW_TO_WINDOW| 
PFD_SUPPORT_OPENGL| 
PFD_DOUBLEBUFFER, 
PFD_TYPE_RGBA, 
24, 
0,0,0,0,0,0, 
0, 
0, 
0, 
0,0,0,0, 
32, 
0, 
0, 
PFD_MAIN_PLANE, 
0, 
0,0,0 
}; 


The above is my code, and my GPU is nViDIA Geforce G210M

Thanks
GeneralRe: My texture Problem Pin
Cedric Moonen26-Oct-09 4:59
Cedric Moonen26-Oct-09 4:59 
QuestionHow can i Get viewtype from Dialog? Pin
002comp25-Oct-09 21:29
002comp25-Oct-09 21:29 
AnswerRe: How can i Get viewtype from Dialog? Pin
Richard MacCutchan25-Oct-09 22:31
mveRichard MacCutchan25-Oct-09 22:31 
GeneralRe: How can i Get viewtype from Dialog? Pin
002comp25-Oct-09 22:35
002comp25-Oct-09 22:35 
GeneralRe: How can i Get viewtype from Dialog? Pin
Naveen25-Oct-09 23:34
Naveen25-Oct-09 23:34 
GeneralRe: How can i Get viewtype from Dialog? Pin
David Crow26-Oct-09 3:43
David Crow26-Oct-09 3:43 
GeneralRe: How can i Get viewtype from Dialog? Pin
002comp26-Oct-09 19:56
002comp26-Oct-09 19:56 
AnswerRe: How can i Get viewtype from Dialog? Pin
David Crow27-Oct-09 3:05
David Crow27-Oct-09 3:05 
QuestionListBox Pin
MsmVc25-Oct-09 20:57
MsmVc25-Oct-09 20:57 
QuestionHow to print whole dialog box in vc++,mfc Pin
prerananit25-Oct-09 20:54
prerananit25-Oct-09 20:54 
AnswerRe: How to print whole dialog box in vc++,mfc Pin
Code-o-mat25-Oct-09 22:27
Code-o-mat25-Oct-09 22:27 
Question[Message Deleted] Pin
eswar pothula25-Oct-09 20:03
eswar pothula25-Oct-09 20:03 
AnswerRe: how to convert tiff to pdf and pdf to tiff Pin
Game-point25-Oct-09 20:37
Game-point25-Oct-09 20:37 
GeneralRe: how to convert tiff to pdf and pdf to tiff Pin
eswar pothula25-Oct-09 21:35
eswar pothula25-Oct-09 21:35 
AnswerRe: how to convert tiff to pdf and pdf to tiff Pin
Game-point25-Oct-09 20:49
Game-point25-Oct-09 20:49 
GeneralRe: how to convert tiff to pdf and pdf to tiff Pin
eswar pothula25-Oct-09 23:57
eswar pothula25-Oct-09 23:57 
QuestionList Control Selection Pin
hellogany25-Oct-09 19:37
hellogany25-Oct-09 19:37 

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.