first off, great tutorials! i have not ever ventured into open gl of any flavor and these were very descriptive. i couldn't help but get lost playing while reading through your tutorials.
i do have a question though regarding the click handling. you show how to capture the clicks and test the area to see if its within the square, is this the only way to do this?
my real question is if i have 4 or 5 or more button areas (squares or other gl drawn shapes), do i just have to test to see where the click was in a bunch of ifs? or can you assign some sort of actual type to those squares and have those square inherit the touch events and act like a normal button?
i do have a question though regarding the click handling. you show how to capture the clicks and test the area to see if its within the square, is this the only way to do this?
The short answer is no. That's not the only way you can do this. I only did it that way because it was easy and quick to implement in the tutorial. In some other work I have implemented visible buttons.
Quote:
Originally Posted by atomriot
my real question is if i have 4 or 5 or more button areas (squares or other gl drawn shapes), do i just have to test to see where the click was in a bunch of ifs? or can you assign some sort of actual type to those squares and have those square inherit the touch events and act like a normal button?
You could and as long as you remembered is that you would need to pass the touch message along to the various buttons you've created. That would work. By passing the touch event along to each instance of your button class, you can let them decide whether or not to handle the touch.
I had noticed that if i applied a block image to the texture, then apply an image thats not square, then around the outside of the last image the block texture would appear.
I used that line to stop the last texture being drawn behind the current one. (this works and fixes it)
OK, I think I understand what you're saying here. You're talking about if you load a texture, delete it, then load another you get the old image still being rendered where the current image has a transparent pixel.
Yes, that would fix it but I haven't come across that problem and I'm not sure how that would happen. I'll need to check further but could well be a bug in my code. If so I'll fix it.
Quote:
Originally Posted by kingbombs
I was wondering how i could get the outside part of the texture transparent, so only the leg image would be applied and around it would be transparent. (so if i had a texture having two legs that doesnt move you could see between its legs)
This part I'm not sure about what you mean. Can you elaborate? Picture maybe?
EDIT::: look at post below probably better explanation
Ok so for starters i don't delete the texture i just load them all at the same time (don't know if thats abad thing but they get called multiple times and at different times depending on certain states)
Now maybe the easiest way to explain this is:
Lets say i have an image of a 2D person who is going to be drawn in the bounds of a square (only a small image)
so i declare lets so his co-odrinates are:
0.0f, 0.0f,
1.0f, 0.0f,
0.0f, 1.0f,
1.0f, 1.0f,
So he will be drawn inside of this square.
Now lets say i insert my image into your loadTexture method (the image isnt square the image is the shape of a human)
then this texture is applied to that square, the human is drawn just as you would expect, but where you would expect to see transparent pixels (just over his shoulder, between his legs and maybe his arms) and around the body in general) is black
ill try to make a picture in about 30 -40 mins i have to run out (sorry i can't check grammar either i will touch it all up when im back)
thanks for the reply though! amazing help!
EDIT::
So this link, look at the middle character: http://a248.e.akamai.net/f/248/5462/...867_ps2_42.jpg
If he is currently drawn as just a square texture then between his legs and around him will be a black square
Where as i would like it to be transparent as it is in that screenshot
(if you want i can take a screenshot from my app and upload it somewhere if you need to see it)
Am i going about this the wrong way? I thought by making a square it will be better CPU wise than having lots of different polygons for each part of the body and a texture for each part of the body
I create a quad in OpenGL and load it as a texture and bind it to the quad.
Currently it shows a black square with the picture in the middle (so where you can see white in that link, its black)
Its a 32x32 image, and in photoshop i created it with those dimensions and set its background to transparent.
I believe the problem is with the glBlendFunc
i know currently its set to be opaque but i get the same result when its not set, and i'm not certain what functions i should be using
I'm currently looking in to masking, so will reply back if that works
I was wondering if theres a way to use textures which don't have a size that is a power of 2
I have been looking at quite a few sites, and how to 'pad' out an image so the original image isn't a power of 2 but when it gets loaded into the program to become a texture it is padded out (with what i seem to be reading) with black pixels.
For starters i'm not totally sure how to do this, but from what i can see is that i have to then use that new kinda size of the image to do UV mapping.
What i assume from this is that i must set up the texture co-ordinates to be something like 0.5,0.6, 0.5, 0.8, .... etc not the standard 1,1....0,1 etc
The problem with me taking this route is that i use other textures that require the texture co-ordinates to be 1,1 0,0 0,1 1,0 etc
I would change the texture co-ordinates when i need the different ones, but that would mean switching between the the different texture co-ordinates alot rather than just using one texture co-ordinate for the whole thing. I'm not able to batch up all the drawing calls for a single texture co-ordinate and then move to the next texture co-ordinate and make all those calls. The code can't really be changed to allow this.
So i was wondering if there is another way to go about this?
I was wondering if theres a way to use textures which don't have a size that is a power of 2
I have been looking at quite a few sites, and how to 'pad' out an image so the original image isn't a power of 2 but when it gets loaded into the program to become a texture it is padded out (with what i seem to be reading) with black pixels.
Should be transparent pixels. If allocating memory for a pad space use calloc not malloc for obvious reasons...
Quote:
Originally Posted by kingbombs
What i assume from this is that i must set up the texture co-ordinates to be something like 0.5,0.6, 0.5, 0.8, .... etc not the standard 1,1....0,1 etc
The problem with me taking this route is that i use other textures that require the texture co-ordinates to be 1,1 0,0 0,1 1,0 etc
Look, there really isn't a way around this. That's just one of the things you need to deal with and it's difficult to "force" everything into the one little box or method. If your textures are different, then they need to be handled differently.
I'd definitely re-look at your drawing code and allow for some flexibility for the ST co-ordinates. Even if they were just in an array matching an array of the GL texture indexes, that would be enough.
hello,
i followed your tutorials, its nice experience. now i created a sphere using blender as in your tutorial, i want to rotate that sphere according to touches in all directions. how to do...
Hey, just a few questions with hopefully simple answers
If i'm drawing a quad that is being used as a sprite, what advantages or disadvantages are there for using GL_QUAD instead of GL_TRIANGLE_FAN
I see alot of tutorials seem to stick with GL_TRIANGLE_FAN but they seem to just draw a quad and apply a texture to it.
The other question is from what you said in a recent tutorial.
What is so 'evil' about C++?
I recently found out that most new game engines are now created in C++ and not C, so i was wondering why you don't like it in comparision to all the other languages you code in?
EDIT: just for reference im currently using GL_TRAINGLE_FAN (i think, atleast using one of the GL_TRIANGLE_ calls)
Am going to try out GL_QUAD tomorrow and may see an obvious reason why but thought i should ask now incase i don't see why
I have a question:
I've been following the first two tutorials. But I'm not sure now of one thing. Will this help me with ports such as Quake? if not, how do I code it then?
well quake engine (before id-tech4) were written in C
so technically if you just want to port them over then you need to create a wrapper class to bring over the C files, but there will still need to be changes made
But in honesty if you are reading these tutorials (and only the first 2) im assuming you haven't really done much OpenGL (and im gonna guess DirectX) then i would learn alot more first before trying something like that
First of all.... Great tutorials.... I've finished them all (and ended up running (not walking) to the Blender Noob to Pro tutorials.....
Now I'm stuck. In "OpenGL ES 15 - Blender Models Part 2: Loading and Rendering", you mentioned about exporting for animation. Using keyframes, etc... I'm trying to do an export of a bones animation, but am not sure of an efficient way to represent the data and step through the frames. I thought maybe rendering each frame and then "play" them back on the iPhone. However, I can't figure out how to do that (stepping through each frame) and don't know if that is the correct approach.
Could you please point me somewhere where I can learn the "proper" way to tackle this?
Thanks for the great tutorials Simon. They are helping my rehabilitation in OpenGL programming, but I've now moved away from the tutorials to experiment with view controllers on the EAGLView itself.
From my understanding the EAGLView is a UIView subclass, which means I should be able to assign the view as the ViewController's view. At first I experimented this using the tutorials set up code and this worked perfectly.
Then I decided to try using a fresh new project with only a Window-based Application to start it off. Again I create the ViewController and a EAGLView using the same base code as the tutorial has taught. Except after compiling and when the code runs, I receive the "failed to make complete framebuffer object %x" Error which comes under the createFramebuffer function.
At first I thought there was something wrong with my code, so I then used other EAGLViews from the iPhone Dev Centre sample files. All are receiving the same problem and fails to create the buffer for drawView to work correctly.
Is there something wrong with how I have set up the project? The ViewController (from new project) seems to work perfectly fine when the headers and classes are copied over to the tutorial codes and modified so they display the EAGLView window, but it does not work the other way around.
Any help for this problem would be appreciated. Thanks.
Your tutorial subjects look great but are now gone from MobilMe
I am just getting started in OpenGL on the iPhone (and Mac) and see that your tutorial is highly recommended. Imagine my dismay when I found your MobilMe account seemingly missing. Has the tutorial been moved? (I hope).
Yes please bring this back I really miss it! If it's a matter of hosting I know a few people (myself including) wouldn't mind handling it and attributing it to you.
Yes please bring this back I really miss it! If it's a matter of hosting I know a few people (myself including) wouldn't mind handling it and attributing it to you.
Well the last post he did have was about a power surge that doomed his work. While recovering from it, he probably hasn't renewed his account to save some money while he had nothing to add up on it. I like to think that once he has regained his balance the site will go live again.