A scene can be restricted or free. A person can be tied or unbound.
Studio is a room. "[if Late Afternoon is happening]Golden light streams in through the skylight, coating everything in the middle of the room in a delicate amber hue.[otherwise if Sunset is happening]The sunset's colors, indigo and orange, flow over the studio.[otherwise if Twilight is happening]Dim light from the skylight illuminates the centre of the room, purple-grey in the twilight.[otherwise if Night is happening]The studio is dark, the night stars visible through the skylight. The room is illuminated only dimly - if you're going to find your way around you're going to have to find a light source.[otherwise]This text shouldn't be appearing.[end if]".
A supporter called the metal chair is in the Studio. The description of the metal chair is "A simple metal chair, high-backed, not comfortable. [if the player is tied]You're tied to it.[otherwise]You can see the scrape marks where you were tied to it.[end if]". The player is on the metal chair. The player is tied.
Understand "untie me" as exiting.
Instead of getting off the metal chair: say "You try to get up, but almost tip the chair over. Better figure out how to untie these ropes, first.".
Late Afternoon is a restricted scene. Late Afternoon begins when play begins. Late Afternoon ends when the player is unbound. When Late Afternoon ends: say "You look up and notice that the sun has sunk lower in the horizon, darkening the studio. If you're going to do what you came to do, you'd better find some source of light."
Sunset is a free scene. Sunset begins when Late Afternoon ends.
Twilight is a free scene. Twilight begins when Sunset ends.
Night is a free scene. Night begins when Twilight ends.
A scene can be restricted or free. A person can be tied or unbound.
Studio is a room. "[if Late Afternoon is happening]Golden light streams in through the skylight, coating everything in the middle of the room in a delicate amber hue.[otherwise if Sunset is happening]The sunset's colors, indigo and orange, flow over the studio.[otherwise if Twilight is happening]Dim light from the skylight illuminates the centre of the room, purple-grey in the twilight.[otherwise if Night is happening]The studio is dark, the night stars visible through the skylight. The room is illuminated only dimly - if you're going to find your way around you're going to have to find a light source.[otherwise]This text shouldn't be appearing.[end if]".
A supporter called the metal chair is in the Studio. The description of the metal chair is "A simple metal chair, high-backed, not comfortable. [if the player is tied]You're tied to it.[otherwise]You can see the scrape marks where you were tied to it.[end if]". The player is on the metal chair. The player is tied.
Understand "untie me" as exiting.
Instead of getting off the metal chair: say "You try to get up, but almost tip the chair over. Better figure out how to untie these ropes, first.".
Late Afternoon is a restricted scene. Late Afternoon begins when play begins. Late Afternoon ends when the player is unbound. When Late Afternoon ends: say "You look up and notice that the sun has sunk lower in the horizon, darkening the studio. If you're going to do what you came to do, you'd better find some source of light."
Sunset is a free scene. Sunset begins when Late Afternoon ends.
Twilight is a free scene. Twilight begins when Sunset ends.
Night is a free scene. Night begins when Twilight ends.
That compiles? Holy shit!
That is so incredible. I love how easy to understand and write it is.
And yet I had to read that last sentence like three goddamn times to parse it inside of my own headbrain.
after three days of coding, i have now thoroughly implemented being tied to a chair.
now to figure out how to get the player out of the chair.
Razorcock.
Also, "three days of coding" sounds about right! It's funny that even with something that looks so awesome, it's still like, well, this shit's gonna take days.
after three days of coding, i have now thoroughly implemented being tied to a chair.
now to figure out how to get the player out of the chair.
Razorcock.
Also, "three days of coding" sounds about right! It's funny that even with something that looks so awesome, it's still like, well, this shit's gonna take days.
well, stopping the player moving take five seconds, it's handling all the unexpected cases that is bullshit. like, oh, what if he wants to look at his hands? time to modify all default messages that involve hands and write situation-appropriate text. what if he wants to tip over the chair? what if he wants to dance?
after three days of coding, i have now thoroughly implemented being tied to a chair.
now to figure out how to get the player out of the chair.
Razorcock.
Also, "three days of coding" sounds about right! It's funny that even with something that looks so awesome, it's still like, well, this shit's gonna take days.
well, stopping the player moving take five seconds, it's handling all the unexpected cases that is bullshit. like, oh, what if he wants to look at his hands? time to modify all default messages that involve hands and write situation-appropriate text. what if he wants to tip over the chair? what if he wants to dance?
Get erection with razorcock.
Use erection on ropes.
after three days of coding, i have now thoroughly implemented being tied to a chair.
now to figure out how to get the player out of the chair.
Razorcock.
Also, "three days of coding" sounds about right! It's funny that even with something that looks so awesome, it's still like, well, this shit's gonna take days.
well, stopping the player moving take five seconds, it's handling all the unexpected cases that is bullshit. like, oh, what if he wants to look at his hands? time to modify all default messages that involve hands and write situation-appropriate text. what if he wants to tip over the chair? what if he wants to dance?
Get erection with razorcock.
Use erection on ropes.
So in OpenGL when you draw a series of triangles... there doesn't seem to be any z-sorting on them..? for example, if I render a pyramid with triangular sides of any given color, and I make a rectangular base that is white, I can see the rectangular base *through* the pyramid, even if it is facing directly away from my perspective.
What is up with 'dat.
*edit* and it looks like the tutorial screenshots I can find don't really show that problem.... grrr
GL_CULL_FACE makes all your polys one sided so their backs aren't visible IIRC. You should probably also have something like this:
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
which turns on depth testing on a per pixel level (the func thing says "if its further away that what I've drawn already don't draw it", and the other command turns it on).
Yeah, it probably uses up a bit of GPU power, but backface culling alone won't render things correctly unless you are just drawing convex depth sorted shapes that don't intersect. If you replace the pyramid with a torus for example, you will need it. Its much faster to depth test on the per pixel level than to sort polygons and render them in order too, which is why transparent objects are much more expensive to render than solid ones.
The order you list the vertices in usually determines which way round they go, so if a triangle has 3 verts called A,B and C, triangle ABC faces the other way to triangle ACB.
Isn't per-pixel more CPU intensive? The regular ol' culling seems to be working just fine.
As another note, it is cheaper to have something eliminated by depth testing than to draw it. So if you're drawing a scene and you have the ability to do so, always draw the close-up stuff first, then the further-away stuff. That's a little more advanced.
For now, just understand that using the depth (or "Z") buffer is the default mode of operation for like every single engine in the universe. As soon as you start doing anything where objects get in front of other objects, you will basically need it. In fact, even pre-graphics-hardware games use it.
But Fyre, in GL_TRIANGLES, I don't see any way I could draw the faces incorrectly, all you do is plot vertices.
There is a setting called "Winding" in OpenGL that determines if the face winds around clockwise or counter-clockwise. If you take any given triangle and draw its vertices in order 1, 2, 3, and then draw that same triangle 3, 2, 1, the two triangles you drew will face opposite directions. This will be important with backface culling, and it will be important as soon as you start putting any kind of normal/lighting information on there.
OK so, if I have two quads, one with a Z of 0, and a Z of -1...
If I render the Z = 0 quad first, and then the Z = -1 quad... with depth testing on, the Z = -1 quad will essentially not be drawn at all (as in, not even processed)?
Z values are calculated in an interesting way. The final Z value is between 0.0 and 1.0. For now, that's as detailed as that needs to be. However, it's not linear.
So if you have a near-clip of 1.0 (units from the camera) and a far-clip of 1024.0 (units from the camera), that distance will map to the range [0.0, 1.0]. But like I said, it's not linear. So the close-up stuff will take a much bigger chunk of the range. This is because it's more important to be precise on what's in front of what when you're close to the camera than when you're far away.
So if a Z value were ever to come out to less than 0.0, it would be behind the camera and wouldn't render.
Maybe you're asking something different.
If you render a close-up quad and then a far-away quad, what will happen is that the individual pixels of the far-away quad will not be drawn. They will be rejected by the depth-test part of the pipeline, which is earlier than the actual drawing part (unless you have some advanced pixel shader shit going on, which you don't). You will therefore not be able to see the far-away quad, and it will be faster than drawing it and then drawing over it with the near quad.
It's OK though. You really don't need to understand stuff like that to get started. All you really need is the basic understanding that depth-buffering can let you reject pixels based on distance from the camera, and that it's fast and also pretty much the only way to draw arbitrary polygons without having them overlap inappropriately.
EDIT: By the way, I have been doing graphics/engine stuff using OpenGL for a long-ass time. I'm even doing it right now (compiling code). You can IM/PM me if you have questions, although I'm subject to a normal person's work and holiday schedule.
You lucky bastard. I am doing stuff in papervision and XNA at the moment, and all this opengl talk has got me longing for that feeling of total control over the rendering side.
It's really nice. You can just be like "well hey we're gonna order the scene this way and then we're gonna render this part first and then that part and batch things this way and use these shaders." Determining the entire lighting and animation model and the file formats and everything else in between is some work, but I love that I know exactly how it renders and how to make it look better or go faster.
So my glFormat argument is "4" instead of "GL_RGBA." Other than that, the line itself is the same. Are you sure that you're loading the PNG correctly?
EDIT: Changing my code to match yours does not make my stuff look bad. The fact that you can change the RGBA to BGRA and that makes it bluish implies that it's not a color setting or anything, either. I'd probably check the file itself in an image viewer other than your editor, and maybe make sure it's a supported format for your PNG reader.
It reminds me of an idea I had a few years ago, which is basically a Daredevil first-person game. I never acted on it, but the idea would be to use sound for visualization. A stealth element would be neat because you'd have to make noise to get imaging, but enemies do hear stuff, so there's a trade for that information.
Posts
that's what you get for using a heathen language
that's a good question.
How much does standard OpenGL compare to OpenGL ES?
yo you have your last name there and you just posted about being uncomfortable with having that on the internet so uh
kpop appreciation station i also like to tweet some
kpop appreciation station i also like to tweet some
after three days of coding, i have now thoroughly implemented being tied to a chair.
now to figure out how to get the player out of the chair.
And yet I had to read that last sentence like three goddamn times to parse it inside of my own headbrain.
Razorcock.
Also, "three days of coding" sounds about right! It's funny that even with something that looks so awesome, it's still like, well, this shit's gonna take days.
I meant the last sentence in NaC's post, actually.
well, stopping the player moving take five seconds, it's handling all the unexpected cases that is bullshit. like, oh, what if he wants to look at his hands? time to modify all default messages that involve hands and write situation-appropriate text. what if he wants to tip over the chair? what if he wants to dance?
Get erection with razorcock.
Use erection on ropes.
You can't reach.
I am not sure if the Cocoa abstraction of OpenGL (albeit a very minor one) is helping or hurting me... there are some variances from NeHe's tutorials.
HELL YES. RUMBLE THAT PUNCH, YOU MOTHERFUCKER.
What is up with 'dat.
*edit* and it looks like the tutorial screenshots I can find don't really show that problem.... grrr
*edit2* viola! glEnable(GL_CULL_FACE);
You did make it so it drew all the polys in the same direction right?
glEnable(GL_CULL_FACE);
fixed it... not sure what it does, going to go hunt a good OpenGL book soon so I can pick some of this stuff up.
IE a triangle like this
/\
I drew them all from the top to bottom right to bottom left.
However drawing one in the other direction would make it so it's "facing" the other direction and would be interpreted incorrectly.
edit: oh.. you didn't have backface culling on? Yeah, that's kinda required.
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
which turns on depth testing on a per pixel level (the func thing says "if its further away that what I've drawn already don't draw it", and the other command turns it on).
But Fyre, in GL_TRIANGLES, I don't see any way I could draw the faces incorrectly, all you do is plot vertices.
The order you list the vertices in usually determines which way round they go, so if a triangle has 3 verts called A,B and C, triangle ABC faces the other way to triangle ACB.
As another note, it is cheaper to have something eliminated by depth testing than to draw it. So if you're drawing a scene and you have the ability to do so, always draw the close-up stuff first, then the further-away stuff. That's a little more advanced.
For now, just understand that using the depth (or "Z") buffer is the default mode of operation for like every single engine in the universe. As soon as you start doing anything where objects get in front of other objects, you will basically need it. In fact, even pre-graphics-hardware games use it.
There is a setting called "Winding" in OpenGL that determines if the face winds around clockwise or counter-clockwise. If you take any given triangle and draw its vertices in order 1, 2, 3, and then draw that same triangle 3, 2, 1, the two triangles you drew will face opposite directions. This will be important with backface culling, and it will be important as soon as you start putting any kind of normal/lighting information on there.
If I render the Z = 0 quad first, and then the Z = -1 quad... with depth testing on, the Z = -1 quad will essentially not be drawn at all (as in, not even processed)?
just making sure I understand.
So if you have a near-clip of 1.0 (units from the camera) and a far-clip of 1024.0 (units from the camera), that distance will map to the range [0.0, 1.0]. But like I said, it's not linear. So the close-up stuff will take a much bigger chunk of the range. This is because it's more important to be precise on what's in front of what when you're close to the camera than when you're far away.
So if a Z value were ever to come out to less than 0.0, it would be behind the camera and wouldn't render.
Maybe you're asking something different.
If you render a close-up quad and then a far-away quad, what will happen is that the individual pixels of the far-away quad will not be drawn. They will be rejected by the depth-test part of the pipeline, which is earlier than the actual drawing part (unless you have some advanced pixel shader shit going on, which you don't). You will therefore not be able to see the far-away quad, and it will be faster than drawing it and then drawing over it with the near quad.
I need to read up on cameras, perspective, etc. I know it's complicated, I don't understand it much at all.
EDIT: By the way, I have been doing graphics/engine stuff using OpenGL for a long-ass time. I'm even doing it right now (compiling code). You can IM/PM me if you have questions, although I'm subject to a normal person's work and holiday schedule.
It's tinted red in the program.
Thoughts? I tried GL_BGRA instead of GL_RGBA but that also made it the wrong tint (light blueish).
If it makes a different I saved the PNG in GIMP.
So my glFormat argument is "4" instead of "GL_RGBA." Other than that, the line itself is the same. Are you sure that you're loading the PNG correctly?
EDIT: Changing my code to match yours does not make my stuff look bad. The fact that you can change the RGBA to BGRA and that makes it bluish implies that it's not a color setting or anything, either. I'd probably check the file itself in an image viewer other than your editor, and maybe make sure it's a supported format for your PNG reader.
Didja like it?
If not, you're wrong.
If yes, you win!
It reminds me of an idea I had a few years ago, which is basically a Daredevil first-person game. I never acted on it, but the idea would be to use sound for visualization. A stealth element would be neat because you'd have to make noise to get imaging, but enemies do hear stuff, so there's a trade for that information.