• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

nPawn

Help with Textures in DX7

4 posts in this topic

you have to set the texel coordinates on the triangle. Did you do this? Each vertex has an additional 2 fields for texels. The coordinates range from 0 --> 1. The lower left corner of your image is 0,0 and the upper right corner is 1,1. If you wanted to map this image to a triangle you would set the texels like this(crappy triangle though):
(0.5,1)
/\
/ \
/____\
(0,0) (1,0)

sorry kinda crappy explanation. If you don't do that, Direct3D doesn't know how to map the texture onto the geometry so you don't see it.

Killer

0

Share this post


Link to post
Share on other sites
Ahh thanks, i saw no mention of this in the docs i'll have to look a bit harder. I'll go give it a try right now.
0

Share this post


Link to post
Share on other sites
Yep, you were right, now i just wonder how i'm going to apply a single texture to several triangles, that looks like it might get ugly doing it this way...?
0

Share this post


Link to post
Share on other sites
I'm trying to do the simple task of adding a texture to a triangle in DX7. I've loaded up the image just fine, into a LPDIRECTDRAWSURFACE7 as a texture, I then use the SetTexture command right before i call drawprimitive yes the triangle doesn't get textured, it just remains the color of the material that i set. Here's a snippet of code:

hResult = g3d.m_pDevice->SetTexture( 0, lpSurface); //set the texture here, works just fine
if (hResult != D3D_OK)
{
ErrorSys.Log("SetTexture failed",hResult,false,true);
}
hResult = g3d.m_pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_VERTEX, objTriangle.m_pVertex_List, objTriangle.m_dwVertex_Count, NULL ); //drawprimitive works just fine

the only difference i see is that in my code i use D3DPT_TRIANGLELIST instead of D3DPT_TRIANGLESTRIP like the tutorials, but even if i use trianglestrip it makes no difference i still get the bland triangle. The only thing i can think of is that because my texture isn't the same size of my triangle it doesn't "fit" on maybe, i'm just trying to apply one of the example textures from the tutorias. Any suggestions of where to look, everything seems to be working, no error codes at all, just no texture, so i must be missing something simple along the way.

0

Share this post


Link to post
Share on other sites
all you need is to write a function that figures out the dimensions of your object and automatically sets up the texels for you. One way to do it for linear texture projections(ie. say we're putting a texture on the wall of a building that is made up of 10x10 vertices, each of which needs texel coords). When you load your object, go through all the vertices and figure out the max/min displacements for the wall on the two axes perpendicular to the surface normal. Since you know that you want (0,0) on the lower right hand part of the wall and (1,1) on the upper left part, you need to visit each vertex again and give it a value from 0-->1 based on it's percentage of the way from max-->min. ie. if it is 95% of the way from min to max on the X axis, you would give it 0.95 as a texel coordinate for X, if the same vertex was only 20% of the way from min to max on the Y axis, you would give it 0.20 as a texel coord for the Y axis. You can come up with some simple formulas to go through all your vertices and do this.

Killer

0

Share this post


Link to post
Share on other sites