Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Before we begin with the lab specifics, first create a new WIN 3 2 CONSOLE APPLICATION. Make it an empty project and create a main.cpp
Before we begin with the lab specifics, first create a new WIN CONSOLE APPLICATION. Make it an empty project and create a main.cpp By now you should know how to define a main function, so go ahead and do so At this time please also include the RasterSurface.h Inside main we will use three functions that are a part of the RasterSurface class.
bool RSInitialize const charstudentName, unsigned int width, unsigned int height ;
bool RSUpdate const unsigned intxrgbPixels, const unsigned int numPixels ;
bool RSShutdown void ;
Initialize and Shutdown will only be called one time. Initialize at the start of main and Shutdown at the end of main. Update needs to be called at least one time per frame. Meaning this function needs to be called at least one time per cpu cycle. Since we do not know how many times we will be calling this function, which appropriate loop iteration keyword should we use here? As a side note, Initialize will create and open a WIN WINDOW. RSUpdate will continue to return true until the WIN Window closes. Once the window is closed, RSUpdate will return false. Now onto the usage of this RasterSurface class.
Lets initialize our RasterSurface to a window size of by
pixels wide by pixels tall
We should also create an unsigned int array with the total number of pixels that we created our window with.
D array and D array both work just fine.
RSUpdate will take this array and it will need to take the total number of pixels as well.
You will also be writing a few helper functions to assist you in this process. Here are a few example functions you might need.
A function to clear the color buffer to a solid color of your choice.
A function to convert dimensional coordinates to a dimensional coordinate.
A function to draw a pixel fill a certain pixel with a specific color
A function to BLIT Block Image Transfer
Additionally, we give you an executable called TGAPOWBITTOTEXTUREARRAY.EXE that converts any bit uncompressed tga file to a h file. The usage of this executable lets us easily access the color values of each pixel of the tga file. In order to use this executable properly, just drop it in your texture folder and double click the executable. It will convert all tga files inside the folder to their respective h counterpart. You should include the new header file so you can access its data members. If you do not have a tga file, you can create one by dragging and dropping the texture into Visual Studio. Afterwards go to FILE SAVE AS CHANGE FILE EXTENSION TO TGA CHOOSE A LOCATION.
Guidance
Once you setup the rendering loop, it is time to start drawing a pixel. Call your function that draws a pixel and make sure it is drawing in the correct location. Contrasting colors are best to test with.
Now that you can draw a pixel, we should now attempt to draw a tile square set of pixels or BLIT an image.
For the tiles height
For the tiles width
Find the location into the image array. D to D
Draw a pixel at this location iterating through the width and the height
Once you are able to draw a BLIT tiled image, we need to fill our color buffer with the same image. You are essentially going to repeat this BLIT horizontally and vertically as well.
For the number of evenly divisible tile heights
For the number of evenly divisible tile widths
Call your function to draw a tile.
At this point you should notice a border around the edge of your right and bottom side of the screen. This is because the remaining pixels did not constitute enough space to draw another BLIT. What needs to be done to your draw function to adjust for this?
Getting this far you should have a strong understanding on how to BLIT. Place BLITs randomly placed throughout the color buffer. These can be anything of your choosing. Obvious choices would be something large enough to notice.
Now let us introduce cell of an animation. Be careful here because this is where you need to interpolate through color values since the animation might have alpha values lower than
As soon as you can get a properly rendering BLIT with alpha transparency, solve how to iterate through the animation over time. Make sure the animation plays smoothly at fps
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started