Reputation: 10 Tradesman
- Active Members
- Active Posts:
- 82 (0.15 per day)
- 17-June 12
- Profile Views:
- Last Active:
- Nov 01 2013 09:45 PM
- OS Preference:
- Who Cares
- Favorite Browser:
- Favorite Processor:
- Who Cares
- Favorite Gaming Platform:
- Who Cares
- Your Car:
- Who Cares
- Dream Kudos:
Posts I've Made
Posted 1 Nov 2013If I'm going by the right versions, which I believe 3.2 is when you NEED to create your own shaders, then I don't think GL_QUADS is used really anymore. You're much better off using an element/index array, and use the values for four vertices, like it seems you were originally. Instead of GL_QUADS, you would use GL_TRIANGLES.
Posted 12 Sep 2013If you have access to it, one good, very beginner book I read was Head First Java. You can find it on Amazon. It's great for learning as it is very beginner friendly, assumes you don't have much, if any programming experience, and uses language that is more what you might hear on the street than reading in a text book. Also shouldn't be too expensive, maybe 40-50 USD max.
Posted 12 Sep 2013Thanks for all the advice BBeck! I think you basically finished off answering my questions in this topic, with a fair amount of detail I might add! I'm understanding more and more current graphics rendering, which is pretty interesting to say the least!
Posted 6 Sep 2013I think Mylo did explain it how I was thinking as well. BBeck, it is BEFORE any transformations are applied, since i'm just talking about actually creating the vertices, and not transforming them or modifying them in any way. I was looking for the way to put the coordinates like I did above, but making the quad a certain scale without any transformations, just to put the texture on correctly. Then, after that, I already have all the transformation matrices set up, and know how to use them even if I don't FULLY understand matrix math. (I do understand the basics).
So Mylo did pretty much answer my question the way I hoped, but the rest of you provided some pretty useful info as well!
So, maybe part two of this question now that we are on the right track here.
So, using glm::ortho() to set my projection matrix, It takes the arguments of the width and height, which I believe are also in NDC space. (-1 to 1). Right now, I have it set to ten units, with a one unit block. The block takes up (based on just visually estimating) the one unit, so with the ortho projection, it looks like I can fit 20 side by side, which is the space from the ortho projection. If I were to make the ortho projection, say, 1280x720 units to represent a screen, would making a block 32x32 units wide represent a 32x32 pixel size? Or is that not even a good idea to do? Thanks guys, you've all been a huge help!
As an example, one of the online resources i've been using is: http://www.opengl-tu...ial-11-2d-text/
Not just that one tutorial, but all of them on that website. If you look at the first section right underneath the big underlined Drawing header, that's pretty much the problem i'm looking on solving. I'm using this to try to figure it out along with the help you guys are giving me. Hopefully that shows a little clearer what i'm looking for here, in case anyone was lost!
Posted 6 Sep 2013Thanks for all the help guys! I am aware of the power of two rule, I used it in all other languages (C#, java, even C++ with SDL rendering) mostly out of a habit I seemed to have never formed. Maybe it was more of just being around computers for so long that the power of two rule almost comes naturally!
I am (although at a basic level) familiar with texture coordinates and UV coordinates. I haven't put a texture on my quads yet, just colored them so I can see what they are doing at the most basic level, since the texture is just the wallpaper covering the quad. When I make a quad, even though it's in 3D space, it's not really a cube. I just have four vertices for the corners of a rectangle, with an element buffer that connects those vertices into two trianges, so it is just one face.
I know about transforming those quads using the model, view, and projection matricies, so after the quad was created and slapped with a texture, moving and scaling it is easy. It's more of the actual creation of these quads and their size that i'm confused about.
The "units" I was referring to were the space that OpenGL describes I think is what they call Normalized Device Coordinates. So when creating a vertex, you put that vertex's position in a space from -1 to 1. So for a quad, I have vertices in these positions:
vertices = -0.5f; vertices = 0.5f; vertices = 0.5f; vertices = 0.5f; vertices = 0.5f; vertices = -0.5f; vertices = -0.5f; vertices = -0.5f;
So, vertices and  are the top left corner of our quad, and continues in a clockwise fashion around the quad.
So, say I had a tile on a sprite sheet that is 32x32 again. (Hopefully not just saying the same stuff I did in my original post). This quad that I made is one coordinate long in NDC space. So if I want a quad that will hold the 32x32 tile from the sprite sheet, how do I know how big to make the quad in NDC coordinates? I'm not as much worried about anything that has to do with the texture aside from the size in pixels right now.
Like I said, hopefully i'm not just saying the same stuff I did before, but I think you guys are thinking that i'm having trouble with the texture itself, while i'm actually trying to figure out how to create the vertices for the quad in NDC space so that they will be the appropriate size to hold a texture with a certain width/height in pixels.
It is very likely that you guys aren't thinking like that, and actually answering my question how I asked it. I'm not saying you guys aren't helping, because you most certainly are! Thanks for the help, I hope I explained what I'm looking for a little better
Off to go teach some kiddies some swimming lessons, but i'll be back to work on this when I get home, i'm hoping to get most graphics code wrapped up today so I can go back to actually working on game code, and not graphics code!
- Member Title:
- D.I.C Head
- 20 years old
- March 17, 1993
- Gaming, Game Programming, and Drumming!
- Years Programming:
- Programming Languages:
- C++, Java, C#
Mr_Fraggs hasn't added any friends yet.