Tuesday, October 21, 2008

My first Attempt at OpenGL

LECTURE
This week's lecture is about the size and the difference of colour in computer graphics. For example a pixel takes about a byte and that colour is more or less human perception not. for example the colour is actually the same in a bunch of tiles, but the eye perceives it differently.

Question -My artist are told they have a maximum of 32MB to use for textures. How many textures can they use if they are limit to 256 x 256, with a 24bits palette of 8bits color depth?

(32*1024*1024)/((256*256)*(24/8)=170

LAB
Question 1 – Define a Callback function?
A callback function is a function that is called through the pointer of a function. The address of the pointer is passed as an argument to another, when that pointer is used to call the function it points to it.

Question 2 - When exactly is myDisplay()called? How do you get to your findings?

It is called after the initialization of the program window. It can be seen in debug mode. Set a breakpoint at the point when it calls for myDisplay().

Question 3 – List the process to access the VRAM.

It first obtains the memory pointer to VRAM. Then it obtain double buffer memory. It then clears double buffer memory. There after, modify double buffer memory, Copy double buffer to VRAM. aand then clear the double buffer memory again.

Question 4 - What color format are we using here i.e. 8 bits, 16 bits, 24 bits or 32 bits?

8bits.

Question 5 - How much memory have we allocated?
800*600*1= 480000bytes


Question 7 – Describe what has glDrawPixel() done.
It begins the command to draw the pixels on screen. This line is initialised before the image appears on screen.


For the practical, it is the first encounter to opengl. thus it was the first time we got a particular art on the screen. after drawing a couple off lines i experimented with the code and created some of the following.

Here is some screenshots from the lab practicals.






No comments: