Click here to Skip to main content
15,887,267 members
Home / Discussions / C#
   

C#

 
AnswerRe: StateChange event issue in SQL Server 2016 and .net 4.7 ado.net Pin
Gerry Schmitz20-Apr-18 20:19
mveGerry Schmitz20-Apr-18 20:19 
QuestionHow can we copy and move folders in one folder to another folder. Pin
Member 1377710419-Apr-18 20:14
Member 1377710419-Apr-18 20:14 
AnswerRe: How can we copy and move folders in one folder to another folder. Pin
OriginalGriff19-Apr-18 21:35
mveOriginalGriff19-Apr-18 21:35 
AnswerRe: How can we copy and move folders in one folder to another folder. Pin
BillWoodruff20-Apr-18 3:29
professionalBillWoodruff20-Apr-18 3:29 
GeneralRe: How can we copy and move folders in one folder to another folder. Pin
OriginalGriff20-Apr-18 4:09
mveOriginalGriff20-Apr-18 4:09 
GeneralRe: How can we copy and move folders in one folder to another folder. Pin
BillWoodruff20-Apr-18 15:32
professionalBillWoodruff20-Apr-18 15:32 
AnswerRe: How can we copy and move folders in one folder to another folder. Pin
Gerry Schmitz20-Apr-18 7:09
mveGerry Schmitz20-Apr-18 7:09 
QuestionPLEASE HELP ME - I have problem with OpenTK and Loading WaveFront ( obj without materials ) Pin
Jens Eckervogt 19-Apr-18 11:03
Jens Eckervogt 19-Apr-18 11:03 
Hello everyone, I really need help about problem with loading of WaveFrontLoader.cs

I have tried to load obj but GameWindow doesn't show model why because it has nothing any errors.

I really want to have resolve WaveFront on my GameWindow

I will show code and file:

using OpenTK;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Tutorial_08.net.sourceskyboxer
{
    public class WaveFrontLoader
    {
        private static List<Vector3> inPositions;
        private static List<Vector2> inTexcoords;
        private static List<Vector3> inNormals;

        private static List<float> positions;
        private static List<float> texcoords;
        private static List<int> indices;

        public static RawModel LoadObjModel(string filename, Loader loader)
        {
            inPositions = new List<Vector3>();
            inTexcoords = new List<Vector2>();
            inNormals = new List<Vector3>();

            positions = new List<float>();
            texcoords = new List<float>();
            indices = new List<int>();

            int nextIdx = 0;

            using (var reader = new StreamReader("Contents/" + filename + ".obj", Encoding.UTF8))
            {
                string line = reader.ReadLine();
                while (true)
                {
                    string[] currentLine = line.Split(new[] { ' ' }, StringSplitOptions.None);

                    if (currentLine[0] == "v")
                    {
                        Vector3 pos = new Vector3(float.Parse(currentLine[1]), float.Parse(currentLine[2]), float.Parse(currentLine[3]));
                        inPositions.Add(pos);

                        if (currentLine[1] == "t")
                        {
                            Vector2 tex = new Vector2(float.Parse(currentLine[1]), float.Parse(currentLine[2]));
                            inTexcoords.Add(tex);
                        }

                        if (currentLine[1] == "n")
                        {
                            Vector3 nom = new Vector3(float.Parse(currentLine[1]), float.Parse(currentLine[2]), float.Parse(currentLine[3]));
                            inNormals.Add(nom);
                        }
                    }

                    if (currentLine[0] == "f")
                    {
                        Vector3 pos = inPositions[0];
                        positions.Add(pos.X);
                        positions.Add(pos.Y);
                        positions.Add(pos.Z);
                        Vector2 tc = inTexcoords[0];
                        texcoords.Add(tc.X);
                        texcoords.Add(tc.Y);
                        indices.Add(nextIdx);
                        ++nextIdx;
                    }

                    reader.Close();
                    return loader.loadToVAO(positions.ToArray(), texcoords.ToArray(), indices.ToArray());
                }
            }
        }
    }
}


in Game.cs:

loader = new Loader();
shader = new StaticShader();
renderer = new Renderer(shader);

//model = loader.loadToVAO(vertices, textureCoords, indices);
model = WaveFrontLoader.LoadObjModel("example", loader);
texturedModel = new TexturedModel(model, new ModelTexture(loader.loadTexture("example")));
entity = new Entity(texturedModel, new Vector3(0, 0, -40), 0, 0, 0, 1);
camera = new Camera();


