Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Oct 2005
Offline Last Active Sep 11 2012 04:45 AM

Topics I've Started

Implement map projections

04 July 2012 - 02:15 AM


Stipple with drawpixels

18 November 2009 - 03:39 AM

Hello, As far as I can see glPolygonStipple isnt applied when glDrawPixels is called. Is there a way to make this work?

[.net] Drawing on to c# form by different sources

23 June 2008 - 03:25 AM

Hi I am trying to create a c++ dll which draws some stuff to a c# form (hWd passed as a parameter to the dll). It works fine up to that point. I put a timer to the c# application and it calls the dll's draw method on each tick. What I am trying to add now is an overlay on top of what is drawn by the c++ part. That overlay can be drawn by the c# application itself or maybe by some other dll. Is that possible? And if so how do i go about it? Something like void tick() { openGL_Part.draw(); draw_Some_Stuff_On_Top_Of_That(); }

c++ bitmap to bmp

13 September 2007 - 08:23 PM

Hello. I am having a problem creating and saving an image as bmp in a MFC application. Project is created by VS6 from mfc appication wizard(exe) with standard options. This is the source of the onDraw method. This creates a bitmap and draws to screen. Also creates a bmp file of application size but its just black. What am i doing wrong?
// CDenemeView drawing

void CDenemeView::OnDraw(CDC* pDC)
	CDenemeDoc* pDoc = GetDocument();
	// TODO: add draw code for native data here

	// bitmap dimensions

	RECT windowRect;

	int bitmap_dx = windowRect.right - windowRect.left;
	int bitmap_dy = windowRect.bottom - windowRect.top;

	CPaintDC odc(this);

	CBitmap bmp;
	CDC dc;
	bmp.CreateCompatibleBitmap( &odc, bitmap_dx, bitmap_dy );

	//fill the area
	for ( int x = 0; x < bitmap_dy; x ++ ) {
		for ( int y = 0; y < bitmap_dx; y ++ ) {
			dc.SetPixel(x,y, RGB(x%256,y%256,(x*y)%256));

	// create file
	ofstream file("example.bmp", ios::binary);
	if(!file) return;

	// save bitmap file headers
	fileHeader.bfType      = 0x4d42;
	fileHeader.bfSize      = 0;
	fileHeader.bfReserved1 = 0;
	fileHeader.bfReserved2 = 0;
	fileHeader.bfOffBits   = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
	infoHeader.biSize          = sizeof(infoHeader);
	infoHeader.biWidth         = bitmap_dx;
	infoHeader.biHeight        = bitmap_dy;
	infoHeader.biPlanes        = 1;
	infoHeader.biBitCount      = 24;
	infoHeader.biCompression   = BI_RGB;
	infoHeader.biSizeImage     = 0;
	infoHeader.biXPelsPerMeter = 0;
	infoHeader.biYPelsPerMeter = 0;
	infoHeader.biClrUsed       = 0;
	infoHeader.biClrImportant  = 0;

	file.write((char*)&fileHeader, sizeof(fileHeader));
	file.write((char*)&infoHeader, sizeof(infoHeader));

	// dibsection information
	info.bmiHeader = infoHeader; 

	//for checking if dc has correct drawing
	pDC->BitBlt( 0,0,bitmap_dx, bitmap_dy, &dc,0,0,SRCCOPY);

	BYTE *memory;
	SelectObject(dc, bmp);

	HBITMAP bitmap = CreateDIBSection(dc, &info, DIB_RGB_COLORS, (void**)&memory, 0, 0);

	// save dibsection data

	int bytes = (((24*bitmap_dx + 31) & (~31))/8)*bitmap_dy;

	file.write((char*)memory, bytes);


Visual Basic And OpenGL

03 July 2007 - 08:31 PM

Hi, I am trying to create a simple windows opengl application. For GUI i decided to use visual basic. I know people can code opengl in vb using a tlb file which i cannot remember the exact name for but that's not i am after. I am looking for a way to implement only GUI in VB and all application code in visual c++. That means i'll have a dll that initiliazes opengl using the window handle of vb, vb will pass GUI events to that/or another dll responsible for application impelemtatioin. Is that possible? I tried to create a simple win32 dll with VS/c++ and reference it in a VB app but that doesnt seem to work. Do i have to create an mfc activeX control instead of a regular dll? (That i tried and managed to link the ocx file to vb but is creating a control best way to do this?) I am also open for suggestions about the platform to implement the GUI (MFC is a bit too complicated and glut/glui do not have a good application feel). Thanks in advance.