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

Posts I've Made

In Topic: My first C++ game

28 August 2012 - 07:56 AM

I think you should start with c# or java and use the built in graphics API as they are pretty straight forward and require little effort to learn. You'll use eclipse/visual studio to write the code and intellisense will remember function names for you so you wont have to bother with
1- Graphics APIs/Frameworks
2- Function details/graphics pipelines
3- Windowing/keyboard-mouse input routines.

You can easily focus on actual game development/algorithms/geometry calculations.
By the time you create a game like snake that actually works you'll have learned a great deal about essentials of game programming.

Then you can move to more professional stuff like OpenGL/DirectX

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

23 June 2008 - 07:10 PM

Original post by fear4ever
That overlay can be drawn by the c# application itself or maybe by some other dll.

It doesn't really matter whether it gdi+ or anything else that does the drawing. What i am trying to find is the method of double buffered drawing onto a c# form (flicker free). As i understand OpenGL and gdi+ use different buffers for drawing so something like is not possible?

in each timer tick

oglDLL.draw() //dont swap buffers yet
some_other_dll.draw() //dont swap buffers yet
gdi+.draw() //dont swap buffers yet

Any explanation or pointers to that kind of drawing tecnique would be appriciated.

In Topic: c++ bitmap to bmp

13 September 2007 - 09:25 PM

I have played a bit around with the code. First off the HBITMAP i created was not getting the info from CBitmap bmp; so i decided to get pixel directly from it. and changed 24 color depth to 32 which is my desktop resolution. At last i got some output but half the picture is still in black. What could be the reason?

// 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 = 32;
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));

// save dibsection data

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

char *memory2= (char*)malloc(sizeof(char)*bytes);

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


In Topic: Visual Basic And OpenGL

05 July 2007 - 03:40 AM

Yes you are right. Basically i wanted to develop a GUI based opengl application.
Nehe's window system works just fine but controlling everything with keyboard is not possible when you want to create an actual application. SDL is not any different as far as i can see.
Anyway i did manage to integrate opengl/vb/c++. After a bit of a work i'll hopefully have a simple framework where vb controls user input and c++ handles application logic and opengl.
Thanks for the replies.

In Topic: Visual Basic And OpenGL

04 July 2007 - 07:55 PM

Thanks edgar. I did manage to make it work by creating a simple atl com object and linking to vb.
This brings some problems with it of course i.e i have to prevent vb from drawing over opengl stuff by running it in a closed loop. Still it works and will save me some time while designing a GUI.
Hopefully i'll have a generic framework for future use.

I also looked into SDL a bit. It seems quite nice but is there a form editor type tool for creating GUI's based on it?