Click here to Skip to main content
15,880,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: While loop not working on C. Pin
asa7612-Oct-17 6:33
asa7612-Oct-17 6:33 
QuestionRe: While loop not working on C. Pin
David Crow13-Oct-17 2:40
David Crow13-Oct-17 2:40 
QuestionCTreeObject class Pin
_Flaviu3-Oct-17 22:59
_Flaviu3-Oct-17 22:59 
AnswerRe: CTreeObject class Pin
«_Superman_»3-Oct-17 23:07
professional«_Superman_»3-Oct-17 23:07 
GeneralRe: CTreeObject class Pin
_Flaviu5-Oct-17 21:38
_Flaviu5-Oct-17 21:38 
QuestionCImage processing Pin
rbrunton3-Oct-17 2:03
rbrunton3-Oct-17 2:03 
GeneralRe: CImage processing Pin
Richard MacCutchan3-Oct-17 7:53
mveRichard MacCutchan3-Oct-17 7:53 
Questionraytracer Pin
bluatigro29-Sep-17 3:36
bluatigro29-Sep-17 3:36 
i m building a raytracer from scratch
i need a saveBMP function

this is version 0.1

i got this far :
nclude <iostream>

typedef struct tagBITMAPFILEHEADER {
  WORD  bfType ;
  DWORD bfSize ;
  WORD  bfReserved1 ;
  WORD  bfReserved2 ;
  DWORD bfOffBits ;
} BITMAPFILEHEADER , *PBITMAPFILEHEADER ;

typedef struct tagBITMAPINFOHEADER {
  DWORD biSize ;
  LONG  biWidth ;
  LONG  biHeight ;
  WORD  biPlanes ;
  WORD  biBitCount ;
  DWORD biCompression ;
  DWORD biSizeImage ;
  LONG  biXPelsPerMeter ;
  LONG  biYPelsPerMeter ;
  DWORD biClrUsed ;
  DWORD biClrImportant ;
} BITMAPINFOHEADER , *PBITMAPINFOHEADER ;

typedef struct PIXEL {
  unsigned char r , g , b ;
} ;

const int screenx = 800 ;
const int screeny = 600 ;

PIXEL pixel[ screenx ][ screeny ] ;

void saveBMP()
{
//todo :
//fill bitmapfileheader
//fill bitmapinfoheader
//open file
//  write bitmapfileheader
//  write bitmapinfoheader
//  write pixel data
//close file
}

int main()
{
  int x , y ;
  for ( x = 0 ; x < screenx ; x++ )
  {
    for ( y = 0 ; y < screeny ; y++ )
    {
      pixel[ x ][ y ].r = 255 ;
      pixel[ x ][ y ].g = 127 ;
      pixel[ x ][ y ].b = 0 ;
    }
  }
  saveBMP() ;
}

QuestionRe: raytracer Pin
David Crow29-Sep-17 4:21
David Crow29-Sep-17 4:21 
AnswerRe: raytracer Pin
Jochen Arndt29-Sep-17 4:24
professionalJochen Arndt29-Sep-17 4:24 
GeneralRe: raytracer Pin
leon de boer30-Sep-17 7:50
leon de boer30-Sep-17 7:50 
GeneralRe: raytracer Pin
Jochen Arndt30-Sep-17 22:14
professionalJochen Arndt30-Sep-17 22:14 
AnswerRe: raytracer Pin
Rick York29-Sep-17 4:44
mveRick York29-Sep-17 4:44 
GeneralRe: raytracer Pin
leon de boer30-Sep-17 7:39
leon de boer30-Sep-17 7:39 
GeneralRe: raytracer Pin
bluatigro1-Oct-17 0:35
bluatigro1-Oct-17 0:35 
GeneralRe: raytracer Pin
bluatigro1-Oct-17 1:00
bluatigro1-Oct-17 1:00 
GeneralRe: raytracer Pin
leon de boer1-Oct-17 4:45
leon de boer1-Oct-17 4:45 
GeneralRe: raytracer Pin
bluatigro1-Oct-17 5:56
bluatigro1-Oct-17 5:56 
GeneralRe: raytracer Pin
leon de boer1-Oct-17 16:20
leon de boer1-Oct-17 16:20 
GeneralRe: raytracer Pin
bluatigro2-Oct-17 1:34
bluatigro2-Oct-17 1:34 
GeneralRe: raytracer Pin
leon de boer2-Oct-17 3:46
leon de boer2-Oct-17 3:46 
GeneralRe: raytracer Pin
leon de boer2-Oct-17 10:00
leon de boer2-Oct-17 10:00 
GeneralRe: raytracer Pin
bluatigro2-Oct-17 22:57
bluatigro2-Oct-17 22:57 
GeneralRe: raytracer Pin
leon de boer3-Oct-17 4:47
leon de boer3-Oct-17 4:47 
GeneralRe: raytracer Pin
bluatigro6-Oct-17 1:30
bluatigro6-Oct-17 1: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.