• 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.
Sign in to follow this  
Followers 0
robolee

rendering as white rectangle + image rotation issue + any advice to improve the code

3 posts in this topic

You can't do jack without the code so I'll post it right off the bat:

[url="http://pastebin.com/6C2RTMb2"]http://pastebin.com/6C2RTMb2[/url] -draw.h
[url="http://pastebin.com/6ysGygxp"]http://pastebin.com/6ysGygxp[/url] -draw.cpp (using texture rectangles)
[url="http://pastebin.com/R7Daf8n5"]http://pastebin.com/R7Daf8n5[/url] -draw.cpp (replacement functions for using texture_2d instead of texture rectangles)

So, first of all I'll just say that it's all fully working 2d sprite rendering code... That is to say fully working [i]for me[/i], my friend [i]claims[/i] that no matter what I change my draws just render as white rectangles, despite the fact that it's fully working on my own machine (nvidia 8800gt) and an old crappy laptop I own which only has intel integrated graphics. I just wanted to know if it should be working properly and it's just a driver error/problem on his half. Also other than that I would like general advice on how I could improve and also what I can do to make it as compatible as possible.

Secondly when doing smooth rotation using linear interpolation on the min and mag filters I get magenta fuzz around the sprite (magenta is set to 0 opacity on image load) and image zoom is linear as well. Nearest Neighbour zoom is good but the rotation is horrible. Is it possible to get smooth rotation without the magenta fuzz and to scale up using NN? I guess ideally what I want is AA for the edge of the sprite whilst using NN body rotation and zoom, which I hadn't thought of until I just came to write it down. Is that easily achievable?




some notes(/brain farts - ignorable):
Texture rectangles seem a lot easier to set up but support should be a lot less, especially for older hardware. The last thing I was going to try with Texture_2D is matching/square power of 2 w&h (32*32, 64*64 etc.), the last thing I did there was to make it power of 2 w&h but nearest increment for w&h separately (so it could be 32*64, 64*128 etc.) which I thought should be extremely compatible?
Here's my self written image loader if you wanted to view it: [url="http://pastebin.com/ejkj2hvm"]http://pastebin.com/ejkj2hvm[/url] at the moment it only loads and saves 24bit BMPs, honestly I don't need any more functionality than that and it was fun to learn. If I wanted to load more types I won't be trying that myself, BMPS are far enough in terms of enjoyment/difficulty to implement.
And just for my interest would porting this code to OGL ES be straightforward? This is just a secondary question I don't plan to any time soon but my friend thinks that it would be cool to port an app to the iPhone or iPad (though honestly I personally hate apple products) and besides it won't be happening for a while anyway even I decided I wanted to. Edited by robolee
0

Share this post


Link to post
Share on other sites
GL_TEXTURE_RECTANGLE_NV

This should not be necessary. I have no idea what it actually does, but I never use it for non-square textures. You can always call glGetError or glGetLastError or whatever it is, to find the issue.
0

Share this post


Link to post
Share on other sites
GL returns no errors using either GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_NV (just tested using both). - "So, first of all I'll just say that it's all fully working 2d sprite rendering code... That is to say fully working for me". [i]IF[/i] there's an issue then it is an issue of compatibility I believe. Like I said I think it's a problem on his end (dodgey driver or copying wrong files or other user mistake), I just want to know if I'm not crazy and it should be working or if there's some genuine compatibility problem.

And of course texture rectangles aren't necessary, texture rectangles just make the texture generation a little simpler (you use 1:1 pixel coordinates instead of normalized coordinates), but aren't be compatible with old hardware. However this friends hardware is relatively new and [i]neither method[/i] worked. This was just a new thing I tried more recently which is why it's in the main code instead of texture_2d.

[b]Anyway [/b]anyone got any advice on the second issue (rotation)? Edited by robolee
0

Share this post


Link to post
Share on other sites
This code won't port to OpenGL ES. The matrix stack (glTranslate, glRotate, etc) doesn't exist in that standard. You are expected to keep track of them yourself and pass the values to shaders, where you transform the vertices yourself. It also does not support the glVertex line of functions ( You have to use vertex arrays or VBOs), and works without a fixed-function pipeline (meaning shaders are required).

It sounds like linear interpolation is yielding magenta "fuzz" because it's averaging magenta with zero alpha with whatever your sprite color is, (at 1.0 alpha most likely).
If you call
[CODE]
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_LESS_EQUAL, f);
[/CODE]
Where f is a floating-point value between 0 and 1 (you'd have to experiment to see what looks good), your fuzz might clear up. Note that this means any pixels with an alpha value below f will now not be drawn!
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0