Click here to Skip to main content
15,887,214 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionaccess of disk and partition of disk Pin
john563228-Jan-11 0:01
john563228-Jan-11 0:01 
AnswerRe: access of disk and partition of disk Pin
Richard MacCutchan28-Jan-11 1:33
mveRichard MacCutchan28-Jan-11 1:33 
QuestionRe: access of disk and partition of disk Pin
CPallini28-Jan-11 2:32
mveCPallini28-Jan-11 2:32 
QuestionHow Can I Get Pixel Color of a bitmap image? Pin
Amrit Agr27-Jan-11 22:46
Amrit Agr27-Jan-11 22:46 
QuestionRe: How Can I Get Pixel Color of a bitmap image? Pin
CPallini27-Jan-11 23:00
mveCPallini27-Jan-11 23:00 
AnswerRe: How Can I Get Pixel Color of a bitmap image? Pin
User 742933827-Jan-11 23:22
professionalUser 742933827-Jan-11 23:22 
AnswerRe: How Can I Get Pixel Color of a bitmap image? Pin
Code-o-mat28-Jan-11 3:47
Code-o-mat28-Jan-11 3:47 
QuestionHow to load 768*576 image in opengl ? Pin
GAJERA27-Jan-11 21:13
GAJERA27-Jan-11 21:13 
HI ALL

I am trying to load image buffer and update image buffer per second .
The function can load 256*256 image or 512*512 image but it can not load 768*576 image.

I apply it with following function,Please let me know how can i load 768*576 image buffer?.

int iwidth=768;
int iHeight=512;
unsigned char* data = 0;
float angle=1.0f;

BOOL CTestDlg::CreateWindowGL(HWND window) // This Code Creates Our OpenGL Window
{
DWORD windowStyle = WS_OVERLAPPEDWINDOW; // Define Our Window Style
DWORD windowExtendedStyle = WS_EX_APPWINDOW; // Define The Window's Extended Style

int iBitperPixel=16;
PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be
{
sizeof (PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
1, // Version Number
PFD_DRAW_TO_WINDOW | // Format Must Support Window
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
PFD_DOUBLEBUFFER, // Must Support Double Buffering
PFD_TYPE_RGBA, // Request An RGBA Format
iBitperPixel, // Select Our Color Depth
0, 0, 0, 0, 0, 0, // Color Bits Ignored
0, // No Alpha Buffer
0, // Shift Bit Ignored
0, // No Accumulation Buffer
0, 0, 0, 0, // Accumulation Bits Ignored
16, // 16Bit Z-Buffer (Depth Buffer)
0, // No Stencil Buffer
0, // No Auxiliary Buffer
PFD_MAIN_PLANE, // Main Drawing Layer
0, // Reserved
0, 0, 0 // Layer Masks Ignored
};
GLuint PixelFormat; // Will Hold The Selected Pixel Format
CDC *pDc= GetDC(); // Grab A Device Context For This Window
PixelFormat = ChoosePixelFormat (pDc->m_hDC, &pfd); // Find A Compatible Pixel Format

if (SetPixelFormat (pDc->m_hDC, PixelFormat, &pfd) == FALSE) // Try To Set The Pixel Format
{
// Failed
ReleaseDC (pDc); // Release Our Device Context // Zero The Window Handle
return FALSE; // Return False
}

hRC = wglCreateContext (pDc->m_hDC); // Try To Get A Rendering Context
// Make The Rendering Context Our Current Rendering Context
if (wglMakeCurrent (pDc->m_hDC, hRC) == FALSE)
return FALSE;
glViewport (0, 0, (GLsizei)(iwidth), (GLsizei)(iHeight)); // Reset The Current Viewport
glMatrixMode (GL_PROJECTION); // Select The Projection Matrix
glLoadIdentity (); // Reset The Projection Matrix

gluPerspective (45.0f, (GLfloat)(iwidth)/(GLfloat)(iHeight),1.0f, 100.0f); // Calculate The Aspect Ratio Of The Window
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity ();
return TRUE; // Window Creating Was A Success
// Initialization Will Be Done In WM_CREATE
}

BOOL CTestDlg::Initialize()
{
// Start Of User Initialization
angle = 1.0f;
// Set Starting Angle To Zero // Grab A Device Context For Our Dib
glClearColor (0.0f, 0.0f, 0.0f, 0.5f); // Black Background
glClearDepth (1.0f); // Depth Buffer Setup
glDepthFunc (GL_LEQUAL); // The Type Of Depth Testing (Less Or Equal)
glEnable(GL_DEPTH_TEST); // Enable Depth Testing
glShadeModel (GL_SMOOTH); // Select Smooth Shading
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Set Perspective Calculations To Most Accurate

glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); // Set Texture Max Filter
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); // Set Texture Min Filter

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); // Set The Texture Generation Mode For S To Sphere Mapping
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); // Set The Texture Generation Mode For T To Sphere Mapping

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256,256, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
return TRUE; // Return TRUE (Initialization Successful)
}
void CTestDlg::Draw() // Draw Our Scene
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
int i,j;
LoadBmpFile("C:\\test.bmp",i,j);
glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0,i, j, GL_RGB, GL_UNSIGNED_BYTE, data);

