[Imaging] Textures and shaders

Hello everybody (I'm French, escuse me for my mistakes) :),

So, I would like to know if you know websites with samples of graphical pipeline source codes ? ^^
I'm trying to program a graphics pipeline which takes data in a .Ply files.
For the moment, I manage to make a Phong and Gouraud renders.
However, I would like to make two another things :

1/ Display objects' shade.

2/ Put a texture on my objects.

Unfortunately, I have lot of diffulties with this both parts.
So, I would like to see samples of source codes which represent theses types of calculs operations. Moreover, I want to use only native libraries and vector.

thanks for your intention and thnaks for your answers.

PS : I you want more information, I'm listening your questions :)

Traduction/Translation :

Bonjour à tous :),

voilà, j'aimerais savoir si vous connaissez des sites avec des exemples d'implémentation de pipeline graphique ? :calim2:
Je m'explique. J'essaie d'implémenter un pipeline graphique qui prend des informations dans un fichier .Ply et qui affiche l'objet 3D après quelques transformation (pour être honnête je ne le fais pas totalement pour le plaisir, c'est pour un TP à la fac, même si j'apprend pas mal de choses intéressantes en le faisant lol).
J'ai déjà réussi la partie principale qui consiste à faire un rendu avec ombrage (avec soit, interpolation de Phong, soit une interpolation de Gouraud). Cependant, il me reste deux objectifs à réaliser :

1/ Afficher les ombres de mes objets. (pour information j'utilise la méthode du z-buffer si ça peut-être utile ^^)

2/ Appliquer une texture à mes objets.

Malheureusement j'ai énormément de difficulté avec ceux deux parties.
Donc, j'aimerais voir des exemples de code qui représentent les calculs de ce genre d'opération. J'ai déjà trouvé quelques codes mais tous utilisaient un bibliotheque et moi je ne désire utiliser que du natif (enfin, j'utilise la classe vector aussi lol mais bon...).

Je vous remercie d'avoir prit le temps de lire tout ça et vous remercie d'avance pour vos réponses.

PS : Si vous désirez plus de détails, bien sûr, je suis à votre entière disposition ^^ :ccool:
Last edited on
Hello,

I'm sorry but I enable myself to up my topic because I was posted it later and I'm afraid that it wasn't look by lot of people. thanks...
Are you using GDI or GDI+ ? Either one can be used to apply textures. Try this link :

NOTE : This code is C# code, but you can translate it to C++

http://www.functionx.com/vcsharp/gdi+/texturebrushes.htm


Also, in the end, you'll need to know if your going to use DirectX or OpenGL if you want to apply shading.

UPDATE EDIT : Found what I was looking for. This is C++ : http://www.functionx.com/visualc/bitmaps/DisplayFromResource.htm
Last edited on
Thanks for your answer.

I use only native libraries and vector so I thinks the answer for your question about GDI is "no". But perhaps I don't understand your question ^^

Thanks you very much :) I will show your links.
Well if your not using GDI what else are you using as your graphics library to see Polygon (.Ply) files ? You have to have some sort of graphics library to see it. So which one you using ?
I have a class which is named "PlyLoader" and it load a .Ply file.
After that, I make lot of calcul on my data and I display the results.

Right Paladice, what graphics library are you using to display it on the screen ?
Last edited on
Sorry ^^ lol

I put into a byte* informations about my picture (transformated data).
Then I use one of these two functions :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
void Pipeline::PpmWrite(char *name) {
	FILE *ptf;
	ptf = fopen(name,"wb");
	fprintf(ptf,"P6\n");
	fprintf(ptf,"%u %u\n", m_largeur, m_hauteur);
	fprintf(ptf,"255\n");
	fwrite(m_image,sizeof(uchar),3 * m_largeur * m_hauteur,ptf);
	fclose(ptf);
}

/**
* \fn void PgmWrite(char *name)
* \brief Fonction permettant d'enregistrer une image en niveau de gris
* \param name Le nom de l'image
*/
void Pipeline::PgmWrite(char *name) {
	FILE *ptf = NULL;
	ptf = fopen(name,"wb");
	fprintf(ptf,"P5\n");
	fprintf(ptf,"%u %u\n", m_largeur , m_hauteur);
	fprintf(ptf,"255\n");
	fwrite(m_image, sizeof(byte), m_largeur * m_hauteur, ptf);
	fclose(ptf);
}


To finish, I use a software to read a .PPM or .PGM files ^^
^^ If you want I can send you my project. But it is a huge project :/
Right Paladice, your not displaying graphics.. in that code. Its why my original question to you is what graphics library you are using if you are not using GDI.
Last edited on
Oh I'm so sorry :/. I thought that GDI is a graphics library... but I'm just reading on a website that GDI is a device lol.
I display my picture on a simple computer screen.
It is a good answer for your question or I'm doing a mistake again ^^'
No no.. your correct. :) GDI+ is a graphics API though.
Last edited on
:)

You want to work with me :p ?

It's a good thing for you to learn french and for me to learn english :p
Last edited on
I personally think your doing good for learning English. :)

On another note, if you want to display textures, you need a graphics API such as GDI+ or DirectX or OpenGL. Try GDI+ out. There are a lot of tutorials on it. In fact youtube might have what you need in French too. Just do a search in youtube.
Last edited on
Ok :) thanks you for all ;) and good continuation on this website :)
Topic archived. No new replies allowed.