NVIDIAGameWorks / FleX

Other
646 stars 99 forks source link

How to render objects with texture? #91

Open pkoliveira opened 4 years ago

pkoliveira commented 4 years ago

I'm trying to render object Lee Perry-Smith Head from McGuire Computer Graphics Archive, the obj has texture and if i render in Blender or Meshlab, the texture is displayed, but when i try to load in Flex demo, the texture is not rendered.

I'm using: ImportMesh

leothomas77 commented 4 years ago

Hello, The original Mesh class already loads the texture coordinates of the mesh. But to load a texture atlas by an .obj model and a .mtl file, it would be necessary to do some adaptations. The method CreateGpuMesh should be adapted to load the texture coordinates in the BufferData, and also set the AttributePointers (if you use modern Opengl) You should load the texture files, and bind it when you select your shader to draw Observe that Flex original code uses GLSL 1.2, and uses texture to render the shadow with deffered shader. I adapted the code to GLSL 4.3 and implemented with modern Opengl make the code easier to me