if (TRUE) // Is Background Visible?
{
glLoadIdentity(); // Reset The Modelview Matrix
glBegin(GL_QUADS); // Begin Drawing The Background (One Quad)
// Front Face
glTexCoord2f(1.0f, 1.0f);
glVertex3f( 11.0f, 8.3f, -20.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-11.0f, 8.3f, -20.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-11.0f, -8.3f, -20.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f( 11.0f, -8.3f, -20.0f);
glEnd(); // Done Drawing The Background
}
glFlush (); // Flush The GL Rendering Pipeline

}
AnswerRe: How to load 768*576 image in opengl ? Pin
Cedric Moonen27-Jan-11 22:38
Cedric Moonen27-Jan-11 22:38 
GeneralRe: How to load 768*576 image in opengl ? Pin
GAJERA28-Jan-11 17:12
GAJERA28-Jan-11 17:12 
GeneralRe: How to load 768*576 image in opengl ? Pin
Cedric Moonen28-Jan-11 23:51
Cedric Moonen28-Jan-11 23:51 
QuestionHow to let the computer boot at some time? Pin
yu-jian27-Jan-11 15:43
yu-jian27-Jan-11 15:43 
GeneralRe: How to let the computer boot at some time? Pin
Cool_Dev27-Jan-11 17:25
Cool_Dev27-Jan-11 17:25 
GeneralRe: How to let the computer boot at some time? Pin
yu-jian27-Jan-11 19:57
yu-jian27-Jan-11 19:57 
AnswerRe: How to let the computer boot at some time? Pin
CPallini27-Jan-11 22:10
mveCPallini27-Jan-11 22:10 
GeneralRe: How to let the computer boot at some time? Pin
yu-jian28-Jan-11 1:55
yu-jian28-Jan-11 1:55 
QuestionChar To String & Then Array. Pin
Mike Certini27-Jan-11 12:51
Mike Certini27-Jan-11 12:51 
AnswerRe: Char To String & Then Array. Pin
Cool_Dev27-Jan-11 17:23
Cool_Dev27-Jan-11 17:23 
AnswerAnswer: Char To String & Then Array. Pin
Mike Certini27-Jan-11 17:36
Mike Certini27-Jan-11 17:36 
GeneralRe: Answer: Char To String & Then Array. Pin
Richard MacCutchan27-Jan-11 22:57
mveRichard MacCutchan27-Jan-11 22:57 
QuestionCreating .dll linked to Excel, add function error [modified] Pin
jharn27-Jan-11 9:10
jharn27-Jan-11 9:10 
AnswerRe: Creating .dll linked to Excel, add function error Pin
Richard MacCutchan27-Jan-11 10:14
mveRichard MacCutchan27-Jan-11 10:14 
GeneralRe: Creating .dll linked to Excel, add function error [modified] Pin
jharn27-Jan-11 11:10
jharn27-Jan-11 11:10 
GeneralRe: Creating .dll linked to Excel, add function error Pin
T210227-Jan-11 11:44
T210227-Jan-11 11:44 
GeneralRe: Creating .dll linked to Excel, add function error Pin
Richard MacCutchan27-Jan-11 22:43
mveRichard MacCutchan27-Jan-11 22:43 

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.