My Computer Forum Computer Science Forum

Go Back   My Computer Forum > Computer Science Forum > Rendering

Rendering Visual Rendering - Computer Graphics, Image Processing, Geometry, Subfield, Animation, Scattering, Transport, Visual Effects


Reply
 
LinkBack Thread Tools Display Modes
December 28th, 2007, 08:30 AM   #1
 
Joined: Dec 2007
Posts: 187
Computer Graphics using C++

Is it possible to create a simple computer graphics by simply writing a C++ source code? Will it work for programming software such as Visual C++ 2005 Express Edition?
johnny is offline  
 

My Computer Forum is free to register and we welcome everyone!

December 28th, 2007, 09:41 AM   #2
 
Joined: Dec 2007
Posts: 232
Re: Computer Graphics using C++

Of course, you can do anything in C++, since it's Turing-complete. You can even do graphics in BF if you pass the output to a file and display it.

What are you trying to do in particular? If you just want to use pre-existing graphics Visual C++ makes it easy (no thinking needed); if you want to build your own there are ways to do that as well.
CRGreathouse is offline  
December 28th, 2007, 12:12 PM   #3
 
Joined: Dec 2007
Posts: 187
Re: Computer Graphics using C++

I was just curious what C++ could do, and they're fun to learn (currently I'm learning the C++ language).

By the way, why did Müller call the programming language "Brainfuck"? lol
johnny is offline  
December 28th, 2007, 01:13 PM   #4
 
Joined: Dec 2007
Posts: 232
Re: Computer Graphics using C++

Quote:
Originally Posted by johnny
By the way, why did Müller call the programming language "Brainfuck"? lol
Just try to program anything serious in it and you'll soon know. It does twist the mind a bit. Try this one on for size (not tested):

Code:
,>++++[-<-------->]<[>++<-]>++++[-<-------->]<.
Any idea what that one does? And can you fix it (not so easy!) to work with numbers bigger than 4?
CRGreathouse is offline  
December 28th, 2007, 02:46 PM   #5
 
Joined: Dec 2007
Posts: 187
Re: Computer Graphics using C++

Quote:
Originally Posted by CRGreathouse
Quote:
Originally Posted by johnny
By the way, why did Müller call the programming language "Brainfuck"? lol
Just try to program anything serious in it and you'll soon know. It does twist the mind a bit. Try this one on for size (not tested):

Code:
,>++++[-<-------->]<[>++<-]>++++[-<-------->]<.
Any idea what that one does? And can you fix it (not so easy!) to work with numbers bigger than 4?
Hmm... I've never saw those kind of codes, but my guess on the code you got there is that this is similar to the (setw(n)) function in C++?
johnny is offline  
December 29th, 2007, 09:21 AM   #6
 
Joined: Dec 2007
Posts: 232
Re: Computer Graphics using C++

Quote:
Originally Posted by johnny
Hmm... I've never saw those kind of codes, but my guess on the code you got there is that this is similar to the (setw(n)) function in C++?
Huh? It's just plain BF code, which works just like explained in my link above. I can't see any relation to setw at all, which just does output formatting (field width) for cout streams.

> and < move the current cell one to the left or right, + increases the current cell's value by 1, - decreases the current cell's value by 1, and [ and ] loop while the current cell is not zero. , and . do single-character input/output.
CRGreathouse is offline  
December 29th, 2007, 02:32 PM   #7
 
Joined: Dec 2007
Posts: 187
Re: Computer Graphics using C++

So for ,>++++[-<-------->]<[>++<-]>++++[-<-------->]<. the first one has comma, which means to input a byte and store it in the byte at the pointer. The second one ">" is increment the pointer. So, this is pretty much all combining to one another to express an output?
johnny is offline  
December 29th, 2007, 03:06 PM   #8
 
Joined: Dec 2007
Posts: 232
Re: Computer Graphics using C++

Quote:
Originally Posted by johnny
So for ,>++++[-<-------->]<[>++<-]>++++[-<-------->]<. the first one has comma, which means to input a byte and store it in the byte at the pointer. The second one ">" is increment the pointer. So, this is pretty much all combining to one another to express an output?
In this case the program inputs one byte, does some calculations, and outputs a byte. Obviously more complicated programs are possible.

Can you see what this program does?
CRGreathouse is offline  
December 29th, 2007, 03:30 PM   #9
 
Joined: Dec 2007
Posts: 187
Re: Computer Graphics using C++

I will give it a try this evening.
johnny is offline  
December 29th, 2007, 06:42 PM   #10
 
Joined: Dec 2007
Posts: 187
Re: Computer Graphics using C++

For example, if the input is 5, then the integer 5 will be stored in the first memory cell. Then, the pointer moves to the next memory cell, and increments the integer 0 by 4 times, which gives us the integer 4 on the second memory cell.
This is what I got for the ,>++++ . Am I on the right track?
johnny is offline  
December 29th, 2007, 08:32 PM   #11
 
Joined: Dec 2007
Posts: 232
Re: Computer Graphics using C++

Quote:
Originally Posted by johnny
For example, if the input is 5, then the integer 5 will be stored in the first memory cell. Then, the pointer moves to the next memory cell, and increments the integer 0 by 4 times, which gives us the integer 4 on the second memory cell.
This is what I got for the ,>++++ . Am I on the right track?
Yes, you're on the right track, but not quite right. The second cell is 4 (and at that point, the pointer is on the second cell), but the first cell would not have 5. Instead, it has the ASCII character '5', which is 37 decimal or 0x25 hexadecimal as I recall.
CRGreathouse is offline  
December 30th, 2007, 12:01 AM   #12
 
Joined: Dec 2007
Posts: 187
Re: Computer Graphics using C++

So if an user inputs the number 6 on the first memory cell for example, then this number 6 is assumed to be an ASCII character? Thus, does it convert itself to either hexadecimal or decimal number, and it is stored in the compiler?
johnny is offline  
December 30th, 2007, 01:33 PM   #13
 
Joined: Dec 2007
Posts: 232
Re: Computer Graphics using C++

I don't know how to answer that. When you type a 6 it's stored as '6', 0x26, 38. All of these things refer to the same thing: the binary representation 00100110. There is no conversion to hexadecimal, or decimal, or anything -- it's just 00100110. You can refer to it by any of its names; when the program is compiled they'll all be the same.
CRGreathouse is offline  
February 4th, 2009, 06:23 PM   #14
 
Joined: Feb 2009
Posts: 3
Re: Computer Graphics using C++

Computer Graphics source codes in C++ programming language is a proj. genrally based on reserving a ticket for a customer using ginev details ..............
reyz_rj is offline  
February 5th, 2009, 05:16 AM   #15
 
Joined: Dec 2008
Posts: 32
Re: Computer Graphics using C++

I agree with the above post.
Imanuel4u is offline  
Reply

  My Computer Forum > Computer Science Forum > Rendering

Tags
computer, graphics


« - | Home made games »

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Certification Computer Graphics / Web graphic design julien Rendering 0 November 27th, 2011 12:20 PM





Copyright © 2017 My Computer Forum Forum. All rights reserved.