karansher / computer-graphics-raster-images

Computer Graphics Assignment about Raster Images
1 stars 0 forks source link

Project Set-up frustration. #40

Closed RamDaj closed 1 year ago

RamDaj commented 1 year ago

Hey, I'm having a ton of trouble here with just running the project. read_rgba_from_png just sets rgba as NULL. I've completed over half the project but can't even test if my code is working or not becuase the function read_rgba_from_png that the whole project is based in isn't working for me, I've tried everything on the FAQ to no avail, this is really frustrating as I've spent more time trying to figure out what's wrong rather than work on this project.

I've made sure I'm on the build folder in the terminal when running .\Debug\raster (I'm a windows user)

I've made sure my working directory isset to $SolutionDir

I've made sure the raster project is at the top of the raster.sln file

I'm genuinely just so lost here, I really want to put time and effort into this assignment, but not on wrong meaningless things! Please any solution would be appreciated, I'm not even seeing any generated .ppm files, and my height/width measurements are always insanely large negative values well before any of my code is even run (Just running the provided code.

properties project

abhimadan commented 1 year ago

I'm sorry to hear how difficult it's been to get your code running smoothly. Unfortunately I don't have any immediate ideas as to what's causing your issue, though I am pretty sure it's path-related. In rgba_to_rgb.cpp, call _getcwd and print out the value it returns, so we can see where your program thinks it's being run from. There's a code sample on that page that you can adapt to put into rgba_to_rgb.

RamDaj commented 1 year ago

Sorry was preoccupied with fixing some compilation bugs - the value I get from the line std::cout << _getcwd; is 00007FFC83C28900, thanks for taking the time to look

RamDaj commented 1 year ago

If it matters, when I look at raster.exe from the Debug folder, it has a date modified of Sep 12th, even after building

abhimadan commented 1 year ago

You're just printing out a function address, since you aren't actually calling the function. Take a look at the example in the page I linked so you call the function, save its value in a C string (a char array), and then print out that string. I want to find out where your program thinks it's being run from.

RamDaj commented 1 year ago

C:\Users\.....\F CSC317\Assignments\computer-graphics-raster-images\out\build\x64-Debug

RamDaj commented 1 year ago

Sorry I hadn't realized the link was provided in your previous message!

abhimadan commented 1 year ago

Yeah, so it's indeed not using the correct directory. For everything to work correctly, with your directory structure, your working directory for raster.exe should be out (or more generally, one directory within the root of the repo computer-graphics-raster-images), but you have three layers of directories between your executable and the repo. I haven't used Windows in a while but I think you get build folder names like x64-Debug if you just open the repo folder in Visual Studio, since recent versions are able to read cmake project files. However, it does not work the same way as running cmake .. from the build folder (or out folder, name doesn't matter) on the command line, producing a different directory structure that breaks the relative paths we use in the assignment. This is why we recommend not to run cmake outside of Visual Studio.

To fix this, do the following:

Then your directory structure matches what we expect for the assignment.

RamDaj commented 1 year ago

That worked! Thank you so much! Never have I been happier to see a disfigured dog before