Jump to content

  • Log In with Google      Sign In   
  • Create Account


What to use ?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 Ertai   Members   -  Reputation: 122

Like
Likes
Like

Posted 02 October 2001 - 09:15 AM

OpenGL provides a number of memory menagement / drawing functions ... but what to use for what kind of stuff ? I''m doing a 2D tile engine, for the tiles i will be using textured Quads, i decided that ... but what should i use to display fonts ? or large pics like a background for the console, or user interface, or menu ... Oh, and what will happen if i try to call glTexImage2D when there is no more VideoMemory available, will OpenGL start using normal mem automatically ? Last question: I''d like to specify the placement of the textures quads so that no stratching has to be done: like every pixel in the texture image will exactly match a pixel in the framebuffer, so i can get more speed by disabling texturefilters, without losing graphics quality ... And what would be the best way to aply lightning to my tiles, by using vertex colors and smooth shading, but i can''t really get a grip on the glTexEnvi Function ... and the last question: I normally just set my viewport to the dimentions of my window, but when i do so a quad (-0.5, -0.5, 0.5, 0.5 ) will come out as a rectangle it would be a great help to just have gl coordinates match screen pixel coordinates ... thx in advance for any help !

Sponsor:

#2 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 02 October 2001 - 03:37 PM

quote:
Original post by Ertai
OpenGL provides a number of memory menagement / drawing functions ... but what to use for what kind of stuff ?

I''m doing a 2D tile engine, for the tiles i will be using textured Quads, i decided that ...

but what should i use to display fonts ? or large pics like a background for the console, or user interface, or menu ...



Just use textured tris or quads.

quote:

Oh, and what will happen if i try to call glTexImage2D when there is no more VideoMemory available, will OpenGL start using normal mem automatically ?



Texture management is black box. Just load them and let the driver do its job. It works for most cases.

quote:

Last question: I''d like to specify the placement of the textures quads so that no stratching has to be done: like every pixel in the texture image will exactly match a pixel in the framebuffer, so i can get more speed by disabling texturefilters, without losing graphics quality ...

And what would be the best way to aply lightning to my tiles, by using vertex colors and smooth shading, but i can''t really get a grip on the glTexEnvi Function ...

and the last question: I normally just set my viewport to the dimentions of my window, but when i do so a quad (-0.5, -0.5, 0.5, 0.5 ) will come out as a rectangle

it would be a great help to just have gl coordinates match screen pixel coordinates ...

thx in advance for any help !


Try fiddling with the glOrtho parameters.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

#3 Ertai   Members   -  Reputation: 122

Like
Likes
Like

Posted 02 October 2001 - 07:05 PM

THX !!!

one can''t have 800 * 600 textures right ?

#4 Malloc   Members   -  Reputation: 122

Like
Likes
Like

Posted 02 October 2001 - 07:26 PM

Nope but you can have a bunch of 256*256 Textures to do the job, the only problem is that you have to draw more polys and other stuff, not a hard problem to deal with.

Also the max texture size depends on you Video Card, the most common is 256*256, also textures height or width should be Powers of 2:

2
4
8
16
32
64
128
256
512

Well i hope that Helps at least a Bit


Behold the Powers of 2!
W-Buffer


#5 Ertai   Members   -  Reputation: 122

Like
Likes
Like

Posted 02 October 2001 - 10:41 PM

I allready knew that, but thank you anyway, I just thought it would be possible because i read something about going around that limitation in one of the NeHe tutz ..

but wouldn''t it be better to just use a glDrawPixels command for drawing such a large picture in 2D .. and only use textured Quads for smaller pics ?

and one other thing, you guys where talking about using glOrtho for aligning screen coordinates with opengl coordinates, could you tell me a little bit more about that ?

#6 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 03 October 2001 - 05:51 AM

quote:
Original post by Ertai
I allready knew that, but thank you anyway, I just thought it would be possible because i read something about going around that limitation in one of the NeHe tutz ..



Technically it is still a power of 2 texture, you just use part of it for you nonpower of 2 texture.

quote:

but wouldn''t it be better to just use a glDrawPixels command for drawing such a large picture in 2D .. and only use textured Quads for smaller pics ?



glDrawPixels is slow. OpenGL is a 3D graphics api, using glDrawPixels bypasses all the hardware acceleration available on your videocard.

quote:

and one other thing, you guys where talking about using glOrtho for aligning screen coordinates with opengl coordinates, could you tell me a little bit more about that ?


When your screen is set to 800x600 it is not square. I bet you are setting glOrtho to a square. -5, 5, -5, 5, -1, 1. That means OpenGL is trying to fit a square onto a rectangle and you get your square polys stretched into rectangles. Just make sure you parallel viewing volume matches the aspect ration of your screen resolution. 800x600 == 4/3 -2, 2, -1.5, 1.5, -1, 1

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

#7 Ertai   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 October 2001 - 09:23 AM

Thank you! you are the best, an answer to all my questions !

There is still one thing i don''t get:

If i have tile of 64 * 64 pixels ( for example )
how do i make sure that when I render one, using a textured QUAD, every texel stored in the textures will be placed on one pixel in the framebuffer exactly, so my texture doesn''t become ugly when i disable all those beautifull texture filters ...

thx in advance, Ertai

#8 Ertai   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 October 2001 - 09:26 AM

Hey !, i btw got my math teacher to tell me everything about matrices, so i might be able to figure that one out myself, but that is still to happen, and I would still very much like to see your reply !

#9 Ertai   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 October 2001 - 10:03 AM

hmmm, so i called

glOrtho( 0.0f, SCREEN_X, SCREEN_Y, 0.0f, -1.0f, 1.0f );

on the Projection matrix, but it doesn''t seem to have any effect whatsoever ...


#10 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 05 October 2001 - 07:53 AM

If you can post the code here or send it to me it would be easier to fix your problem. I can''t believe that glOrtho has no effect. I use it to get exact screen coordinates with an editor I made.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS