Click here to Skip to main content
15,922,533 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Column Count ? Pin
kk.tvm7-Jun-08 3:17
kk.tvm7-Jun-08 3:17 
AnswerRe: Column Count ? Pin
Hamid_RT7-Jun-08 21:17
Hamid_RT7-Jun-08 21:17 
QuestionFocus on ListCtrl. Pin
Le@rner6-Jun-08 23:36
Le@rner6-Jun-08 23:36 
AnswerRe: Focus on ListCtrl. Pin
Hamid_RT7-Jun-08 21:16
Hamid_RT7-Jun-08 21:16 
GeneralRe: Focus on ListCtrl. Pin
Le@rner8-Jun-08 18:31
Le@rner8-Jun-08 18:31 
QuestionShutdown a remote machine ? (VC++) Pin
mrin6-Jun-08 23:21
mrin6-Jun-08 23:21 
AnswerRe: Shutdown a remote machine ? (VC++) Pin
Gary R. Wheeler7-Jun-08 1:07
Gary R. Wheeler7-Jun-08 1:07 
QuestionVC++ 6, MFC, ComboBox, load list from file? [modified] Pin
rolfhorror6-Jun-08 22:57
rolfhorror6-Jun-08 22:57 
AnswerRe: VC++ 6, MFC, ComboBox, load list from file? Pin
sudhir_Kumar6-Jun-08 23:25
sudhir_Kumar6-Jun-08 23:25 
GeneralRe: VC++ 6, MFC, ComboBox, load list from file? Pin
rolfhorror6-Jun-08 23:27
rolfhorror6-Jun-08 23:27 
AnswerRe: VC++ 6, MFC, ComboBox, load list from file? Pin
Hamid_RT7-Jun-08 20:00
Hamid_RT7-Jun-08 20:00 
QuestionAccessing variables in nested classes Pin
pl_kode6-Jun-08 22:37
pl_kode6-Jun-08 22:37 
AnswerRe: Accessing variables in nested classes Pin
Saurabh.Garg7-Jun-08 2:24
Saurabh.Garg7-Jun-08 2:24 
AnswerRe: Accessing variables in nested classes Pin
CPallini7-Jun-08 4:56
mveCPallini7-Jun-08 4:56 
AnswerRe: Accessing variables in nested classes Pin
pl_kode8-Jun-08 18:46
pl_kode8-Jun-08 18:46 
GeneralRe: Accessing variables in nested classes Pin
pl_kode8-Jun-08 21:00
pl_kode8-Jun-08 21:00 
QuestionSearch Date in Access Database. Pin
Le@rner6-Jun-08 22:20
Le@rner6-Jun-08 22:20 
AnswerRe: Search Date in Access Database. Pin
sudhir_Kumar6-Jun-08 23:03
sudhir_Kumar6-Jun-08 23:03 
GeneralRe: Search Date in Access Database. Pin
Le@rner6-Jun-08 23:22
Le@rner6-Jun-08 23:22 
QuestionVC++ 2005 no exe Pin
rp_suman6-Jun-08 22:01
rp_suman6-Jun-08 22:01 
AnswerRe: VC++ 2005 no exe Pin
ShilpiP6-Jun-08 22:28
ShilpiP6-Jun-08 22:28 
GeneralRe: VC++ 2005 no exe Pin
rp_suman6-Jun-08 22:37
rp_suman6-Jun-08 22:37 
GeneralRe: VC++ 2005 no exe Pin
sudhir_Kumar6-Jun-08 23:01
sudhir_Kumar6-Jun-08 23:01 
QuestionGeting MAX TEXTURE SIZE 1024 for a perticular pixel format? Pin
Soumyadipta6-Jun-08 21:00
Soumyadipta6-Jun-08 21:00 
Different max texture size for PFD_DRAW_TO_BITMAP & PFD_DRAW_TO_WINDOW.

Is there is any solution to get same max texture size?

1. I am using CreateDIBSection() for off screen rendering.
2. Which is working fine in my code as listed below.
3. But i am getting problem with textures as i am getting max texture size is 1024
4. I am getting desired 4096 texture size when i render to application window.
5. Pixel format of main application window and offscreen window is different.
6. The difference of pixel format and returned max texture size is mentioned below.


How can i get 4096 max texture size for off screen window also?

Getting 1024 max texture size
PFD_DRAW_TO_BITMAP |
PFD_SUPPORT_OPENGL |
PFD_STEREO_DONTCARE,
PFD_TYPE_RGBA,

Getting 4096 max texture size
PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,

What pixel format should i use to get 4096 max texture size.






bool Create(unsigned int width, unsigned int height)
{	

	// Create a p-buffer for off-screen rendering

	m_uiWidth = width;
	m_uiHeight = height;

	m_hWnd = g_pMainApplicationWindow->GetHWND();		

	m_hMainApplicationWindowDC = g_pMainApplicationWindow->GetHDC();
	m_hMainApplicationWindowRC = g_pMainApplicationWindow->GetHGLRC();			
	
	memset(&m_bmi, 0, sizeof(BITMAPINFO));
	m_bmi.bmiHeader.biSize			= sizeof(BITMAPINFOHEADER);
	m_bmi.bmiHeader.biWidth			= m_uiWidth;
	m_bmi.bmiHeader.biHeight		= m_uiHeight;
	m_bmi.bmiHeader.biPlanes		= 1;
	m_bmi.bmiHeader.biBitCount		= 32;
	m_bmi.bmiHeader.biCompression	= BI_RGB;
	m_bmi.bmiHeader.biSizeImage		= m_uiWidth * m_uiHeight * 4;

	// Create DIB
	HDC	hDC = ::GetDC(m_hWnd);
	m_hDib = ::CreateDIBSection(hDC, &m_bmi, DIB_RGB_COLORS, (void**)&m_pTextureData, NULL, (DWORD)0);
	ReleaseDC(m_hWnd, hDC);
	
	m_hMemDC = ::CreateCompatibleDC(NULL);
	if(!m_hMemDC)
	{
		DeleteObject(m_hDib);
		m_hDib = NULL;
		return (false);
	}

	m_hOldDib = SelectObject(m_hMemDC, m_hDib);

	// Setup memory DC's pixel format.
	if (!SetDCPixelFormat(m_hMemDC, PFD_DRAW_TO_BITMAP | PFD_SUPPORT_OPENGL | PFD_STEREO_DONTCARE))
	{
		SelectObject(m_hMemDC, m_hOldDib);
		DeleteObject(m_hDib);
		m_hDib = NULL;
		DeleteDC(m_hMemDC);
		m_hMemDC = NULL;
		return (false);
	}
	
	m_hRC = ::wglCreateContext(m_hMemDC);
	if (!m_hRC)
	{
		SelectObject(m_hMemDC, m_hOldDib);
		DeleteObject(m_hDib);
		m_hDib = NULL;
		DeleteDC(m_hMemDC);
		m_hMemDC = NULL;
		return (false);
	}		
}

bool SetDCPixelFormat(HDC hDC, DWORD dwFlags)
{
	HDC NewHdc = hDC;	

	static PIXELFORMATDESCRIPTOR pixelDesc =
	{
		sizeof(PIXELFORMATDESCRIPTOR),
		1,
		PFD_DRAW_TO_BITMAP |
		PFD_SUPPORT_OPENGL |
		PFD_STEREO_DONTCARE,		
		PFD_TYPE_RGBA,
		32,
		0, 0, 0, 0, 0, 0,
		0,
		0,
		0,
		0, 0, 0, 0,
		16,  
		1, // Use stencil buffer
		0,
		PFD_MAIN_PLANE,
		0,
		0, 0, 0
	};	
		
	GLuint PixelFormat;
	
	int nPixelIndex = ::ChoosePixelFormat(NewHdc, &pixelDesc);
	if (nPixelIndex == 0) // Choose default
	{		
		nPixelIndex = 1;
		if (::DescribePixelFormat(hDC, nPixelIndex, 
			sizeof(PIXELFORMATDESCRIPTOR), &pixelDesc) == 0)
			return false;
	}

	if (!::SetPixelFormat(hDC, nPixelIndex, &pixelDesc))
		return false;

	return true;
}

bool DIBBuffer::StartRendering(void)
{	
	wglMakeCurrent(m_hMemDC, m_hRC);
	BitBlt();

	GLint  texSize;
	glGetIntegerv( GL_MAX_TEXTURE_SIZE, &texSize );

	//i am getting max texture size 1024
	//but when i use the below format i am getting 4096 max texture size

	static PIXELFORMATDESCRIPTOR pfd =
	{
		sizeof(PIXELFORMATDESCRIPTOR),
		1,
		PFD_DRAW_TO_WINDOW |
		PFD_SUPPORT_OPENGL |
		PFD_DOUBLEBUFFER,
		PFD_TYPE_RGBA,
		MAIN_APPLICATION_WINDOW_BITS_PER_PIXEL,
		0, 0, 0, 0, 0, 0,
		0,
		0,
		0,
		0, 0, 0, 0,
		16,  
		1, // Use stencil buffer
		0,
		PFD_MAIN_PLANE,
		0,
		0, 0, 0
	};
}

Questionuse of Validation for controls? Pin
Le@rner6-Jun-08 20:36
Le@rner6-Jun-08 20:36 

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.