简体   繁体   中英

iOS OpenGL runtime texturing

Is it possible somehow to automatically continue the building of an existing mesh? How this can be done?
Let's say an example. I have a cuboid and I would like to have a bigger cuboid in runtime. The cuboid also have some texture and the new parts of the cuboid should have new texture. I think for this problem the scaling isn't enough, because of the texturing. How can I add texture to my cuboid in runtime?

Can you suggest me please some tutorials / frameworks and any help to solve this problem?


Edit: according to @datenwolf answer:
I think I can extend the shape of the cuboid with reusing the same mesh more time.
Do you have any idea how to texturize something in runtime?


Edit2:
So, a more concrete problem: I would like to build a house, a simple cuboid house with one floor. And after some time I would like to add another floor. I think it is an easy task, but I never worked with these kind of problems before.

OpenGL is not a scene graph. It's simply a drawing API. There is no internal representation of what's visible on the screen. The only thing OpenGL is left with after drawing something are the contents of the framebuffer(s).

You want something changed, you clear the framebuffer and redraw your scene with the adjustments done.


Regarding Quation EDIT 2: I can only reiterate my first statement: OpenGL is not a scene graph, ie you don't "build" a scene with it. What you have is geometry data (vertices) and sampling data (images/textures).

Then you have a drawing function, that tells OpenGL to make triangles, lines or points out of the geometry data and fill the fragments generated (=pixels) with values derived from illumination calculations, solid colour and texture sampling data.

Making a change to a scene does not happen in OpenGL! Making a change in the scene happens by making the changes in the geometry data supplied to OpenGL and the different drawing operations this implies .

Like I already said, you don't "build" your scene/geometry with OpenGL. You use a 3D modelling program like Blender, Maya, 3DS Max, Cinema 4D or similar for this, store the model to some data store (file, web resource, database entry, whatever) in a format your rendering program can access. A changed model is stored in a different storage location, loaded as well and to represent the change you draw the new model.

Another way to build geometry is using Constructive (Solid) Geometry (CSG) system, with which you build a scene from basic building blocks (planes, spheres, cones, closed surface patches) and logical operations (union, difference, intersection, exclusion). However OpenGL is not a geometry processing library.

What OpenGL gives you are drawing tools: Canvases (=framebuffers), Stencils, Scissors, Collage Images (textures), "Shapes" (=Primitives, ie points, lines, triangles) and "Smart Brushes" (shaders). Interestingly enough, by using the stencil buffer with multiple passes one can do screen space, image based logical operations on solids. But this is really just a image based effect and won't process the geometry itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM