How is this 3D rendering on the desktop done - c++

I read a topic on OpenGL.org where a guy made this:
http://coreytabaka.com/programming/cube-demo/
He said to release the source code but he never did,
does anyone how I could get the same idea?
Has to do with clearing the window with alpha but drawing
on it as well.. just don't get how to get OpenGL setup like
that. From there I can do my stuff but I'd like a base for
this running in C++ with VisualStudio,
Anybody has something like this laying around ? Or can show
pieces of the code to get this kind of rendering done.

Render the 3d scene to a pbuffer.
Use a color key to blend the pbuffer to screen.

Related

Direct2d offscreen rendering buggy?

I'm trying to render a bitmap using an offscreen bitmaprendertarget and then draw that on the screen. It works just fine but when I try to render seperate bitmaps on it, it's like the render doesn't work and it only clips the original picture.
Here's what it looks like: http://img827.imageshack.us/img827/7991/clipped.png
I'm using a compatiblerendertarget with the hwndrendertarget. Funny thing is, when I render them using the onscreen hwndrendertarget, they come out just fine.
Like this: http://img141.imageshack.us/img141/4825/workingj.png
I'm using CopyFromRendertarget to get the bitmap out of the Rendertarget, as the GetBitmap doesn't work for me with the Bitmaprendertarget for some reason. This is on Visual studio 2010 C++.
Anyone know what's going on here?
---- EDIT ----
An interesting thing to note: I tried putting clear after getting the bitmap and then doing EndDraw, but then it only gets the first bitmap, and the other bitmaps won't get drawn at all.
I was experimenting some stuff and noticed that I don't need to put EndDraw at all to the bitmaprendertarget in order for it to get the bitmaps needed. I can call EndDraw on it when I'm done using the offscreen RT and it works just fine.

Cocos2D for Android textures disappear

Some times textures disappear from sprites. I have a sprite that appears with white color and it should have a texture on it and a label that should have a text in it an it appears with black color. The labels are subclasses of sprite so this problem is related to Sprites. Could some one tell me what is the problem ? Did some one meet this bug to in Cococs2D on Android ? Thank's !
I had such a problem when I was doing navigation from "outside" of cocos2d i.e. i relied on Android's native back button's callback to change scenes. Apparently this callback doesn't work on the same thread as cocos and causes this problem (maybe something with WeakReferences in the TextureCache). Hope it helps :)
Are you using pvr? When I tried using pvr I was getting what sounds like the same issues. I switched to png and it fixed the problem for me.

DirectX Rendering

So I've created this program to render to a window using DirectX. It has an init() method which requires a HWND object so that it can initialize DirectX to the window, and then a render() method which is called inside of an infinite-loop, and then finally a cleanup() method to release DirectX-objects and devices. However, DirectX will render a couple of frames of a rotating cube (maybe enough for a half-rotation), and then the screen will go black. Then the cube will come back on, but it is still rotating during the black period. This continues in an on...off...on...off sort of pattern. Is DirectX maybe not rendering correctly to the window? What's wrong?
From my experience I think there is a good chance you need to explicitly implement the handling of the background erase event for your window (see this page), otherwise, the default implementation will kick in and get in your way (sometime erasing what DirectX just rendered as others suggested).
But well, as everybody mentioned already: this is only a little theory, and we would need some code to check this further :-).

OpenGL graphics editor...implementation of eraser tool

i'm writing a menu-based OpenGL graphics editor.It is pretty basic. Every time i choose a new option in the pop-down menu, the older drawing disappears,this doesn't allow me to use the eraser tool...could anybody tell me how to solve this problem?thanx
Your question is vague. Anyway...
Are you drawing picture directly on the screen/window? Then of COURSE drawings will disappear.
Paint picture to texture (framebufferObjects or whatever. See NVidia OpenGL SDK for examples). Then render texture on the screen. clear screen, draw texture, then draw menu, every time you need to repaint window.

Size of OPENGL context in SFML WINDOW

i'm currently working on a voxel editor and everything is going fine.
I have my SFML windows and my model to work with. I was just wondering if it was possible with SFML to set the 3D context to a certain specefic size.
I'm asking this because my model is currently shown on the screen with not problem at all, except that now, I want to create some options settings with SFML and my button will on my 3D model. Like, I would like 75% of the left side of my window to be my 3D context and the 25% at the right to be blank with space to fill in my buttons.
To do what you want to do, I believe what you're looking for is this: http://www.sfml-dev.org/documentation/2.0/classsf_1_1View.php#details
I think the context is attached to the window in general. Also be aware that SFML is for 2D graphics. Once you want 3D rendering, you're going to need to use openGL directly. SFML is a wrapper for openGL calls so there's no problem with using SFML to help set up and manage things, and openGL directly for rendering needs.
http://www.sfml-dev.org/tutorials/2.0/window-opengl.php
try:
glViewport(x,y,width,height);
source: https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glViewport.xml