Download myproblem.7z from mega.nz

How do I resolve if wavefront obj displays in GameWindow Thank you for checking and resolving.

Please promise me! I want listen how do I get working wavefrontloader.cs should parse to obj file. Thank you!
I am very broken since Sunday to today I can not resolve it cause WavefrontLoader can know Obj but doesn't show in GameWindow. How do I get successful loading obj. But it is really porting from LwjGL into C# OpenTK. Thanks for help!

AnswerRe: PLEASE HELP ME - I have problem with OpenTK and Loading WaveFront ( obj without materials ) Pin
Gerry Schmitz20-Apr-18 7:26
mveGerry Schmitz20-Apr-18 7:26 
GeneralRe: PLEASE HELP ME - I have problem with OpenTK and Loading WaveFront ( obj without materials ) Pin
Jens Eckervogt 20-Apr-18 10:21
Jens Eckervogt 20-Apr-18 10:21 
GeneralRe: PLEASE HELP ME - I have problem with OpenTK and Loading WaveFront ( obj without materials ) Pin
Gerry Schmitz20-Apr-18 12:37
mveGerry Schmitz20-Apr-18 12:37 
GeneralRe: PLEASE HELP ME - I have problem with OpenTK and Loading WaveFront ( obj without materials ) Pin
Jens Eckervogt 21-Apr-18 0:04
Jens Eckervogt 21-Apr-18 0:04 
GeneralRe: PLEASE HELP ME - I have problem with OpenTK and Loading WaveFront ( obj without materials ) Pin
Jens Eckervogt 20-Apr-18 9:39
Jens Eckervogt 20-Apr-18 9:39 
GeneralRe: PLEASE HELP ME - I have problem with OpenTK and Loading WaveFront ( obj without materials ) Pin
Gerry Schmitz20-Apr-18 13:08
mveGerry Schmitz20-Apr-18 13:08 
GeneralRe: PLEASE HELP ME - I have problem with OpenTK and Loading WaveFront ( obj without materials ) Pin
Pete O'Hanlon20-Apr-18 22:11
mvePete O'Hanlon20-Apr-18 22:11 
GeneralRe: PLEASE HELP ME - I have problem with OpenTK and Loading WaveFront ( obj without materials ) Pin
Jens Eckervogt 21-Apr-18 5:15
Jens Eckervogt 21-Apr-18 5:15 
GeneralRe: PLEASE HELP ME - I have problem with OpenTK and Loading WaveFront ( obj without materials ) Pin
Pete O'Hanlon21-Apr-18 5:38
mvePete O'Hanlon21-Apr-18 5:38 
Questionc# how to Temporary pause button click event until mousedoubleclick on new form-listbox shown? Pin
Member 1376930818-Apr-18 23:06
Member 1376930818-Apr-18 23:06 
AnswerRe: c# how to Temporary pause button click event until mousedoubleclick on new form-listbox shown? Pin
Eddy Vluggen18-Apr-18 23:10
professionalEddy Vluggen18-Apr-18 23:10 
AnswerRe: c# how to Temporary pause button click event until mousedoubleclick on new form-listbox shown? Pin
OriginalGriff18-Apr-18 23:50
mveOriginalGriff18-Apr-18 23:50 
AnswerRe: c# how to Temporary pause button click event until mousedoubleclick on new form-listbox shown? Pin
BillWoodruff20-Apr-18 3:59
professionalBillWoodruff20-Apr-18 3:59 
Questionplease hellp me how to write a code in c# which is send warning message before specific time thanks Pin
ahmedoze18-Apr-18 16:09
ahmedoze18-Apr-18 16:09 
AnswerRe: please hellp me how to write a code in c# which is send warning message before specific time thanks Pin
OriginalGriff18-Apr-18 19:50
mveOriginalGriff18-Apr-18 19:50 
QuestionRe: please hellp me how to write a code in c# which is send warning message before specific time thanks Pin
Eddy Vluggen18-Apr-18 22:50
professionalEddy Vluggen18-Apr-18 22:50 
AnswerRe: please hellp me how to write a code in c# which is send warning message before specific time thanks Pin
Richard MacCutchan19-Apr-18 0:57
mveRichard MacCutchan19-Apr-18 0:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.