2

I have learned how to import a .obj with assimp by shaders However, is it possible to import a .obj with assimp by fixed-function-pipeline. so that I can program by OpenGL API easily.

genpfault
  • 51,148
  • 11
  • 85
  • 139
W.X.Qiang
  • 21
  • 2
  • If by "easily" you mean "using the stuff I already know", then by definition you already know how to draw simle mesh with things you need (normals, vertex colours, texture coordinates, textures, ...). If that is not the case, then I don't really get the questions, as shaders should be easier to learn, and pretty much required on current hardware. What seems to be the problem? Which part of your code fundamentally contradicts with your intention to use FFP (whatever its reasons be)? – keltar Jun 05 '18 at 19:23
  • I want to use the model/view/projection transformation with fixed-function-pipeline, but to render a .obj model with shaders. So I want to import the .obj by fixed-function-pipeline! – W.X.Qiang Jun 06 '18 at 00:24
  • Sorry what you say makes no sense to me at all. You either use FFP or programmable pipeline. I have no idea how one could "import" "by FFP", or "by shaders". – keltar Jun 06 '18 at 04:14

1 Answers1

1

It shouldn't change significantly between the two, through assumption you should get your vertex positions, normals and UV coordinates which is independent from opengl.

What will change is that you won't use a VAO/VBO but you will have to send each vertex attribute "by hand" With glTexCoord2dv(your uv) glNormal3dv( your normal) glVertex3dv( your vertex)

For each of your face and vertex.

Edit:

The wavefront object format uses only one set of UV coordinates per vertex, so all your textures will use the same UV map. If you have textures that use multiple UV maps you should look into another format like .fbx . But these stuffs have nothing to do with the fixed/ programmable pipeline. Once the files are imported by assimp you are done. All that changes are the functions used to send the data. Also the material data of an obj file is very limited so all you'll have are the name of the texture used and it's channel. Since materials are heavily linked to your rendering pipeline information will always be lost.

florent teppe
  • 529
  • 5
  • 13
  • `glVertexPointer`/`glDrawElements` sounds a lot healthier. VBO should count as FFP, they are not really related. – keltar Jun 05 '18 at 19:19
  • Thanks! For example, there are "usemtl ***" statements in .obj files. However, in glTexCoord2dv(your uv), where are uv coordinates from? which textures? I seem to have loss of imfomation about "usemtl ***", which make me very confused. – W.X.Qiang Jun 06 '18 at 00:34
  • Thanks! I need a deeper understanding of FFP and assimp. – W.X.Qiang Jun 06 '18 at 10:13
  • @W.X.Qiang yeah your question isn't related to the rendering pipeline it would be easier to see a code sample of what you have and what you would like to have. Also why do you need to convert everything to 1.2 OGL – florent teppe Jun 06 '18 at 10:42