Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

The second day, yesterdays work removed.

Sign in to follow this  


Triangle is where the second day is finished.

Today after I wrote my yesterdays report I continued programming and I created View class which constructor opens glfw window and I tried to pass the three templates I created yesterday as parameters in to the View class, but I found it pretty hard, because I had to reinterpret_cast the template class pointers to some valid pointer type. Well I almost got killed at stackoverflow for asking help solving problem I had before i realized I can just cast them to another type.

After I got it working I went for a cigarette and realized that I had taken control of the main loop which was something I did not want to do, but cowboy programming on the fly is somewhat dangerous. So I removed all of the code. Wrote new template structure vertex with the coordinates as members and two vertex structure pointers as members.

Then I wrote template class to manage this Screw::Vertex structure and called the class Screw::Vertices. Now I can push as many vertices to the class as I want and my computer can handle. I can also get the vertices back as array for GL_ARRAY_BUFFERS.

I copied the Vertices\Vertex templates to another file used search and replace and I had Colors template class and Color template structure.

So I started writing the View class again, but this time I left the main loop to main(). Somehow I started writing c++ wrapper for the OpenGL functions I used. You can see me drawing triangle on the image and that is as far as I currently am. C++ code lines currently at 475 if you are interested how it took me more than a 15 minutes to draw that damn triangle. :P

Second day and two problems.

I got a problem passing template class as regular class method parameter and using the template class as vector type. I went into stackoverflow and ask help, but their solutions were not what I wanted, but I realized myself what I wanted and posted it as solution to my post. Soon I got almost killed for casting class pointer to char pointer. Well after I redid basically everything I had problems getting openGL to actually draw on the window I created. I had every damn function call correctly, but I was not drawing on the visible screen, which took some time to notice.

What tomorrow?

Tomorrow I am going to create Github repository for ScrewGui and start writing some 2D element classes which use the Vertices and Colors templates.
Sign in to follow this  


Recommended Comments

Why are you actually trying to store different types of data in the same storage? Do you understand why the reinterpret_cast stuff is such a bad idea? They were quick to shout out on StackOverflow but nobody seemed to actually explain the potential problems.

Share this comment

Link to comment
Yeah none of them actually explained the problem of reinterpret_casting, but I kinda realized one problem myself which is why I decided to scratch everything and do it so that I don't need to cast it to another type.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!